[comment]: <> (! Note: Do not modify src/domain-registry-essentials/uns-smart-contracts.md directly. Edit templates/uns-smart-contracts-template.md instead following rules from README.)
Unstoppable Name Service (UNS) is built on Ethereum and is effectively a bundle of Solidity smart contracts. Their source code is hosted in the UNS 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 UNS works, see UNS Architecture overview.
This page is divided into sections, grouping contracts by the following categories:
This section lists all the smart contracts that users can directly interact with.
Registry is the most essential smart contract in UNS. This is the contract that defines ownership rules, how domains are minted, provides ERC-721 token metadata, and stores a metadata-enriched list of all domains. This is where domain owners store their data, such as cryptocurrency addresses, chat IDs, and IPFS hashes for decentralized websites.
Under the surface, Registry is effectively a map of domain namehashes to key-value dictionaries of records. This structure allows users to store arbitrary records, even those that aren't specified by the Records reference.
Source code: contracts/UnsRegistry.sol
ProxyReader provides an interface that allows users to fetch information about domains from both
UNSRegistry and CNS smart contracts in one call. For more details, see Architecture overview - ProxyReader.
Source code: contracts/ProxyReader.sol
TwitterValidationOperator is used when initiating Chainlink verification requests to link domain records with Twitter usernames.
Source code: contracts/operators/TwitterValidationOperator.sol
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.
MintingManager 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
MintingManager are proxied to the
UNSRegistry via the MintingManager smart contract.
Source code: contracts/MintingManager.sol
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.
IDataReader interface declares the methods that are unique to the
ProxyReader smart contract, which returns combined data from the
Source code: contracts/IDataReader.sol
IMintingManager interface declares a set of methods for minting second level domains.
Source code: contracts/IMintingManager.sol
IRecordReader interface declares read methods for resolution data.
Source code: contracts/IRecordReader.sol
IRecordStorage interface declares write methods for resolution data.
Source code: contracts/IRecordStorage.sol
IRegistryReader interface declares only read-only
Source code: contracts/IRegistryReader.sol
IUNSRegistry interface declares all the
UNSRegistry events and methods (both read and write).
Source code: contracts/IUNSRegistry.sol
ERC677Receiver interface declares an ERC-677 method for receiving smart contracts.
Source code: contracts/util/ERC677Receiver.sol
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.
KeyStorage implements functions for adding and retrieving a set of keys which can be resolved from a domain.
Source code: contracts/KeyStorage.sol
RecordStorage implements functions for adding and retrieving records from a domain.
Source code: contracts/RecordStorage.sol
CapperRole is an extension of Open Zeppelin's
AccessControlUpgradeable that adds operations for adding and removing capper accounts.
Source code: contracts/roles/CapperRole.sol
MinterRole is an extension of Open Zeppelin's
AccessControlUpgradeable that adds operations for adding and removing minting accounts.
Source code: contracts/roles/MinterRole.sol
WhitelistedRole is an extension of Open Zeppelin's
AccessControlUpgradeable that adds operations for adding and removing whitelisted accounts.
Source code: contracts/roles/WhitelistedRole.sol
MultiSend smart contract is used internally by the Unstoppable Domains team to fund worker accounts.
Source code: contracts/util/MultiSend.sol