Resolver

Features

Supported resolution protocols:

Architecture:

  • Upgradeable contracts using OpenZeppelin Upgrades.
  • Use setAuthorisation to enable others set your records.
  • Use multicall to perform multiple operations in one call/transaction.

Public methods

  • Resolution protocols
    • Contract and multicoin addresses: addr and setAddr
    • Contenthash: contenthash and setContenthash
    • Contract ABI: abi and setAbi
    • SECP256k1 public keys: pubkey and setPubkey
    • Text records: text and setText
    • Interface discovery: interfaceImplementer and setInterfaceImplementer
  • Administrative
    • Authorisations: authorisations, setAuthorisation and isAuthorised
    • Multiple calls: multicall

Authorisations

Any account can set an authorisation for any name, but the authorisation that is checked will be that of the current owner of a name. Thus, transferring a name effectively clears any existing authorisations, and new authorisations can be set in advance of an ownership transfer if desired.

function setAuthorisation(bytes32 node, address target, bool isAuthorised) external;

Sets or clears an authorisation. Authorisations are specific to the caller.

  • node The name to change the authorisation on.
  • target The address that is to be authorised or deauthorised.
  • isAuthorised True if the address should be authorised, or false if it should be deauthorised.
function authorisations(bytes32 node, address owner, address caller) exsternal view returns (bool);

A mapping of authorisations: (node, owner, caller) => isAuthorised.

function isAuthorised(bytes32 node) internal view returns(bool);

Returns if the sender is authorised for the given node.

Multi calling

This method allows to update more than one record in a single transaction or retrieve more than one record in a single call.

function multicall(bytes[] calldata data) external returns(bytes[] memory results);
  • data is an array of ABI-encoded calls to be performed. (spec)

An example in Javascript, which sets the address and content hash:

const resolver = new web3.eth.Contract(resolverAbi, resolverAddress)

const setAddrData = web3.utils['setAddr(bytes32,address)'](myNode, myNewAddress).encodeABI()
const setContenthashData = web3.utils.setContenthash(myNode, myNewContenthash).encodeABI()

await resolver.multicall([setAddrData, setContenhashData]).send()

Contract and multicoin addresses

Specs

function setAddr(bytes32 node, address a) external;

Sets the Rootstock address associated with an RNS node.

function setAddr(bytes32 node, uint coinType, bytes memory a) public;

Sets the coin address associated with an RNS node.

function addr(bytes32 node) public view returns (address payable);

Returns the Rootstock address associated with an RNS node.

function addr(bytes32 node, uint coinType) public view returns(bytes memory);

Returns the address associated with an RNS node.

Contenthash

Specs

function setContenthash(bytes32 node, bytes calldata hash) external;

Sets the contenthash associated with an RNS node.

function contenthash(bytes32 node) external view returns (bytes memory)

Returns the contenthash associated with an RNS node.

Contract ABI

Specs

function setABI(bytes32 node, uint256 contentType, bytes calldata data) external;

Sets the ABI associated with an ENS node. Nodes may have one ABI of each content type. To remove an ABI, set its value to an empty string.

function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory)

Returns the ABI associated with an RNS node.

SECP256k1 public keys

Specs

function setPubkey(bytes32 node, bytes32 x, bytes32 y) external

Sets the SECP256k1 public key associated with an RNS node.

Text records

Specs

function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y)

Returns the SECP256k1 public key associated with an RNS node.

Interface discovery

Specs

function setInterface(bytes32 node, bytes4 interfaceID, address implementer) external;

Sets an interface associated with a name. Setting the address to 0 restores the default behaviour of querying the contract at addr() for interface support.

function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address);

Returns the address of a contract that implements the specified interface for this name. If an implementer has not been set for this interfaceID and name, the resolver will query the contract at addr(). If addr() is set, a contract exists at that address, and that contract implements EIP-165 and returns true for the specified interfaceID, its address will be returned.

Receive updates

Get the latest updates from the Rootstock ecosystem

Loading...