@rsksmart/rns-rskregistrar
v1.2.4
Published
Registrar for rsk top level domain.
Downloads
80
Readme
RSK Registrar
RNS Registrar for rsk top level domain.1
Contracts
The registrar is separated into several components for simplicity, modularity, and privilege minimization.
RSK Owner
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 wether 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.
MainNet: 0x45d3e4fb311982a06ba52359d44cb4f5980e0ef1
TestNet: 0xca0a477e19bac7e0e172ccfd2e3c28a7200bdb71
FIFS Registrar
Has registration role in RSK Owner
.
- Defines a commit-reveal process to avoid front-running.
- Accepts payments via
- ERC-20
approve()
+register()
.3 - ERC-677
transferAndCall()
.4
- ERC-20
- Calculates price using
NamePrice
contract. - It has an owner that can2
- Set minimum commitment age.
- Set minimum registration name length available.
- Change name price contract.
The registration must be performed as follows:
- Calculate
makeCommitment
hash of the domain to be registered (off-chain). - Commit the calculated hash using
commit
. - Wait
minCommitmentAge
seconds. - Execute registration via ERC-20 (with approval) or ERC-677.
Find
transferAndCall()
encoder inutils/index.js
,getRegisterData
MainNet: 0x779195c53cc7c1a33bd2eea5f63f2c1da8798d61
TestNet: 0x36ffda909f941950a552011f2c50569fda14a169
FIFS Addr Registrar
Has registration role in RSK Owner
.
- Adds an extra functionality to FIFS Registrar: set address resolution in registration transaction.
The registration must be performed following FIFS Registrar steps, adding address resolution in the last step.
Find
transferAndCall()
encoder inutils/index.js
,getAddrRegisterData
MainNet: 0xd9c79ced86ecf49f5e4a973594634c83197c35ab
TestNet: 0x90734bd6bf96250a7b262e2bc34284b0d47c1e8d
Name Price
Determines the price of a domain.
| Years | Price | | - | - | | 1 | 2 RIF | | 2 | 4 RIF | | 2+k | 4+k RIF |
For example, 5 years cost 7 RIF.
MainNet: 0xd09adf13e482928e47e96dd6f02aad1daf7a5a47
TestNet: 0x794f99f1a9382ba88b453ddb4bfa00acae8d50e8
Renewer
Has renewer role in RSK Owner
.
- Accepts payments via
- ERC-20
approve()
+register()
.3 - ERC-677
transferAndCall()
.4
- ERC-20
- Calculates price using
NamePrice
contract. - It has an owner that can2 change name price contract.
MainNet: 0x7a9872a7615c475b62a62b8f6e491077fb05f663
TestNet: 0xe48ad1d5fbf61394b5a7d81ab2f36736a046657b
JS
const Web3 = require('web3');
const FIFSRegistrarData = require('@rsksmart/rns-rskregistrar/FIFSRegistrarData.json');
const web3 = new Web3('https://public-node.rsk.co')
const FIFSRegistrar = new web3.eth.Contract(FIFSRegistrarData.abi, FIFSRegistrarData.address.rskMainnet);
Types
There are TypeScript typing definitions of the contracts published together with the original contracts. Supported contract's libraries are:
web3
version 1.* -web3-v1-contracts
web3
version 2.* -web3-v2-contracts
truffle
-truffle-contracts
ethers
-ethers-contracts
You can use them as follow:
import Web3 from 'web3'
import FIFSRegistrar from '@rsksmart/rns-rskregistrar/types/web3-v1-contracts/FIFSRegistrarData.d.ts'
import FIFSRegistrarData from '@rsksmart/rns-rskregistrar/FIFSRegistrarData.json'
const web3 = new Web3('https://public-node.rsk.co')
const registrar = new web3.eth.Contract(FIFSRegistrarData.abi, FIFSRegistrarData.address.rskMainnet) as FIFSRegistrar
Replace web3-v1-contracts
with the proper library version.
Setup
npm install
Run tests
truffle test
slither .
Get truffle: https://www.trufflesuite.com/ Get slither:https://github.com/crytic/slither
Import contracts
npm i @rsksmart/rns-rskregistrar
References
- Strongly based on https://github.com/ensdomains/ethregistrar.
- https://github.com/OpenZeppelin/openzeppelin-contracts implementation.
- https://eips.ethereum.org/EIPS/eip-20
- https://github.com/ethereum/EIPs/issues/677