DotnsReverseResolver

Git Source

Inherits: Initializable, UUPSUpgradeable, OwnableUpgradeable, ERC165Upgradeable, IDotnsReverseResolver

Title: Dotns Reverse Resolver

Resolves an address to its associated name under the network TLD.

Writes are gated on a fixed writer address resolved from the protocol registry (the registrar or its controller), not on node ownership. Reverse records bind to an EOA rather than a registry node, so authority is delegated to the contract that mints names on the user's behalf.

Note: security-contact: admin@parity.io

State Variables

reverseNames

Mapping from address to its reverse name. An empty string indicates that no reverse name is set.

mapping(address owner => string name) private reverseNames

protocolRegistry

Protocol-level address registry for all DotNS contracts.

IDotnsProtocolRegistry public protocolRegistry

__gap

Reserved storage space to allow for layout changes in the future.

uint256[50] private __gap

Functions

onlyRegistrar

Restricts access to the configured registrar.

modifier onlyRegistrar() ;

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor() ;

initialize

Initialises the reverse resolver.

May only be called once per proxy; a repeat call reverts with

Note: reverts: InvalidInitialization. Emits @custom:emits OwnershipTransferred when msg.sender is recorded as the initial owner and @custom:emits Initialized once setup completes.

function initialize(
    address initialOwner,
    IDotnsProtocolRegistry registry
)
    external
    initializer;

Parameters

NameTypeDescription
initialOwneraddressAddress that owns the contract once initialised.
registryIDotnsProtocolRegistryProtocol-level address registry used to resolve sibling contracts.

setReverseName

Associates an address with a reverse name record.

Callable only by the configured registrar or its controller, otherwise

Note: reverts: NotRegistrarController. Overwrites any existing reverse record for addr and emits @custom:emits ReverseNameSet on every successful write.

function setReverseName(address addr, string calldata name) external override onlyRegistrar;

Parameters

NameTypeDescription
addraddressThe address for which the reverse name is being set.
namestringThe human-readable name associated with the address.

claimReverseRecord

Self-service claim: associates msg.sender with <label> under the network TLD.

The caller must currently own label, read through the registry, which delegates a tokenised name to the registrar and holds a lite subname directly, otherwise

Note: reverts: NotNameOwner. Overwrites any existing record for the caller and emits @custom:emits ReverseNameSet on every successful write. Transferring the name away does not eagerly clear the record; @custom:function nameOf fails closed at read time when the stored record no longer matches current ownership.

function claimReverseRecord(string calldata label) external override;

Parameters

NameTypeDescription
labelstringThe label (without the TLD suffix) the caller is claiming a reverse record for.

nameOf

Returns the reverse name for an address, fail-closed against current ownership.

Returns the empty string when no record is set, when the record is malformed, or when the address no longer owns the name pointed to by the stored record.

function nameOf(address addr) external view override returns (string memory name);

Parameters

NameTypeDescription
addraddressThe address to query.

Returns

NameTypeDescription
namestringThe reverse name associated with addr, or the empty string.

_nodeOf

Resolves the node a name maps to, whether tokenised or a lite subname.

A lite name is stem beneath its numeric container, so it hashes as a subnode; any other name hashes as a second-level label under the TLD. Ownership of either is read through the registry, which delegates a tokenised name to the registrar and holds a subname directly.

function _nodeOf(string memory label) internal view returns (bytes32 node);

Parameters

NameTypeDescription
labelstringBare label without the TLD, e.g. alice or alice.01.

Returns

NameTypeDescription
nodebytes32The node the name resolves to.

_registry

Resolves the registry via the protocol registry.

function _registry() internal view returns (IDotnsRegistry);

supportsInterface

function supportsInterface(bytes4 interfaceId)
    public
    view
    override(ERC165Upgradeable)
    returns (bool supported);

_onlyRegistrar

Internal check enforcing registrar-only access.

function _onlyRegistrar() internal view;

version

Returns implementation version.

function version() external pure virtual returns (string memory versionString);

Returns

NameTypeDescription
versionStringstringCurrent version string.

_authorizeUpgrade

Function that should revert when msg.sender is not authorized to upgrade the contract. Called by {upgradeToAndCall}. Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.

function _authorizeUpgrade(address) internal onlyOwner {}
function _authorizeUpgrade(address newImplementation) internal override onlyOwner;