๐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 owner data settles. Owner of a domain in this contract also serves as the owner of the stake in ZNSTreasury
.
resolvers
records
Mapping of domainHash
to DomainRecord struct to hold information about each domain
operators
Mapping 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
Revert if msg.sender
is not the owner or an operator allowed by the owner
Parameters
onlyOwner
Revert if msg.sender
is not the owner. Used for owner restricted functions.
Parameters
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
exists
Checks if a given domain exists
Parameters
isOwnerOrOperator
Checks if provided address is an owner or an operator of the provided domain
Parameters
isOperatorFor
External function that checks if provided address is an operator for the provided owner.
Parameters
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
getDomainRecord
Gets a record for a domain (owner, resolver) from the internal mapping records
. records
maps a domain hash to a DomainRecord struct.
Parameters
getDomainOwner
Gets the owner of the given domain
Parameters
getDomainResolver
Gets the resolver set for the given domain.
Parameters
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
getResolverType
Given a resolver type, returns the address of the resolver contract for that type or 0x0 if not found
Parameters
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
deleteResolverType
Delete a resolver type from the mapping of types
Parameters
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.sol
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
updateDomainOwner
Updates the owner of an existing domain. Can be called by either the Name owner on this contract OR the ZNSRootRegistrar.sol
contract as part of the Reclaim flow that starts at ZNSRootRegistrar.sol.reclaim()
. Emits an DomainOwnerSet
event.
Parameters
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
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
_exists
Check if a domain exists. True if the owner is not 0x0
Parameters
_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
_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
_authorizeUpgrade
To use UUPS proxy we override this function and revert if msg.sender
isn't authorized