Resolver
- RSK Mainnet:
0xD87f8121D44F3717d4bAdC50b24E50044f86D64B
- RSK Testnet:
0x25C289ccCFFf700c6a38722F4913924fE504De0e
- Repo: rnsdomains/rns-resolver
Features
Supported resolution protocols:
- Contract addresses - EIP-137
- Multicoin addresses - EIP-2304
- Contenthash - EIP-1577
- Contract ABI - EIP-205
- SECP256k1 public keys - EIP-619
- Text records - EIP-634
- Interface discovery - EIP-1844
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
andsetAddr
- Contenthash:
contenthash
andsetContenthash
- Contract ABI:
abi
andsetAbi
- SECP256k1 public keys:
pubkey
andsetPubkey
- Text records:
text
andsetText
- Interface discovery:
interfaceImplementer
andsetInterfaceImplementer
- Contract and multicoin addresses:
- Administrative
- Authorisations:
authorisations
,setAuthorisation
andisAuthorised
- Multiple calls:
multicall
- Authorisations:
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
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
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
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
function setPubkey(bytes32 node, bytes32 x, bytes32 y) external
Sets the SECP256k1 public key associated with an RNS node.
Text records
function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y)
Returns the SECP256k1 public key associated with an RNS node.
Interface discovery
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.