npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@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
  • 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:

  1. Calculate makeCommitment hash of the domain to be registered (off-chain).
  2. Commit the calculated hash using commit.
  3. Wait minCommitmentAge seconds.
  4. Execute registration via ERC-20 (with approval) or ERC-677.

Find transferAndCall() encoder in utils/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 in utils/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
  • 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

  1. Strongly based on https://github.com/ensdomains/ethregistrar.
  2. https://github.com/OpenZeppelin/openzeppelin-contracts implementation.
  3. https://eips.ethereum.org/EIPS/eip-20
  4. https://github.com/ethereum/EIPs/issues/677