πZNSRegistry
ZNSRegistry
The main reference data contract in ZNS. Also, often, the last contract in the call chain of many operations where the most crucial Name/Hash/True owner data settles. Owner of a domain in this contract also serves as the owner of the stake in ZNSTreasury.
resolvers
mapping(string => address) resolversrecords
mapping(bytes32 => struct IZNSRegistry.DomainRecord) recordsMapping of domainHash to DomainRecord struct to hold information about each domain
operators
mapping(address => mapping(address => bool)) operatorsMapping of owner => operator => bool to show accounts that are or aren't allowed access to domains that owner has access to. Note that operators can NOT change the owner of the domain, but can change the resolver or resolver records.
onlyOwnerOrOperator
modifier onlyOwnerOrOperator(bytes32 domainHash)Revert if msg.sender is not the owner or an operator allowed by the owner
Parameters
domainHash
bytes32
the hash of a domain's name
onlyOwner
Revert if msg.sender is not the owner. Used for owner restricted functions.
Parameters
domainHash
bytes32
the hash of a domain's name
constructor
initialize
Initializer for the ZNSRegistry proxy.
! The owner of the 0x0 hash should be a multisig ideally, but EOA can be used to deploy !
Admin account deploying the contract will be the owner of the 0x0 hash !
Parameters
accessController_
address
The address of the ZNSAccessController contract
exists
Checks if a given domain exists
Parameters
domainHash
bytes32
The hash of a domain's name
isOwnerOrOperator
Checks if provided address is an owner or an operator of the provided domain
Parameters
domainHash
bytes32
The hash of a domain's name
candidate
address
The address for which we are checking access
isOperatorFor
External function that checks if provided address is an operator for the provided owner.
Parameters
operator
address
The address for which we are checking access
owner
address
The owner of the domain(-s) in question
setOwnersOperator
Set an operator as allowed to give or remove permissions for ALL domains owned by the owner msg.sender. Emits an OperatorPermissionSet event.
Parameters
operator
address
The account to allow/disallow
allowed
bool
The true/false value to set
getDomainRecord
Gets a record for a domain (owner, resolver) from the internal mapping records. records maps a domain hash to a DomainRecord struct.
Parameters
domainHash
bytes32
the hash of a domain's name
getDomainOwner
Gets the owner of the given domain
Parameters
domainHash
bytes32
the hash of a domain's name
getDomainResolver
Gets the resolver set for the given domain.
Parameters
domainHash
bytes32
the hash of a domain's name
createDomainRecord
Creates a new domain record. Only callable by the ZNSRootRegistrar.sol or an address that has REGISTRAR_ROLE. This is one of the last calls in the Register flow that starts from ZNSRootRegistrar.registerRootDomain(). Calls 2 internal functions to set the owner and resolver of the domain separately. Can be called with resolver param as 0, which will exclude the call to set resolver. Emits DomainOwnerSet and possibly DomainResolverSet events.
Parameters
domainHash
bytes32
The hash of the domain name
owner
address
The owner of the new domain
resolverType
string
The string identifier of the resolver for the new domain, e.g. "address"
getResolverType
Given a resolver type, returns the address of the resolver contract for that type or 0x0 if not found
Parameters
resolverType
string
The resolver type as a string, e.g. "address"
addResolverType
Add a new resolver type option to the mapping of types This function can also be used to update the resolver mapping for an existing resolver simple by using an existing key like "address" with a new address
Parameters
resolverType
string
The type of the resolver to add
resolver
address
The address of the new resolver contract
deleteResolverType
Delete a resolver type from the mapping of types
Parameters
resolverType
string
The type to be removed
updateDomainRecord
Updates an existing domain record's owner and resolver. Note that this function can ONLY be called by the Name owner of the domain. This is NOT used by the ZNSRootRegistrar contract and serves as a user facing function for the owners of existing domains to change their data on this contract. A domain operator can NOT call this, since he is not allowed to change the owner. Emits DomainOwnerSet and DomainResolverSet events.
Parameters
domainHash
bytes32
The hash of the domain
owner
address
The owner or an allowed operator of that domain
resolverType
string
The resolver for the domain
updateDomainOwner
Updates the owner of an existing domain. Can be called by either the Name owner on this contract OR the DomainToken contract as part of the transfer flow that starts at DomainToken.transferFrom() (Domain Token can NOT be transferred without transferring the domain hash owner)! Emits an DomainOwnerSet event.
Parameters
domainHash
bytes32
the hash of a domain's name
owner
address
The account to transfer ownership to
updateDomainResolver
Updates the resolver of an existing domain in records. Can be called by either the owner of the Name or an allowed operator.
Parameters
domainHash
bytes32
the hash of a domain's name
resolverType
string
The new Resolver contract address
deleteRecord
Deletes a domain's record from this contract's state. This can ONLY be called by the ZNSRootRegistrar.sol contract as part of the Revoke flow or any address holding the REGISTRAR_ROLE. Emits a DomainRecordDeleted event.
Parameters
domainHash
bytes32
The hash of the domain name
_exists
Check if a domain exists. True if the owner is not 0x0
Parameters
domainHash
bytes32
the hash of a domain's name
_setDomainOwner
Internal function to set a domain's owner in state records. Owner can NOT be set to 0, since we use delete operation as part of the deleteRecord() function. Emits a DomainOwnerSet event.
Parameters
domainHash
bytes32
the hash of a domain's name
owner
address
The owner to set
_setDomainResolver
Internal function to set a domain's resolver in state records. Resolver can be set to 0, since we allow partial domain data. Emits a DomainResolverSet event.
Parameters
domainHash
bytes32
the hash of a domain's name
resolverType
string
The resolver to set
_authorizeUpgrade
To use UUPS proxy we override this function and revert if msg.sender isn't authorized
Last updated