Skip to content
Lattice

ENSReverseClaimer

Git Source

Inherits: IENSReverseClaimer

Title: ENSReverseClaimer

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from ENS (https://github.com/ensdomains/ens-contracts), Conforms to ENS reverse resolution (https://docs.ens.domains/learn/protocol#reverse-resolution)

Stateless Diamond facet letting a diamond claim and advertise its own primary ENS name via ENS reverse resolution. Inherit this in your Diamond to make the contract resolve to e.g. treasury.myproto.eth in explorers and wallets.

All logic lives in ENSReverseClaimerLib. Identity changes are gated on ENS_MANAGER_ROLE (managed through the diamond's AccessControl module). The registrar is supplied at init and can be rotated per chain via setReverseRegistrar.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: Lattice original

Functions

setEnsName

Sets the diamond's primary ENS name via the configured reverse registrar.

Gated on ENS_MANAGER_ROLE. Calls IReverseRegistrar.setName(name) with the diamond as msg.sender, so the diamond's addr.reverse record resolves to name. Passing an empty string clears the reverse record, matching canonical ReverseRegistrar semantics.

function setEnsName(string calldata name) external virtual;

Parameters

NameTypeDescription
namestringThe ENS name to set as the diamond's primary name.

setReverseRegistrar

Sets or rotates the reverse registrar (e.g. per-chain configuration).

Gated on ENS_MANAGER_ROLE. Reverts ENSReverseClaimerZeroRegistrar for a zero address.

function setReverseRegistrar(address reverseRegistrar) external virtual;

Parameters

NameTypeDescription
reverseRegistraraddressThe reverse registrar to use.

ensName

Returns the diamond's last ENS name set through this facet.

Convenience cache only: it reflects the last name set THROUGH THIS FACET and may not equal the live ENS reverse record, which can be changed directly at the resolver or made stale by registrar rotation (setReverseRegistrar) or a registrar resolver change. Off-chain consumers should resolve the live ENS reverse record rather than trust this value.

function ensName() external view virtual returns (string memory);

Returns

NameTypeDescription
<none>stringThe cached ENS name (empty if never set).

reverseRegistrar

Returns the currently configured reverse registrar.

function reverseRegistrar() external view virtual returns (address);

Returns

NameTypeDescription
<none>addressThe reverse registrar address.

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 ENSReverseClaimer methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: ensName() 0x8ef71b8d reverseRegistrar() 0x80869853 setEnsName(string) 0xdf0487bc setReverseRegistrar(address) 0x557499ba

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes