DotnsResolver

Git Source

Inherits: Initializable, UUPSUpgradeable, OwnableUpgradeable, ERC165Upgradeable, IDotnsResolver

Title: Dotns Resolver

Stores forward-resolution address records for DotNS nodes

Writes are gated on node ownership in the forward registry, not on a privileged writer address. Address records describe where a name points and only the current node owner has the authority to set that target.

Note: security-contact: admin@parity.io

State Variables

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

addresses

Node => resolved address.

mapping(bytes32 node => address owner) private addresses

Functions

onlyNodeOwner

Restricts access to the owner of node as recorded in the registry.

modifier onlyNodeOwner(bytes32 node) ;

Parameters

NameTypeDescription
nodebytes32Node identifier.

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor() ;

initialize

Initialises the resolver.

Runs once through the UUPS 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.

setAddress

Sets the resolved address for a node.

The caller must be the current owner of node in the forward registry, otherwise

Note: reverts: NotAuthorised. Emits @custom:emits AddressSet on every successful write.

function setAddress(bytes32 node, address value) external override onlyNodeOwner(node);

Parameters

NameTypeDescription
nodebytes32The node identifier.
valueaddressThe address to associate with the node.

addressOf

Returns the resolved address for a node.

function addressOf(bytes32 node) external view override returns (address value);

Parameters

NameTypeDescription
nodebytes32The node identifier.

Returns

NameTypeDescription
valueaddressThe resolved address, or zero if unset.

supportsInterface

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

_onlyNodeOwner

Internal ownership check for a registry node.

Resolves the registry lazily through protocolRegistry so a registry upgrade or rewire is picked up automatically without a resolver upgrade.

function _onlyNodeOwner(bytes32 node) internal view;

Parameters

NameTypeDescription
nodebytes32Node identifier.

version

Returns the release this network declares it runs, read live from the protocol registry so every DotNS contract reports one synchronised value.

Mirror of IDotnsProtocolRegistry.protocolVersion, kept under the historical version() selector for ABI compatibility. It reports the network's declaration, not this contract's build; per-contract identity is the codehash declared on the registry.

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

Returns

NameTypeDescription
versionStringstringDeclared release as bare semver, empty when never declared.

_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;