Rootstock (RSK) Owner
- RSK MainNet: 0x45d3e4fb311982a06ba52359d44cb4f5980e0ef1
- RSK TestNet: 0xca0a477e19bac7e0e172ccfd2e3c28a7200bdb71
- Smart contract
Owner of rsk top level domain. It can setSubdomainOwner
in RNS.
- It represents domain ownership implementing ERC-7211 non-fungible token standard. This standard provides basic functionality to track and transfer NFTs2.
- Stores domains' expiration time. The expiration time determines whether a domain is owned or not.
- Determines if a domain is available to be purchased.
- Accepts domain ownership clamming from previous rsk registrar.
- Grants access to other contracts for registering new domains (registrar role)2.
- Grants access to other contracts for renewing domains (renewer role)2.
- Allows to reclaim ownership in RNS of owned domains.
- It has an owner that can2
- Change rsk tld resolver and ttl.
- Add/remove registrar contracts.
- Add/remove renewer contracts.
Implementation
Rootstock (RSK) Owner is an Ownable
contract and represents domain labels ownership fully compatible with ERC-721 interface using OpenZeppelin's implementation.
The implementation is divided into two main parts: The public methods exposed by Rootstock (RSK) Owner, and the restricted access methods to manage upgrades to the solution. The latter will not be described in this article.
Public methods
available
- ERC-721
- ERC-165
The term domain label refers to the name that is added behind .rsk. For example, to register
'domain.rsk'
one should usekeccak256('domain')
fortokenId
parameters.
available
function available(uint256 tokenId) public view returns(bool);
Gets the owner of the specified domain.
tokenId
keccak256 of the domain label.
Returns domain owner.
balanceOf
function balanceOf(address owner) public view returns (uint256 balance);
Gets the amount of domains owned by the specified address.
owner
address to query the balance of.
Returns the amount owned by the passed address.
ownerOf
function ownerOf(uint256 tokenId) public view returns (address owner);
Gets the owner of the specified domain.
tokenId
keccak256 of the domain label to query the owner of.
Returns address currently marked as the owner of the given domain.
transferFrom
function transferFrom(address from, address to, uint256 tokenId) public;
Transfers the ownership of a given token ID to another address.
Usage of this method is discouraged, use safeTransferFrom whenever possible. Requires the msg.sender
to be the owner, approved, or operator.
from
current owner of the domain.to
address to receive the ownership of the given domain.tokenId
keccak256 of the domain label to be transferred.
approve
function approve(address to, uint256 tokenId) public;
Approves another address to transfer the given domain label.
The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator.
to
address to be approved for the giventokenId
.tokenId
keccak256 of the domain label to be approved.
getApproved
function getApproved(uint256 tokenId) public view returns (address operator);
Gets the approved address for a domain, or zero if no address set.
tokenId
keccak256 of the domain label to query the approval of.
Returns currently approved for the given domain.
setApprovalForAll
function setApprovalForAll(address operator, bool _approved) public;
Sets or unsets the approval of a given operator. An operator is allowed to transfer all tokens of the sender on their behalf.
to
operator address to set the approval.approved
representing the status of the approval to be set.
isApprovedForAll
function isApprovedForAll(address owner, address operator) public view returns (bool);
Tells whether an operator is approved by a given owner.
owner
owner address which you want to query the approval of.operator
operator address which you want to query the approval of
Returns whether the given operator is approved by the given owner.
safeTransferFrom
function safeTransferFrom(address from, address to, uint256 tokenId) public;
Safely transfers the ownership of a given domain to another address.
If the target address is a contract, it must implement onERC721Received
, which is called upon a safe transfer, and return the magic value bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))
; otherwise, the transfer is reverted.
Requires the msg.sender
to be the owner, approved, or operator.
from
current owner of the domain.to
address to receive the ownership of the given domain.tokenId
keccak256 of the domain label to be transferred.
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public;
_data
bytes data to send along with a safe transfer check.
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool);
Returns true if this contract implements the interface defined by interfaceId
, based on ERC-165 standard for interface detection.
This function call costs less than 30 000 gas.
- Strongly based on https://github.com/ensdomains/ethregistrar.
- https://github.com/OpenZeppelin/openzeppelin-contracts implementation.