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

@siddomains/sid-contracts

v0.1.31

Published

SID contracts

Downloads

2,123

Readme

Space ID (SID)

npm package

This repo doubles as an npm package with the compiled JSON contracts

import {
  BaseRegistrar,
  BaseRegistrarImplementation,
  BulkRenewal,
  SID,
  SIDRegistry,
  SIDRegistryWithFallback,
  SIDRegistrarController,
  FIFSRegistrar,
  LinearPremiumPriceOracle,
  PriceOracle,
  PublicResolver,
  Resolver,
  ReverseRegistrar,
  StablePriceOracle,
  TestRegistrar
} from '@Space-ID/SpaceIDContract'

Importing from solidity

// Registry
import '@Space-ID/SpaceIDContract/contracts/registry/SID.sol';
import '@Space-ID/SpaceIDContract/contracts/registry/SIDRegistry.sol';
import '@Space-ID/SpaceIDContract/contracts/registry/SIDRegistryWithFallback.sol';
import '@Space-ID/SpaceIDContract/contracts/registry/ReverseRegistrar.sol';
import '@Space-ID/SpaceIDContract/contracts/registry/TestRegistrar.sol';
// BNBRegistrar
import '@Space-ID/SpaceIDContract/contracts/bnbregistrar/BaseRegistrar.sol';
import '@Space-ID/SpaceIDContract/contracts/bnbregistrar/BaseRegistrarImplementation.sol';
import '@Space-ID/SpaceIDContract/contracts/bnbregistrar/BulkRenewal.sol';
import '@Space-ID/SpaceIDContract/contracts/bnbregistrar/BaseRegistrar.sol';
import '@Space-ID/SpaceIDContract/contracts/bnbregistrar/BNBRegistrarController.sol';
import '@Space-ID/SpaceIDContract/contracts/bnbregistrar/LinearPremiumPriceOracle.sol';
import '@Space-ID/SpaceIDContract/contracts/bnbregistrar/PriceOracle.sol';
import '@Space-ID/SpaceIDContract/contracts/bnbregistrar/StablePriceOracle.sol';
// Resolvers
import '@Space-ID/SpaceIDContract/contracts/resolvers/PublicResolver.sol';
import '@Space-ID/SpaceIDContract/contracts/resolvers/Resolver.sol';

Accessing to binary file.

If your environment does not have compiler, you can access to the raw hardhat artifacts files at node_modules/@Space-ID/SpaceIDContract/artifacts/contracts/${modName}/${contractName}.sol/${contractName}.json

Contracts

Registry

The SID registry is the core contract that lies at the heart of SID resolution. All SID lookups start by querying the registry. The registry maintains a list of domains, recording the owner, resolver, and TTL for each, and allows the owner of a domain to make changes to that data. It also includes some generic registrars.

SID.sol

Interface of the SID Registry.

SIDRegistry

Implementation of the SID Registry, the central contract used to look up resolvers and owners for domains.

SIDRegistryWithFallback

The new impelmentation of the SID Registry.

FIFSRegistrar

Implementation of a simple first-in-first-served registrar, which issues (sub-)domains to the first account to request them.

ReverseRegistrar

Implementation of the reverse registrar responsible for managing reverse resolution via the .addr.reverse special-purpose TLD.

TestRegistrar

Implementation of the .test registrar facilitates easy testing of SID on the Ethereum test networks. Currently deployed on Ropsten network, it provides functionality to instantly claim a domain for test purposes, which expires 28 days after it was claimed.

BNBRegistrar

Implements an SID registrar intended for the .bnb TLD.

These contracts were audited by ConsenSys dilligence; the audit report is available here.

BaseRegistrar

BaseRegistrar is the contract that owns the TLD in the BNB registry. This contract implements a minimal set of functionality:

  • The owner of the registrar may add and remove controllers.
  • Controllers may register new domains and extend the expiry of (renew) existing domains. They can not change the ownership or reduce the expiration time of existing domains.
  • Name owners may transfer ownership to another address.
  • Name owners may reclaim ownership in the BNB registry if they have lost it.
  • Owners of names in the interim registrar may transfer them to the new registrar, during the 1 year transition period. When they do so, their deposit is returned to them in its entirety.

This separation of concerns provides name owners strong guarantees over continued ownership of their existing names, while still permitting innovation and change in the way names are registered and renewed via the controller mechanism.

BNBRegistrarController

BNBRegistrarController is the first implementation of a registration controller for the new registrar. This contract implements the following functionality:

  • The owner of the registrar may set a price oracle contract, which determines the cost of registrations and renewals based on the name and the desired registration or renewal duration.
  • The owner of the registrar may withdraw any collected funds to their account.
  • Users can register new names using a commit/reveal process and by paying the appropriate registration fee.
  • Users can renew a name by paying the appropriate fee. Any user may renew a domain, not just the name's owner.

The commit/reveal process is used to avoid frontrunning, and operates as follows:

  1. A user commits to a hash, the preimage of which contains the name to be registered and a secret value.
  2. After a minimum delay period and before the commitment expires, the user calls the register function with the name to register and the secret value from the commitment. If a valid commitment is found and the other preconditions are met, the name is registered.

The minimum delay and expiry for commitments exist to prevent miners or other users from effectively frontrunnig registrations.

SimplePriceOracle

SimplePriceOracle is a trivial implementation of the pricing oracle for the EthRegistrarController that always returns a fixed price per domain per year, determined by the contract owner.

StablePriceOracle

StablePriceOracle is a price oracle implementation that allows the contract owner to specify pricing based on the length of a name, and uses a fiat currency oracle to set a fixed price in fiat per name.

Resolvers

Resolver implements a general-purpose BNB resolver that is suitable for most standard BNB use-cases. The public resolver permits updates to BNB records by the owner of the corresponding name.

PublicResolver includes the following profiles that implements different EIPs.

  • ABIResolver = EIP 205 - ABI support (ABI()).
  • AddrResolver = EIP 137 - Contract address interface. EIP 2304 - Multicoin support (addr()).
  • ContentHashResolver = EIP 1577 - Content hash support (contenthash()).
  • InterfaceResolver = EIP 165 - Interface Detection (supportsInterface()).
  • NameResolver = EIP 181 - Reverse resolution (name()).
  • PubkeyResolver = EIP 619 - SECP256k1 public keys (pubkey()).
  • TextResolver = EIP 634 - Text records (text()).
  • DNSResolver = Experimental support is available for hosting DNS domains on the Ethereum blockchain via ENS. The more detail is on the old BNB doc.

Developer guide

How to deploy

npx hardhat run --network bsc_testnet scripts/deploy.js 2> /dev/null

How to setup

git clone https://github.com/Space-ID/SpaceIDContract
cd SpaceIDContract
yarn

How to run tests

yarn test

How to publish

yarn pub