Wrapping Functions
wrapETH2LD()
State Transition: Unwrapped → Emancipated | Locked Wraps a .eth second-level name. The wrapped name’s expiration will always be equal to the name’s expiration in the .eth registrar plus the grace period (90 days).Label as a string of the .eth domain to wrap (e.g., ‘vitalik’ for ‘vitalik.eth’)
Owner of the name in this contract
Initial owner-controlled fuses to set
Resolver contract address
wrap()
State Transition: Unwrapped → Wrapped | Emancipated Wraps any name other than a .eth second-level name.The name to wrap, in DNS format
Owner of the name in this contract
Resolver contract
onERC721Received()
State Transition: Unwrapped → Emancipated | Locked Wraps a .eth second-level name by sending the ERC721 NFT to the wrapper contract. Transfers must contain additional data encoding information about the wrapped name such as fuses and expiration, or they will be rejected. Otherwise behaves identically towrapETH2LD.
registerAndWrapETH2LD()
State Transition: Unregistered → Emancipated | Locked Allows a registrar controller to register and wrap a name in a single operation.The label to register (e.g., ‘foo’ for ‘foo.eth’)
The owner of the wrapped name
The duration, in seconds, to register the name for
The resolver address to set on the ENS registry (optional)
Initial owner-controlled fuses to set
wrapETH2LD.
Unwrapping Functions
unwrapETH2LD()
State Transition: Emancipated → Unwrapped Unwraps a .eth second-level name, provided that the name is not Locked.Labelhash of the .eth domain
Sets the owner in the .eth registrar to this address
Sets the owner in the registry to this address
unwrap()
State Transition: Wrapped | Emancipated → Unwrapped Unwraps any name other than a .eth second-level name, provided that the name is not Locked.Parent namehash of the name (e.g., vitalik.xyz would be namehash(‘xyz’))
Labelhash of the name (e.g., vitalik.xyz would be keccak256(‘vitalik’))
Sets the owner in the registry to this address
wrap() is called on it.
Fuse Management Functions
setFuses()
State Transition: Emancipated | Locked → Locked Sets fuses of a name.Namehash of the name
Owner-controlled fuses to burn
setChildFuses()
State Transition: Wrapped → Emancipated | Locked Sets fuses of a name that you own the parent of.Parent namehash of the name (e.g., vitalik.xyz would be namehash(‘xyz’))
Labelhash of the name (e.g., vitalik.xyz would be keccak256(‘vitalik’))
Fuses to burn
When the name will expire in seconds since the Unix epoch
Expiry Management Functions
extendExpiry()
State Transition: Wrapped | Emancipated | Locked → Wrapped | Emancipated | Locked Extends expiry for a name.Parent namehash of the name (e.g., vitalik.xyz would be namehash(‘xyz’))
Labelhash of the name (e.g., vitalik.xyz would be keccak256(‘vitalik’))
When the name will expire in seconds since the Unix epoch
renew()
State Transition: Emancipated | Locked → Emancipated | Locked Allows a registrar controller to renew a .eth second-level name.The hash of the label to register (e.g.,
keccak256('foo'), for ‘foo.eth’)The number of seconds to renew the name for
Subdomain Management Functions
setSubnodeOwner()
State Transition: Unregistered | Unwrapped | Wrapped → Unregistered | Wrapped | Emancipated | Locked Creates, replaces, or deletes a subname.Parent namehash of the subdomain
Label of the subdomain as a string
New owner in the wrapper
Initial fuses for the wrapped subdomain
When the name will expire in seconds since the Unix epoch
- When called with a subname that does not yet exist, creates the name and wraps it.
- When called with a subname that already exists, transfers the name to a new owner, wrapping it if necessary, provided the name is not Emancipated or Locked.
- When called with a subname that exists and a new owner value of
address(0), unwraps and deletes the name.
setSubnodeRecord()
State Transition: Unregistered | Unwrapped | Wrapped → Wrapped | Emancipated | Locked Creates or replaces a subname while updating resolver and TTL records.Parent namehash of the subdomain
Label of the subdomain as a string
New owner in the wrapper
Resolver contract in the registry
TTL in the registry
Initial fuses for the wrapped subdomain
When the name will expire in seconds since the Unix epoch
setSubnodeOwner(), additionally setting the resolver and TTL for the subname. If the new owner is address(0), resolver and TTL are ignored.
Record Setting Functions
setRecord()
State Transition: Wrapped | Emancipated | Locked → Unregistered | Wrapped | Emancipated | Locked Mirrors the existing registry functionality, allowing you to set owner, resolver and ttl at the same time.Namehash of the name to set a record for
New owner in the registry
Resolver contract
Time to live in the registry
setResolver()
State Transition: Wrapped | Emancipated | Locked → Wrapped | Emancipated | Locked Sets resolver contract in the registry.Namehash of the name
The resolver contract
setTTL()
State Transition: Wrapped | Emancipated | Locked → Wrapped | Emancipated | Locked Sets TTL in the registry.Namehash of the name
TTL in the registry
Query Functions
getData()
Gets the data for a name.Namehash of the name
owner(address): Owner of the namefuses(uint32): Fuses of the nameexpiry(uint64): Expiry of the name
uint32 and you will have to decode this yourself. If you just need to check a fuse has been burned, you can call allFusesBurned as it will use less gas.
ownerOf()
Gets the owner of a name.Namehash of the name
owner(address): The owner of the name
address(0) when calling ownerOf.
allFusesBurned()
Checks all fuses in the mask are burned for the node.Namehash of the name
The fuses you want to check
bool: Whether or not all the selected fuses are burned
isWrapped()
Checks if a name is wrapped.Namehash of the name
bool: Whether or not the name is wrapped
Parent namehash of the name
Labelhash of the name
canModifyName()
Checks if the address is the owner or operator of the owner.Namehash of the name to check
Which address to check permissions for
bool: Whether or not is owner or operator
canExtendSubnames()
Checks if the address is owner/operator or approved by owner.Namehash of the name to check
Which address to check permissions for
bool: Whether or not is owner/operator or approved
Upgrade Functions
upgrade()
Upgrades a domain of any kind. Could be a .eth name vitalik.eth, a DNSSEC name vitalik.xyz, or a subdomain.The name to upgrade, in DNS format
Extra data to pass to the upgrade contract
setUpgradeContract()
Sets the address of the upgradeContract of the contract.Address of an upgraded contract
Administrative Functions
setMetadataService()
Sets the metadata service.The new metadata service