DotnsProtocolRegistry
Inherits: Initializable, UUPSUpgradeable, OwnableUpgradeable, IDotnsProtocolRegistry
Title: Dotns Protocol Registry
Author: Parity
Upgradeable address registry for all DotNS protocol contracts.
Single source of truth for sibling-contract lookups. All siblings resolve each other via
well-known bytes32 constants in DotnsConstants rather than holding direct addresses,
so an upgrade or rewire only mutates this contract.
Note: security-contact: admin@parity.io
State Variables
_addresses
Address stored for each well-known protocol key.
mapping(bytes32 key => address addr) private _addresses
_registeredRefcount
Reference count per address, incremented for every key it is registered under.
Lets isRegisteredAddress answer in O(1) and survive a contract being mapped to
multiple keys without being treated as deregistered when only one key is rewired.
mapping(address addr => uint256 refcount) private _registeredRefcount
__gap
uint256[50] private __gap
Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
constructor() ;
initialize
Initialises the protocol registry.
Callable exactly once via Initializable, otherwise
Note: reverts: InvalidInitialization. Sets the deployer as owner.
function initialize() external initializer;
get
Returns the address stored for a given key.
Returns address(0) when the key is unset; callers must validate when non-zero is
required.
function get(bytes32 key) external view override returns (address addr);
set
Sets or updates the address for a given key.
Owner-restricted, otherwise @custom:reverts OwnableUnauthorizedAccount. addr
must be non-zero, otherwise @custom:reverts ZeroAddress. Idempotent when the new
value matches the stored one (no event emitted in that case). Maintains a
per-address refcount so the same contract can occupy multiple keys without losing
its registered status until every key is rewired. Emits
Note: emits: AddressUpdated on each effective change.
function set(bytes32 key, address addr) external override onlyOwner;
isRegisteredAddress
Returns true iff addr is currently registered under at least one well-known key.
O(1) refcount-backed lookup. Canonical peer-trust check consumed by LabelStore
writes and StoreFactory deploys; only addresses governance has actively
registered return true. Treats address(0) as never registered regardless of
refcount.
function isRegisteredAddress(address addr) external view override returns (bool registered);
version
Returns implementation version.
function version() external pure virtual returns (string memory versionString);
Returns
| Name | Type | Description |
|---|---|---|
versionString | string | Current 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;