๐ŸŒนZNSSubRegistrar

ZNSSubRegistrar.sol - The contract for registering and revoking subdomains of zNS.

This contract has the entry point for registering subdomains, but calls the ZNSRootRegistrar back to finalize registration. Common logic for domains of any level is in the ZNSRootRegistrar.coreRegister().

rootRegistrar

contract IZNSRootRegistrar rootRegistrar

State var for the ZNSRootRegistrar contract that finalizes registration of subdomains.

distrConfigs

mapping(bytes32 => struct IDistributionConfig.DistributionConfig) distrConfigs

Mapping of domainHash to distribution config set by the domain owner/operator. These configs are used to determine how subdomains are distributed for every parent.

Note that the rules outlined in the DistributionConfig are only applied to direct children!

Mintlist

struct Mintlist {
  mapping(uint256 => mapping(address => bool)) list;
  uint256 ownerIndex;
}

mintlist

mapping(bytes32 => struct ZNSSubRegistrar.Mintlist) mintlist

Mapping of domainHash to mintlist set by the domain owner/operator. These configs are used to determine who can register subdomains for every parent in the case where parent's DistributionConfig.AccessType is set to AccessType.MINTLIST.

onlyOwnerOperatorOrRegistrar

modifier onlyOwnerOperatorOrRegistrar(bytes32 domainHash)

constructor

constructor() public

initialize

function initialize(address _accessController, address _registry, address _rootRegistrar) external

registerSubdomain

function registerSubdomain(bytes32 parentHash, string label, address domainAddress, string tokenURI, struct IDistributionConfig.DistributionConfig distrConfig, struct PaymentConfig paymentConfig) external returns (bytes32)

Entry point to register a subdomain under a parent domain specified.

Reads the DistributionConfig for the parent domain to determine how to distribute, checks if the sender is allowed to register, check if subdomain is available, acquires the price and other data needed to finalize the registration and calls the ZNSRootRegistrar.coreRegister() to finalize.

Parameters

hashWithParent

function hashWithParent(bytes32 parentHash, string label) public pure returns (bytes32)

Helper function to hash a child label with a parent domain hash.

setDistributionConfigForDomain

function setDistributionConfigForDomain(bytes32 domainHash, struct IDistributionConfig.DistributionConfig config) public

Setter for distrConfigs[domainHash]. Only domain owner/operator or ZNSRootRegistrar can call this function.

This config can be changed by the domain owner/operator at any time or be set after registration if the config was not provided during the registration. Fires DistributionConfigSet event.

Parameters

setPricerContractForDomain

function setPricerContractForDomain(bytes32 domainHash, contract IZNSPricer pricerContract) public

One of the individual setters for distrConfigs[domainHash]. Sets pricerContract field of the struct. Made to be able to set the pricer contract for a domain without setting the whole config. Only domain owner/operator can call this function. Fires PricerContractSet event.

Parameters

setPaymentTypeForDomain

function setPaymentTypeForDomain(bytes32 domainHash, enum IDistributionConfig.PaymentType paymentType) public

One of the individual setters for distrConfigs[domainHash]. Sets paymentType field of the struct. Made to be able to set the payment type for a domain without setting the whole config. Only domain owner/operator can call this function. Fires PaymentTypeSet event.

Parameters

setAccessTypeForDomain

function setAccessTypeForDomain(bytes32 domainHash, enum IDistributionConfig.AccessType accessType) public

One of the individual setters for distrConfigs[domainHash]. Sets accessType field of the struct. Made to be able to set the access type for a domain without setting the whole config. Only domain owner/operator or ZNSRootRegistrar can call this function. Fires AccessTypeSet event.

Parameters

updateMintlistForDomain

function updateMintlistForDomain(bytes32 domainHash, address[] candidates, bool[] allowed) external

Setter for mintlist[domainHash][candidate]. Only domain owner/operator can call this function. Adds or removes candidates from the mintlist for a domain. Should only be used when the domain's owner wants to limit subdomain registration to a specific set of addresses. Can be used to add/remove multiple candidates at once. Can only be called by the domain owner/operator. Fires MintlistUpdated event.

Parameters

isMintlistedForDomain

function isMintlistedForDomain(bytes32 domainHash, address candidate) external view returns (bool)

clearMintlistForDomain

function clearMintlistForDomain(bytes32 domainHash) public

clearMintlistAndLock

function clearMintlistAndLock(bytes32 domainHash) external

setRegistry

function setRegistry(address registry_) public

Sets the registry address in state.

This function is required for all contracts inheriting ARegistryWired.

setRootRegistrar

function setRootRegistrar(address registrar_) public

Setter for rootRegistrar. Only admin can call this function. Fires RootRegistrarSet event.

Parameters

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal view

To use UUPS proxy we override this function and revert if msg.sender isn't authorized

Parameters