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
.
Mapping of domainHash
to DomainRecord struct to hold information about each domain
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.
Revert if msg.sender
is not the owner or an operator allowed by the owner
Revert if msg.sender
is not the owner. Used for owner restricted functions.
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 !
Checks if a given domain exists
Checks if provided address is an owner or an operator of the provided domain
External function that checks if provided address is an operator for the provided owner.
Set an operator
as allowed
to give or remove permissions for ALL domains owned by the owner msg.sender
. Emits an OperatorPermissionSet
event.
Gets a record for a domain (owner, resolver) from the internal mapping records
. records
maps a domain hash to a DomainRecord struct.
Gets the owner of the given domain
Gets the resolver set for the given domain.
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.
Given a resolver type, returns the address of the resolver contract for that type or 0x0 if not found
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
Delete a resolver type from the mapping of types
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.
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.
Updates the resolver of an existing domain in records
. Can be called by either the owner of the Name or an allowed operator.
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.
Check if a domain exists. True if the owner is not 0x0
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.
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.
To use UUPS proxy we override this function and revert if msg.sender
isn't authorized