INodeRegistry
Inherits: IERC721, IERC721Metadata, IERC721Errors, IMigratable, IRegistryParametersErrors
This interface defines the ERC721-based registry for “nodes” in the system. Each node is minted as an NFT with a unique ID (starting at 100 and increasing by 100 with each new node). In addition to the standard ERC721 functionality, the contract supports node-specific features, including node property updates.
Functions
initialize
Initializes the contract.
function initialize() external;
addNode
Adds a new node to the registry and mints its corresponding ERC721 token.
Node IDs start at 100 and increase by 100 for each new node.
function addNode(address owner_, bytes calldata signingPublicKey_, string calldata httpAddress_)
external
returns (uint32 nodeId_, address signer_);
Parameters
| Name | Type | Description |
|---|---|---|
owner_ | address | The address that will own the new node node/NFT. |
signingPublicKey_ | bytes | The public key used for node signing/verification. |
httpAddress_ | string | The node’s HTTP address. |
Returns
| Name | Type | Description |
|---|---|---|
nodeId_ | uint32 | The unique identifier of the newly added node. |
signer_ | address | The address derived by the signing public key, for convenience. |
addToNetwork
Adds a node to the canonical network.
function addToNetwork(uint32 nodeId_) external;
Parameters
| Name | Type | Description |
|---|---|---|
nodeId_ | uint32 | The unique identifier of the node. |
removeFromNetwork
Removes a node from the canonical network.
function removeFromNetwork(uint32 nodeId_) external;
Parameters
| Name | Type | Description |
|---|---|---|
nodeId_ | uint32 | The unique identifier of the node. |
setBaseURI
Set the base URI for the node NFTs.
function setBaseURI(string calldata baseURI_) external;
Parameters
| Name | Type | Description |
|---|---|---|
baseURI_ | string | The new base URI. Has to end with a trailing slash. |
setHttpAddress
Set the HTTP address of an existing node.
function setHttpAddress(uint32 nodeId_, string calldata httpAddress_) external;
Parameters
| Name | Type | Description |
|---|---|---|
nodeId_ | uint32 | The unique identifier of the node. |
httpAddress_ | string | The new HTTP address. |
updateAdmin
Updates the admin by referring to the admin parameter from the parameter registry.
function updateAdmin() external;
updateMaxCanonicalNodes
Updates the max canonical nodes by referring to the max canonical nodes parameter from the parameter registry.
function updateMaxCanonicalNodes() external;
NODE_INCREMENT
The increment for node IDs, which allows for 100 shard node IDs per node in the future (modulus 100).
function NODE_INCREMENT() external pure returns (uint32 nodeIncrement_);
admin
The address of the admin.
function admin() external view returns (address admin_);
adminParameterKey
The parameter registry key used to fetch the admin.
function adminParameterKey() external pure returns (string memory key_);
maxCanonicalNodesParameterKey
The parameter registry key used to fetch the max canonical nodes.
function maxCanonicalNodesParameterKey() external pure returns (string memory key_);
migratorParameterKey
The parameter registry key used to fetch the migrator.
function migratorParameterKey() external pure returns (string memory key_);
parameterRegistry
The address of the parameter registry.
function parameterRegistry() external view returns (address parameterRegistry_);
maxCanonicalNodes
The maximum number of nodes that can be part of the canonical network.
function maxCanonicalNodes() external view returns (uint8 maxCanonicalNodes_);
canonicalNodesCount
The number of nodes that are part of the canonical network.
function canonicalNodesCount() external view returns (uint8 canonicalNodesCount_);
getAllNodes
Gets all nodes regardless of their health status.
function getAllNodes() external view returns (NodeWithId[] memory allNodes_);
Returns
| Name | Type | Description |
|---|---|---|
allNodes_ | NodeWithId[] | An array of all nodes in the registry. |
getAllNodesCount
Gets the total number of nodes in the registry.
function getAllNodesCount() external view returns (uint32 nodeCount_);
Returns
| Name | Type | Description |
|---|---|---|
nodeCount_ | uint32 | The total number of nodes. |
getNode
Retrieves the details of a given node.
function getNode(uint32 nodeId_) external view returns (Node memory node_);
Parameters
| Name | Type | Description |
|---|---|---|
nodeId_ | uint32 | The unique identifier of the node. |
Returns
| Name | Type | Description |
|---|---|---|
node_ | Node | The Node struct containing the node's details. |
getIsCanonicalNode
Retrieves whether a node is part of the canonical network.
function getIsCanonicalNode(uint32 nodeId_) external view returns (bool isCanonicalNode_);
Parameters
| Name | Type | Description |
|---|---|---|
nodeId_ | uint32 | The unique identifier of the node. |
Returns
| Name | Type | Description |
|---|---|---|
isCanonicalNode_ | bool | A boolean indicating whether the node is part of the canonical network. |
getSigner
Retrieves the signer of a node.
function getSigner(uint32 nodeId_) external view returns (address signer_);
Parameters
| Name | Type | Description |
|---|---|---|
nodeId_ | uint32 | The unique identifier of the node. |
Returns
| Name | Type | Description |
|---|---|---|
signer_ | address | The address of the signer. |
Events
AdminUpdated
Emitted when the admin is updated.
event AdminUpdated(address indexed admin);
Parameters
| Name | Type | Description |
|---|---|---|
admin | address | The new admin. |
BaseURIUpdated
Emitted when the base URI is updated.
event BaseURIUpdated(string baseURI);
Parameters
| Name | Type | Description |
|---|---|---|
baseURI | string | The new base URI. |
HttpAddressUpdated
Emitted when the HTTP address for a node is updated.
event HttpAddressUpdated(uint32 indexed nodeId, string httpAddress);
Parameters
| Name | Type | Description |
|---|---|---|
nodeId | uint32 | The identifier of the node. |
httpAddress | string | The new HTTP address. |
MaxCanonicalNodesUpdated
Emitted when the maximum number of canonical nodes is updated.
event MaxCanonicalNodesUpdated(uint8 maxCanonicalNodes);
Parameters
| Name | Type | Description |
|---|---|---|
maxCanonicalNodes | uint8 | The new maximum number of canonical nodes. |
NodeAdded
Emitted when a new node is added and its NFT minted.
event NodeAdded(
uint32 indexed nodeId, address indexed owner, address indexed signer, bytes signingPublicKey, string httpAddress
);
Parameters
| Name | Type | Description |
|---|---|---|
nodeId | uint32 | The unique identifier for the node (starts at 100, increments by 100). |
owner | address | The address that receives the new node NFT. |
signer | address | The address derived by the signing public key, for convenience. |
signingPublicKey | bytes | The public key used for node signing/verification. |
httpAddress | string | The node’s HTTP endpoint. |
NodeAddedToCanonicalNetwork
Emitted when a node is added to the canonical network.
event NodeAddedToCanonicalNetwork(uint32 indexed nodeId);
Parameters
| Name | Type | Description |
|---|---|---|
nodeId | uint32 | The identifier of the node. |
NodeRemovedFromCanonicalNetwork
Emitted when a node is removed from the canonical network.
event NodeRemovedFromCanonicalNetwork(uint32 indexed nodeId);
Parameters
| Name | Type | Description |
|---|---|---|
nodeId | uint32 | The identifier of the node. |
Errors
ZeroParameterRegistry
Thrown when the parameter registry address is being set to zero (i.e. address(0)).
error ZeroParameterRegistry();
FailedToAddNodeToCanonicalNetwork
Thrown when failing to add a node to the canonical network.
error FailedToAddNodeToCanonicalNetwork();
FailedToRemoveNodeFromCanonicalNetwork
Thrown when failing to remove a node from the canonical network.
error FailedToRemoveNodeFromCanonicalNetwork();
InvalidOwner
Thrown when an invalid owner is provided.
error InvalidOwner();
InvalidHttpAddress
Thrown when an invalid HTTP address is provided.
error InvalidHttpAddress();
InvalidSigningPublicKey
Thrown when an invalid signing public key is provided.
error InvalidSigningPublicKey();
InvalidURI
Thrown when an invalid URI is provided.
error InvalidURI();
MaxCanonicalNodesBelowCurrentCount
Thrown when trying to set max canonical nodes below current canonical count.
error MaxCanonicalNodesBelowCurrentCount();
MaxCanonicalNodesReached
Thrown when the maximum number of canonical nodes is reached.
error MaxCanonicalNodesReached();
NoChange
Thrown when there is no change to an updated parameter.
error NoChange();
NotAdmin
Thrown when the caller is not the admin.
error NotAdmin();
MaxNodesReached
Thrown when the maximum number of nodes is reached.
error MaxNodesReached();
NotNodeOwner
Thrown when the caller is not the node owner.
error NotNodeOwner();
Structs
Node
Struct representing a node in the registry.
struct Node {
address signer;
bool isCanonical;
bytes signingPublicKey;
string httpAddress;
}
Properties
| Name | Type | Description |
|---|---|---|
signer | address | The address derived by the signing public key, for convenience. |
isCanonical | bool | A flag indicating whether the node is part of the canonical network. |
signingPublicKey | bytes | The public key used for node signing/verification. |
httpAddress | string | The HTTP endpoint address for the node. |
NodeWithId
Struct representing a node with its ID.
struct NodeWithId {
uint32 nodeId;
Node node;
}
Properties
| Name | Type | Description |
|---|---|---|
nodeId | uint32 | The unique identifier for the node. |
node | Node | The node struct. |