IENSReverseClaimer
Title: IENSReverseClaimer
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)
External interface for the ENS reverse-claim facet: lets a diamond set and advertise its own
primary ENS name, so resolving the diamond address returns e.g. treasury.myproto.eth.
Wraps the ENS ReverseRegistrar.setName self-claim flow behind an ENS_MANAGER_ROLE-gated
setter. The usual ReverseClaimer constructor base cannot serve a Diamond proxy (which
initializes via InitializableLib, not a constructor), so the claim runs through this facet
instead. The reverse registrar address is configurable per chain — the self-claim setName
used here is supported by both the mainnet ReverseRegistrar and the ENSIP-11
L2ReverseRegistrar (the L2 coin-type / signature-based variants for setting other
addresses' names are out of scope for v1).
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;Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The 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;Parameters
| Name | Type | Description |
|---|---|---|
| reverseRegistrar | address | The 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 returns (string memory);Returns
| Name | Type | Description |
|---|---|---|
| <none> | string | The cached ENS name (empty if never set). |
reverseRegistrar
Returns the currently configured reverse registrar.
function reverseRegistrar() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address | The reverse registrar address. |
Events
EnsNameSet
Emitted when the diamond sets its primary (reverse) ENS name. The diamond is the event emitter, so the reverse node (a deterministic function of the diamond address) is omitted.
event EnsNameSet(string name);Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The ENS name set for the diamond. |
ReverseRegistrarSet
Emitted when the configured reverse registrar is set or rotated.
event ReverseRegistrarSet(address indexed reverseRegistrar);Parameters
| Name | Type | Description |
|---|---|---|
| reverseRegistrar | address | The reverse registrar address now in use. |
Errors
ENSReverseClaimerZeroRegistrar
Thrown when a zero address is supplied as the reverse registrar.
error ENSReverseClaimerZeroRegistrar();