ENSResolver
Inherits: IENSResolver
Title: ENSResolver
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from ENS (https://github.com/ensdomains/ens-contracts), Conforms to ENS forward resolution (EIP-137)
Stateless Diamond facet for on-chain ENS forward resolution: resolves an ENS node to its address via the configured ENS registry.
All logic lives in ENSResolverLib. The ENS registry is supplied at init and rotated per chain
via setEnsRegistry (gated on ENS_MANAGER_ROLE, managed through the diamond's AccessControl).
Notes:
- lattice-version: 0.1.0
- lattice-source: Lattice original
Functions
resolve
Resolves an ENS node to its address (forward resolution).
Reads registry.resolver(node) then resolver.addr(node). Returns zero ONLY when node
has no resolver configured; MAY revert if a configured resolver does not implement
addr(bytes32) or itself reverts. The resolved address is set by the node's owner (a third
party), so treat it as untrusted; use resolverOf to distinguish "no resolver" from "zero".
function resolve(bytes32 node) external view virtual returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| node | bytes32 | The ENS node (namehash) to resolve. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address | The resolved address (zero if no resolver is set). |
resolverOf
Returns the resolver configured for node in the ENS registry.
function resolverOf(bytes32 node) external view virtual returns (address);Parameters
| Name | Type | Description |
|---|---|---|
| node | bytes32 | The ENS node (namehash) to query. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | address | The resolver address (zero if unset). |
ensRegistry
Returns the configured ENS registry.
function ensRegistry() external view virtual returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
setEnsRegistry
Sets or rotates the ENS registry (per-chain configuration).
Gated on ENS_MANAGER_ROLE. Reverts ENSResolverZeroRegistry for a zero address.
function setEnsRegistry(address ensRegistry_) external virtual;Parameters
| Name | Type | Description |
|---|---|---|
| ensRegistry_ | address | The ENS registry to use. |
subnode
Computes the namehash of label.<parent> from the parent node and label.
One ENS namehash recursion step: keccak256(parentNode ++ keccak256(label)).
function subnode(bytes32 parentNode, string calldata label) external pure virtual returns (bytes32);Parameters
| Name | Type | Description |
|---|---|---|
| parentNode | bytes32 | The parent name's node. |
| label | string | The subname label. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 | The child node (namehash). |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect ENSResolver methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. Chunks:
ensRegistry() 0x7d73b231
resolve(bytes32) 0x5c23bdf5
resolverOf(bytes32) 0xc677966d
setEnsRegistry(address) 0xe7c65687
subnode(bytes32,string) 0x568f0953
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |