CNS smart contracts

CNS is built on Ethereum and comprises a bundle of Solidity smart contracts. Their source code is hosted in the dot-crypto repository and maintained by the Unstoppable Domains team. This article lists all the smart contracts from the repository and gives a brief description of each of them, along with the links to the source code and deployment addresses. If you are interested in high-level details about how CNS works, see Architecture overview.

This page is divided into sections, grouping contracts by the following categories:

User-facing contracts

This section lists all the smart contracts that users can directly interact with.

Registry

Registry is the central smart contract, which stores all CNS domains. Implementing ERC-721 non-fungible token standard, it defines ownership rules. It stores owner and Resolver addresses. For more details, see Architecture overview - Registry.

Network

Contract address

Mainnet

0xD1E5b0FF1287aA9f9A268759062E4Ab08b9Dacbe

Source code: contracts/Registry.sol

Resolver

Resolver is the smart contract that stores domain records and provides methods for domain resolution. For more details, see Architecture overview - Resolver.

Network

Contract address

Mainnet

0xb66DcE2DA6afAAa98F2013446dBCB0f4B0ab2842

Legacy Mainnet Resolvers:

Source code: contracts/Resolver.sol

ProxyReader

ProxyReader provides an interface, that allows users to fetch information about domains from both Registry and Resolver smart contracts in one call. For more details, see Architecture overview - RroxyReader.

Network

Contract address

Mainnet

0x7ea9Ee21077F84339eDa9C80048ec6db678642B1

Source code: contracts/ProxyReader.sol

SignatureController

SignatureController allows any account to submit management transactions on behalf of a token owner if an owner provides a signature for such a call.

Network

Contract address

Mainnet

0x82EF94294C95aD0930055f31e53A34509227c5f7

Source code: contracts/controllers/SignatureController.sol

DomainZoneController

DomainZoneController provides the functionality that allows owners of a domain zone to mint subdomains, that can be managed only by domain zone owners. For more details, see Architecture overview - Alternative ownership models.

Network

Contract address

Mainnet

0xeA70777e28E00E81f58b8921fC47F78B8a72eFE7

Source code: contracts/controllers/DomainZoneController.sol

FreeRegistrar

FreeRegistrar is a contract that can be used for allowing any user to freely mint a domain belonging to a subdomain zone.

Source code: contracts/controllers/FreeRegistrar.sol

WhitelistedMinter

WhitelistedMinter defines an interface for minting second-level domains. This smart contract is primarily used by the Unstoppable Domains team, but its interface also supports delegating minting process to other parties via Meta transactions. All calls to WhitelistedMinter get proxied to the Registry via the MintingController smart contract.

Network

Contract address

Mainnet

0xd3fF3377b0ceade1303dAF9Db04068ef8a650757

Source code: contracts/util/WhitelistedMinter.sol

TwitterValidationOperator

TwitterValidationOperator contract is used for initiating Chainlink requests, that validate Twitter usernames.

Network

Contract address

Mainnet

0xbb486C6E9cF1faA86a6E3eAAFE2e5665C0507855

Source code: contracts/operators/TwitterValidationOperator.sol

Registry controllers

The Unstoppable Domains team reserves the right to mint second-level domains and edit some Registry settings, such as token URI prefix. To avoid giving anyone absolute admin rights, CNS Registry utilizes controllers, that implement a limited set of admin actions.

MintingController

The deployed version of the Registry smart contract allows only MintingController to mint second-level domains. This smart contract is used by WhitelistedMinter as a proxy.

Network

Contract address

Mainnet

0xb0EE56339C3253361730F50c08d3d7817ecD60Ca

Source code: contracts/controllers/MintingController.sol

URIPrefixController

URIPrefixController enables the Unstoppable Domains team to edit the token URI prefix.

Network

Contract address

Mainnet

0x09B091492759737C03da9dB7eDF1CD6BCC3A9d91

Source code: contracts/controllers/URIPrefixController.sol

Interfaces

The following interfaces can be used as a guidance to the minimal implementation of custom smart contracts versions. Also, Solidity developers can rely on them for making calls to the official CNS smart contracts.

IRegistry

IRegistry interface declares all the Registry events and methods (both read and write ones).

Source code: contracts/IRegistry.sol

Implemented by:

IRegistryReader

IRegistryReader interface declares only read-only Registry methods.

Source code: contracts/IRegistryReader.sol

Implemented by:

IResolver

IResolver interface declares the minimal set of Resolver methods that are used for configuring domain records.

Source code: contracts/IResolver.sol

Implemented by:

IResolverReader

IResolverReader interface declares the set of Resolver methods that can are used for reading Resolver records.

Source code: contracts/IResolverReader.sol

Implemented by:

IDataReader

IDataReader interface declares the methods that are unique to the ProxyReader smart contract, which returns combined data from the Registry and Resolver contracts.

Source code: contracts/IDataReader.sol

Implemented by:

IMintingController

IMintingController interface declares a set of methods for minting, that both MintingController and WhitelistedMinter implement.

Source code: contracts/controllers/IMintingController.sol

Implemented by:

ISignatureController

ISignatureController interface declares the functions that are implemented by SignatureController to enable Meta transactions for the Registry smart contract.

Source code: contracts/controllers/ISignatureController.sol

Implemented by:

IURIPrefixController

IURIPrefixController interface declares the functions that are implemented by URIPrefixController.

Source code: contracts/controllers/IURIPrefixController.sol

Implemented by:

ERC677Receiver

ERC677Receiver interface declares an ERC-677 method for receiving smart contracts.

Source code: contracts/util/ERC677Receiver.sol

Implemented by:

Utility contracts

The utility contracts are generally used for sharing common functionality between other smart contracts. The list also includes some contracts that are used internally by the Unstoppable Domains team.

BulkWhitelistedRole

BulkWhitelistedRole is an extension of Open Zeppelin's WhitelistedRole, that adds bulk operations for adding and removing whitelisted accounts.

Source code: contracts/util/BulkWhitelistedRole.sol

Used by:

ControllerRole

The ControllerRole smart contract defines an Open Zeppelin's Role, which is used by the Registry to designate controllers.

Source code: contracts/util/ControllerRole.sol

Used by:

MultiSend

The MultiSend smart contract is used internally by the Unstoppable Domains team to fund worker accounts.

Source code: contracts/util/MultiSend.sol

SignatureUtil

SignatureUtil is a helper smart contract. Its implementation is used to extend smart contracts that require Meta transactions functionality.

Source code: contracts/util/SignatureUtil.sol

Used by:

Migrations

The Truffle migrations smart contract.

Source code: contracts/Migrations.sol

Test smart contracts

There are several smart contracts that are used for testing purposes, without being deployed to public networks or imported by other smart contracts.

LinkTokenMock

The LinkTokenMock smart contract is used for testing TwitterValidationOperator.

Source code: contracts/test-helpers/LinkTokenMock.sol

RelayTest

RelayTest is used for testing relaying functionality for Meta transactions.

Source code: contracts/test-helpers/RelayTest.sol

Simple

The Simple smart contract is used for testing the validations that check smart contracts for being valid ERC-721 receivers.

Source code: contracts/test-helpers/Simple.sol