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()
.
State var for the ZNSRootRegistrar contract that finalizes registration of subdomains.
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!
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.
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.
Helper function to hash a child label with a parent domain hash.
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.
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.
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.
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.
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.
Sets the registry address in state.
This function is required for all contracts inheriting ARegistryWired
.
Setter for rootRegistrar
. Only admin can call this function. Fires RootRegistrarSet
event.
To use UUPS proxy we override this function and revert if msg.sender
isn't authorized
parentHash
bytes32
The hash of the parent domain to register the subdomain under
label
string
The label of the subdomain to register (e.g. in 0://zero.child the label would be "child").
domainAddress
address
(optional) The address to which the subdomain will be resolved to
tokenURI
string
(required) The tokenURI for the subdomain to be registered
distrConfig
struct IDistributionConfig.DistributionConfig
(optional) The distribution config to be set for the subdomain to set rules for children
paymentConfig
struct PaymentConfig
(optional) Payment config for the domain to set on ZNSTreasury in the same tx > paymentConfig
has to be fully filled or all zeros. It is optional as a whole, but all the parameters inside are required.
domainHash
bytes32
The domain hash to set the distribution config for
config
struct IDistributionConfig.DistributionConfig
The new distribution config to set (for config fields see IDistributionConfig.sol
)
domainHash
bytes32
The domain hash to set the pricer contract for
pricerContract
contract IZNSPricer
The new pricer contract to set
domainHash
bytes32
The domain hash to set the payment type for
paymentType
enum IDistributionConfig.PaymentType
The new payment type to set
domainHash
bytes32
The domain hash to set the access type for
accessType
enum IDistributionConfig.AccessType
The new access type to set
domainHash
bytes32
The domain hash to set the mintlist for
candidates
address[]
The array of candidates to add/remove
allowed
bool[]
The array of booleans indicating whether to add or remove the candidate
registrar_
address
The new address of the ZNSRootRegistrar contract
newImplementation
address
The implementation contract to upgrade to