Edit this page

[comment]: <> (! Note: Do not modify src/domain-registry-essentials/cns-smart-contracts.md directly. Edit templates/cns-smart-contracts-template.md instead following rules from README.)

CNS smart contracts

Crypto Name Service (CNS) is built on Ethereum and is effectively a bundle of Solidity smart contracts. Their source code is hosted in the dot-crypto repository and maintained by the Unstoppable Domains team. This page lists the smart contracts from that repository and gives a brief description of each along with links to the source code and deployment addresses. For 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 the ERC-721 non-fungible token standard, Registry defines domain ownership rules. It stores owner and Resolver addresses. For more details, see Architecture overview - Registry.

[comment]: <> (This is an auto-generated table with CNS smart-contract addresses. See README for more info.)

Network Contract address
Mainnet 0xD1E5b0FF1287aA9f9A268759062E4Ab08b9Dacbe
Rinkeby 0xAad76bea7CFEc82927239415BB18D2e93518ecBB

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.

[comment]: <> (This is an auto-generated table with CNS smart-contract addresses. See README for more info.)

Network Contract address
Mainnet 0xb66DcE2DA6afAAa98F2013446dBCB0f4B0ab2842
Rinkeby 0x95AE1515367aa64C462c71e87157771165B1287A

Network Legacy addresses
Mainnet 0xa1cac442be6673c49f8e74ffc7c4fd746f3cbd0d 0x878bc2f3f717766ab69c0a5f9a6144931e61aed3

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 - ProxyReader.

[comment]: <> (This is an auto-generated table with CNS smart-contract addresses. See README for more info.)

Network Contract address
Mainnet 0xa6E7cEf2EDDEA66352Fd68E5915b60BDbb7309f5
Rinkeby 0x3A2e74CF832cbA3d77E72708d55370119E4323a6

Network Legacy addresses
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 that call.

[comment]: <> (This is an auto-generated table with CNS smart-contract addresses. See README for more info.)

Network Contract address
Mainnet 0x82EF94294C95aD0930055f31e53A34509227c5f7
Rinkeby 0x66a5e3e2C27B4ce4F46BBd975270BE154748D164

Source code: contracts/controllers/SignatureController.sol

DomainZoneController

DomainZoneController allows owners of a domain zone to mint subdomains. These subdomains can be managed only by the domain zone owners. For more details, see Architecture Overview - Alternative Ownership Models.

[comment]: <> (This is an auto-generated table with CNS smart-contract addresses. See README for more info.)

Network Contract address
Mainnet 0xeA70777e28E00E81f58b8921fC47F78B8a72eFE7
Rinkeby 0x6f8F96A566663C1d4fEe70edD37E9b62Fe39dE5D

Source code: contracts/controllers/DomainZoneController.sol

TwitterValidationOperator

TwitterValidationOperator is used when initiating Chainlink verification requests to link domain records with Twitter usernames.

[comment]: <> (This is an auto-generated table with CNS smart-contract addresses. See README for more info.)

Network Contract address
Mainnet 0xbb486C6E9cF1faA86a6E3eAAFE2e5665C0507855
Rinkeby 0x1CB337b3b208dc29a6AcE8d11Bb591b66c5Dd83d

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, Registry utilizes controllers that implement a limited set of admin actions.

MintingController

The deployed version of the Registry smart contract only allows MintingController to mint second-level domains.

[comment]: <> (This is an auto-generated table with CNS smart-contract addresses. See README for more info.)

Network Contract address
Mainnet 0xb0EE56339C3253361730F50c08d3d7817ecD60Ca
Rinkeby 0x51765307AeB3Df2E647014a2C501d5324212467c

Source code: contracts/controllers/MintingController.sol

URIPrefixController

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

[comment]: <> (This is an auto-generated table with CNS smart-contract addresses. See README for more info.)

Network Contract address
Mainnet 0x09B091492759737C03da9dB7eDF1CD6BCC3A9d91
Rinkeby 0xe1d2e4B9f0518CA5c803073C3dFa886470627237

Source code: contracts/controllers/URIPrefixController.sol

Interfaces

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

IRegistry

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

Source code: contracts/IRegistry.sol

Implemented by:

IRegistryReader

The IRegistryReader interface declares only read-only Registry methods.

Source code: contracts/IRegistryReader.sol

Implemented by:

IResolver

The IResolver interface declares the minimal set of Resolver methods for configuring domain records.

Source code: contracts/IResolver.sol

Implemented by:

IResolverReader

The IResolverReader interface declares the set of methods for reading Resolver records.

Source code: contracts/IResolverReader.sol

Implemented by:

IDataReader

The 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

The IMintingController interface declares a set of methods for minting, which both MintingController implement.

Source code: contracts/controllers/IMintingController.sol

Implemented by:

ISignatureController

The 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

The IURIPrefixController interface declares the functions that are implemented by URIPrefixController.

Source code: contracts/controllers/IURIPrefixController.sol

Implemented by:

ERC677Receiver

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

Source code: contracts/util/ERC677Receiver.sol

Implemented by:

Utility contracts

Utility contracts are generally used to share common functionality between other smart contracts. This list also includes some contracts that are used internally by the Unstoppable Domains team.

ControllerRole

The ControllerRole smart contract defines an Open Zeppelin Role, which is used by 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.

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 ERC-721 receiver validation checks.

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