DotnsReverseResolver

Git Source

Inherits: Initializable, UUPSUpgradeable, OwnableUpgradeable, ERC165Upgradeable, IDotnsReverseResolver

Title: Dotns Reverse Resolver

Resolves an address to its associated .dot name.

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(IDotnsProtocolRegistry registry) external initializer;

Parameters

NameTypeDescription
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>.dot.

The caller must currently own the NFT for label per the configured registrar, otherwise @custom: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 .dot) 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.

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;