ENSSubnameIssuerLib
Title: ENSSubnameIssuerLib
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from ENS (https://github.com/ensdomains/ens-contracts)
Library letting a diamond that owns a parent ENS name mint subnames via the ENS NameWrapper.
Three-layer pattern: this library holds the logic and namespaced storage; the stateless
ENSSubnameIssuer facet forwards to it. A thin, role-gated wrapper over the canonical
NameWrapper.setSubnodeRecord — it makes no assumptions about resolver authorization or token
transfer. Setting the new subname's forward addr record is the new owner's job; the child
sets its own reverse record via a future ENS reverse-record module.
Functions
ensSubnameIssuerStorage
function ensSubnameIssuerStorage() internal pure returns (ENSSubnameIssuerStorage storage $);Returns
| Name | Type | Description |
|---|---|---|
| $ | ENSSubnameIssuerStorage |
__ENSSubnameIssuer_init
Initializes the ENSSubnameIssuer module with the NameWrapper to use.
Must be called inside a pre/postInitializer block. Reverts
ENSSubnameIssuerZeroNameWrapper for a zero NameWrapper. Registers IENSSubnameIssuer for ERC-165.
function __ENSSubnameIssuer_init(address _nameWrapper) internal;Parameters
| Name | Type | Description |
|---|---|---|
| _nameWrapper | address | The ENS NameWrapper for this chain. |
registerInterface
Registers support for the IENSSubnameIssuer interface via ERC-165.
function registerInterface() internal;issueSubname
Mints label.<parent> via the NameWrapper, owned by owner with resolver set.
Gated on ENS_SUBNAME_ISSUER_ROLE. The diamond must own/approve parentNode in the
NameWrapper. The library makes no further calls (no addr-record write, no token transfer).
See INameWrapper: verify the deployed setSubnodeRecord selector (0x24c1af44) on your
target chain before mainnet use.
function issueSubname(
bytes32 parentNode,
string calldata label,
address owner,
address resolver,
uint64 ttl,
uint32 fuses,
uint64 expiry
) internal returns (bytes32 node);Parameters
| Name | Type | Description |
|---|---|---|
| parentNode | bytes32 | The parent name's node (wrapped + controlled by this diamond). |
| label | string | The subname label. |
| owner | address | The owner of the new subname. |
| resolver | address | The resolver to set for the new subname. |
| ttl | uint64 | The TTL for the new subname. |
| fuses | uint32 | The fuses to burn on the new subname. |
| expiry | uint64 | The expiry timestamp for the new subname. |
Returns
| Name | Type | Description |
|---|---|---|
| node | bytes32 | The newly created subname's node. |
setNameWrapper
Sets or rotates the NameWrapper.
Gated on ENS_SUBNAME_ISSUER_ROLE. Reverts ENSSubnameIssuerZeroNameWrapper for zero.
function setNameWrapper(address _nameWrapper) internal;Parameters
| Name | Type | Description |
|---|---|---|
| _nameWrapper | address | The NameWrapper to use. |
nameWrapper
Returns the configured NameWrapper.
function nameWrapper() internal view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |