IDotnsNameWhitelist
Title: IDotnsNameWhitelist
Interface for the pre-launch name whitelist. A name is Open until governance either reserves it or a claim is accepted for it. Several beneficiaries may claim the same Open name, each with a reason, and governance accepts one as the winner.
Callers never supply a hash. Every entry point takes the bare label and derives the node
from the label and the TLD in the protocol registry, so a caller cannot supply a
mismatched hash. Claims are keyed by the beneficiary user, not the submitter, so a
relayer or a cross-chain sovereign account can submit a claim on a user's behalf and the
name still binds to that user. All state is on-chain and queryable through views; no event
indexing is required. Grants, revocations, acceptances, rejections and reservations are
substrate Root only: those gates check callerIsRoot and read no msg.sender, and no
signed account can make them. The request window and the caps are also open to the
maintainer account, within the rules each setter enforces. The controllers hold only
the consume hook.
Note: security-contact: admin@parity.io
Functions
requestName
Claims label for user.
Permissionless within the window; the submitter may differ from user. Requires the
name Open, the window open, user non-zero, a canonical label of at least three
bytes, user without an existing claim, and fewer than maxClaimants claims on the
name.
Notes:
-
reverts: WindowClosed, @custom:reverts NameNotOpen, @custom:reverts ZeroUser,
-
reverts: InvalidLabel, @custom:reverts ReasonTooLong,
-
reverts: AlreadyClaimed, or @custom:reverts TooManyClaimants.
-
emits: NameRequested.
function requestName(string calldata label, string calldata reason, address user) external;
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to claim. |
reason | string | Free-text justification, at most maxReasonBytes bytes. |
user | address | Beneficiary the name binds to if this claim wins. |
withdrawClaim
Withdraws the caller's pending claim on label.
The caller is the beneficiary, whoever filed the claim, so a claim filed in their name never blocks their own request. Deletes the claim and frees its slot.
Notes:
-
reverts: NotRequested when the caller holds no pending claim on the name.
-
emits: ClaimWithdrawn.
function withdrawClaim(string calldata label) external;
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label the claim is on. |
accept
Accepts user's claim as the winner of label.
Restricted to a substrate Root dispatch. Requires user's claim Requested.
Sets the name Claimed with user the winner and clears every claim on the name.
Notes:
-
reverts: NotRequested. @custom:emits NameAccepted for the winner and
-
emits: ClaimsCleared for the round.
function accept(string calldata label, address user) external;
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to resolve. |
user | address | Beneficiary whose claim wins. |
reject
Rejects user's pending claim on label without resolving the name.
Restricted to a substrate Root dispatch. Requires the claim Requested.
Note: reverts: NotRequested. @custom:emits NameRejected.
function reject(string calldata label, address user) external;
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label. |
user | address | Beneficiary whose claim is rejected. |
grantName
Grants label to user directly, without a prior claim.
Restricted to a substrate Root dispatch. Requires the name Open, which an expired
grant is, user non-zero and a canonical label of at least three bytes. Sets the name
Claimed with user the winner, starts the grant period, and clears any pending
claims. @custom:reverts NameNotOpen, @custom:reverts ZeroUser or
Notes:
-
reverts: InvalidLabel. @custom:emits NameAccepted, and
-
emits: ClaimsCleared when the name held claims.
function grantName(string calldata label, address user) external;
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to grant. |
user | address | Beneficiary the name binds to. |
grantNames
Grants several labels to one user directly.
Restricted to a substrate Root dispatch. Applies @custom:function grantName to
each, at most maxGrantBatch labels per call.
Note:
reverts: TooManyLabels when labels exceeds the batch cap.
function grantNames(string[] calldata labels, address user) external;
Parameters
| Name | Type | Description |
|---|---|---|
labels | string[] | Bare labels to grant. |
user | address | Beneficiary each name binds to. |
revokeName
Resets label to Open, clearing any winner and claims.
Restricted to a substrate Root dispatch. Resolves a Claimed or claim-holding name, an expired grant included, so governance can tidy a lapsed entry from the active set; a Reserved name is released through @custom:function setReserved, not here.
Notes:
-
reverts: NothingToRevoke when the name is not Claimed and holds no claims.
-
emits: NameRevoked, and @custom:emits ClaimsCleared when the name held claims.
function revokeName(string calldata label) external;
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to reset. |
setReserved
Reserves or releases label.
Restricted to a substrate Root dispatch. Reserving requires the name Open and clears
any pending claims; releasing requires it Reserved. @custom:reverts
NameNotOpen or @custom:reverts NotReserved. @custom:emits NameReserved or @custom:emits
NameUnreserved. @param label Bare label.
function setReserved(string calldata label, bool reserved) external;
Parameters
| Name | Type | Description |
|---|---|---|
label | string | |
reserved | bool | True to reserve, false to release. |
consume
Removes the win on label as registrant registers it.
Restricted to the registrar controllers resolved through the protocol registry. Resets the name to Open. @custom:reverts NotController for any other caller and
Notes:
-
reverts: NotWinner when
labelis not won byregistrantor the grant has expired. -
emits: NameConsumed.
function consume(string calldata label, address registrant) external;
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label being registered. |
registrant | address | Address registering the name. |
setWindow
Sets the request window relative to the current time.
Root or the maintainer account, otherwise @custom:reverts NotRootOrMaintainer. Opens at
block.timestamp + startsIn for duration; @custom:reverts BadWindow when duration is
zero. Root sets any window. The maintainer only lengthens a window that is open or
scheduled: it passes startsIn zero, the window keeps its opening and duration counts
from it. With no window open or scheduled, a non-zero startsIn, or a window that would
close earlier, the call @custom:reverts MaintainerNotAllowed; a window longer than
WHITELIST_MAINTAINER_MAX_WINDOW from its opening @custom:reverts
MaintainerWindowOutOfBounds. @custom:emits WindowSet.
function setWindow(uint64 startsIn, uint64 duration) external;
Parameters
| Name | Type | Description |
|---|---|---|
startsIn | uint64 | Seconds from now until requests start being accepted. |
duration | uint64 | Seconds the window stays open. |
setMaxClaimants
Sets the live-claim cap per name.
Root or the maintainer account, otherwise @custom:reverts NotRootOrMaintainer. While a window is open or scheduled, the maintainer can only raise it, otherwise
Notes:
-
reverts: MaintainerNotAllowed. The cap is bounded by
DotnsConstants.WHITELIST_MAX_CLAIMANTS_LIMIT, which bounds the claims governance reviews per name. The cap only stops new requests: a name that collected more claims under a higher cap keeps them. Resolving a name ends its round of claims in one write, so no cap bounds the cost of a grant. -
reverts: MaxClaimantsOutOfRange when
newMaxis zero or above the ceiling. -
emits: MaxClaimantsSet.
function setMaxClaimants(uint16 newMax) external;
Parameters
| Name | Type | Description |
|---|---|---|
newMax | uint16 | New per-name claim cap. |
setMaxReasonBytes
Sets the reason byte cap.
Root or the maintainer account, otherwise @custom:reverts NotRootOrMaintainer. While a window is open or scheduled, the maintainer can only raise it, otherwise
Notes:
-
reverts: MaintainerNotAllowed. Bounded by
DotnsConstants.WHITELIST_MAX_REASON_LIMIT; @custom:reverts MaxReasonBytesOutOfRange whennewMaxis zero or above the ceiling. -
emits: MaxReasonBytesSet.
function setMaxReasonBytes(uint256 newMax) external;
Parameters
| Name | Type | Description |
|---|---|---|
newMax | uint256 | New reason byte cap. |
setMaxGrantBatch
Sets the cap on labels per grantNames call.
Root or the maintainer account, otherwise @custom:reverts NotRootOrMaintainer. The cap limits Root's own grant batches, so the maintainer can only raise it, otherwise
Note:
reverts: MaintainerNotAllowed. Bounded by
DotnsConstants.WHITELIST_MAX_GRANT_BATCH_LIMIT. @custom:reverts MaxGrantBatchOutOfRange
when newMax is zero or above the ceiling. @custom:emits MaxGrantBatchSet.
function setMaxGrantBatch(uint16 newMax) external;
Parameters
| Name | Type | Description |
|---|---|---|
newMax | uint16 | New batch cap. |
setGrantDuration
Sets the period a grant binds its name.
Root or the maintainer account, otherwise @custom:reverts NotRootOrMaintainer. The
period applies to grants made after the call, and a live grant keeps the expiry it was
given. A shorter period would still cut the grants a pending referendum makes, so the
maintainer can only raise it, otherwise @custom:reverts MaintainerNotAllowed. Bounded by
DotnsConstants.WHITELIST_MIN_GRANT_DURATION and
DotnsConstants.WHITELIST_MAX_GRANT_DURATION.
Notes:
-
reverts: GrantDurationOutOfRange when
newDurationis out of range. -
emits: GrantDurationSet.
function setGrantDuration(uint64 newDuration) external;
Parameters
| Name | Type | Description |
|---|---|---|
newDuration | uint64 | New grant period, in seconds. |
maxClaimants
Returns the live-claim cap per name.
function maxClaimants() external view returns (uint16 cap);
Returns
| Name | Type | Description |
|---|---|---|
cap | uint16 | Current per-name claim cap. |
maxReasonBytes
Returns the reason byte cap.
function maxReasonBytes() external view returns (uint256 cap);
Returns
| Name | Type | Description |
|---|---|---|
cap | uint256 | Current reason byte cap. |
maxGrantBatch
Returns the cap on labels per grantNames call.
function maxGrantBatch() external view returns (uint16 cap);
Returns
| Name | Type | Description |
|---|---|---|
cap | uint16 | Current batch cap. |
grantDuration
Returns the period a grant binds its name.
function grantDuration() external view returns (uint64 duration);
Returns
| Name | Type | Description |
|---|---|---|
duration | uint64 | Current grant period, in seconds. |
statusOf
Returns the status of label.
An expired grant reads Open.
function statusOf(string calldata label) external view returns (NameStatus status);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to look up. |
Returns
| Name | Type | Description |
|---|---|---|
status | NameStatus | Name status; see NameStatus. |
isReserved
Returns whether label is reserved.
function isReserved(string calldata label) external view returns (bool reserved);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to look up. |
Returns
| Name | Type | Description |
|---|---|---|
reserved | bool | True when the name is Reserved. |
granteeOf
Returns the winner of label, or the zero address when not Claimed.
Zero once the grant expires.
function granteeOf(string calldata label) external view returns (address winner);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to look up. |
Returns
| Name | Type | Description |
|---|---|---|
winner | address | Winning beneficiary. |
granteeOfNode
Returns the winner of the name at node, or the zero address when not Claimed.
The check the controllers use to keep every other path off a granted name. They already hold the node, so this skips the TLD lookup @custom:function granteeOf makes, which keeps the gateway's proof smaller. Zero once the grant expires.
function granteeOfNode(bytes32 node) external view returns (address winner);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | Namehash of the label under the active TLD. |
Returns
| Name | Type | Description |
|---|---|---|
winner | address | Winning beneficiary. |
grantExpiresAt
Returns when the grant on label expires, or zero when the name is not Claimed.
The grant binds the name while block.timestamp is below this value. Reads
type(uint64).max on a whitelist upgraded without initializeGrantExpiry, where
grants do not expire yet.
function grantExpiresAt(string calldata label) external view returns (uint64 expiresAt);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to look up. |
Returns
| Name | Type | Description |
|---|---|---|
expiresAt | uint64 | Timestamp the grant expires at. |
isGrantedTo
Returns whether account won label.
The pair check the controllers use to admit a registrant. False for the zero address and once the grant expires.
function isGrantedTo(
string calldata label,
address account
)
external
view
returns (bool granted);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to look up. |
account | address | Address to test against the winner. |
Returns
| Name | Type | Description |
|---|---|---|
granted | bool | True when account is the winner. |
claimOf
Returns user's claim on label.
function claimOf(string calldata label, address user) external view returns (Claim memory claim);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to look up. |
user | address | Beneficiary to look up. |
Returns
| Name | Type | Description |
|---|---|---|
claim | Claim | The stored claim; a zeroed struct with None status when absent. |
claimantCount
Returns the number of live claims on label.
function claimantCount(string calldata label) external view returns (uint256 count);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to look up. |
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Live claim count. |
claims
Returns a page of claims on label for review.
Reads the canonical offset and limit window.
function claims(
string calldata label,
uint256 offset,
uint256 limit
)
external
view
returns (Claim[] memory page);
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Bare label to look up. |
offset | uint256 | Index of the first claim. |
limit | uint256 | Maximum number of claims to return. |
Returns
| Name | Type | Description |
|---|---|---|
page | Claim[] | Claims in the window. |
nameCount
Returns the number of names with reserved, claimed or claim-holding state.
function nameCount() external view returns (uint256 count);
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Active name count. |
names
Returns a page of active names for review.
Reads the canonical offset and limit window. Iteration order is not stable. An
expired grant stays in the set until a write on the name clears it, and reads Open
with no winner.
function names(uint256 offset, uint256 limit) external view returns (NameView[] memory page);
Parameters
| Name | Type | Description |
|---|---|---|
offset | uint256 | Index of the first name. |
limit | uint256 | Maximum number of names to return. |
Returns
| Name | Type | Description |
|---|---|---|
page | NameView[] | Names in the window. |
window
Returns the request window.
function window() external view returns (uint64 openAt, uint64 closeAt);
Returns
| Name | Type | Description |
|---|---|---|
openAt | uint64 | Timestamp requests start being accepted. |
closeAt | uint64 | Timestamp requests stop being accepted. |
isWindowOpen
Returns whether requests are currently accepted.
function isWindowOpen() external view returns (bool open);
Returns
| Name | Type | Description |
|---|---|---|
open | bool | True when the current time is within the window. |
Events
NameRequested
Emitted when a beneficiary claims a name.
event NameRequested(
bytes32 indexed node,
address indexed user,
address indexed submitter,
string label,
string reason
);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | |
user | address | |
submitter | address | Address that filed the claim, which may differ from the beneficiary. |
label | string | |
reason | string |
ClaimWithdrawn
Emitted when a beneficiary withdraws their pending claim.
event ClaimWithdrawn(bytes32 indexed node, address indexed user, string label);
ClaimsCleared
Emitted when resolving a name clears the live claims of its round.
Replaces a rejection event per claim, so resolution costs the same however many claims
a name holds. Every claim of round that was still pending ends without winning,
except the accepted one, which @custom:emits NameAccepted names.
event ClaimsCleared(bytes32 indexed node, string label, uint256 round, uint256 cleared);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | |
label | string | |
round | uint256 | Round of claims that ended. |
cleared | uint256 | Live claims the round held, the accepted one included. |
NameAccepted
Emitted when a claim wins a name, including a direct governance grant.
event NameAccepted(bytes32 indexed node, address indexed user, string label);
NameRejected
Emitted when governance rejects a single claim.
event NameRejected(bytes32 indexed node, address indexed user, string label);
NameRevoked
Emitted when a name is reset to Open by governance.
event NameRevoked(bytes32 indexed node, address indexed winner, string label);
NameConsumed
Emitted when a winner registers the name and its entry is consumed.
event NameConsumed(bytes32 indexed node, address indexed user, string label);
NameReserved
Emitted when governance withholds a name from claiming.
event NameReserved(bytes32 indexed node, string label);
NameUnreserved
Emitted when governance releases a reserved name back to Open.
event NameUnreserved(bytes32 indexed node, string label);
WindowSet
Emitted when the request window is set.
event WindowSet(uint64 openAt, uint64 closeAt);
Parameters
| Name | Type | Description |
|---|---|---|
openAt | uint64 | Timestamp requests start being accepted. |
closeAt | uint64 | Timestamp requests stop being accepted. |
MaxClaimantsSet
Emitted when the live-claim cap is set.
event MaxClaimantsSet(uint16 maxClaimants);
Parameters
| Name | Type | Description |
|---|---|---|
maxClaimants | uint16 | New per-name claim cap. |
MaxReasonBytesSet
Emitted when the reason byte cap is set.
event MaxReasonBytesSet(uint256 maxReasonBytes);
Parameters
| Name | Type | Description |
|---|---|---|
maxReasonBytes | uint256 | New reason byte cap. |
MaxGrantBatchSet
Emitted when the grant-batch cap is set.
event MaxGrantBatchSet(uint16 maxGrantBatch);
Parameters
| Name | Type | Description |
|---|---|---|
maxGrantBatch | uint16 | New grantNames batch cap. |
GrantDurationSet
Emitted when the grant period is set.
event GrantDurationSet(uint64 grantDuration);
Parameters
| Name | Type | Description |
|---|---|---|
grantDuration | uint64 | New grant period, in seconds. |
Errors
ZeroUser
Thrown when a claim names the zero-address beneficiary.
error ZeroUser();
InvalidLabel
Thrown when a label is not a canonical single DNS label, or when a claimed or
granted label is shorter than DotnsConstants.MIN_LABEL_LENGTH.
error InvalidLabel();
ReasonTooLong
Thrown when a reason exceeds maxReasonBytes.
error ReasonTooLong();
NameNotOpen
Thrown when a name is not Open and the action requires it.
error NameNotOpen(bytes32 node);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | Namehash of the label under the active TLD. |
AlreadyClaimed
Thrown when user already holds a claim on the name.
error AlreadyClaimed(bytes32 node, address user);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | Namehash of the label under the active TLD. |
user | address | Beneficiary already holding a claim. |
TooManyClaimants
Thrown when a name already holds maxClaimants claims.
error TooManyClaimants(bytes32 node);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | Namehash of the label under the active TLD. |
MaxClaimantsOutOfRange
Thrown when the claim cap is set to zero or above
DotnsConstants.WHITELIST_MAX_CLAIMANTS_LIMIT.
error MaxClaimantsOutOfRange();
MaxReasonBytesOutOfRange
Thrown when the reason cap is set to zero or above
DotnsConstants.WHITELIST_MAX_REASON_LIMIT.
error MaxReasonBytesOutOfRange();
MaxGrantBatchOutOfRange
Thrown when the grant-batch cap is set to zero or above
DotnsConstants.WHITELIST_MAX_GRANT_BATCH_LIMIT.
error MaxGrantBatchOutOfRange();
GrantDurationOutOfRange
Thrown when the grant period is set below
DotnsConstants.WHITELIST_MIN_GRANT_DURATION or above
DotnsConstants.WHITELIST_MAX_GRANT_DURATION.
error GrantDurationOutOfRange();
NotRequested
Thrown when a claim is not in the Requested status.
error NotRequested(bytes32 node, address user);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | Namehash of the label under the active TLD. |
user | address | Beneficiary whose claim was expected to be pending. |
NotReserved
Thrown when releasing a name that is not reserved.
error NotReserved(bytes32 node);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | Namehash of the label under the active TLD. |
NothingToRevoke
Thrown when revoking a name that is not Claimed and holds no claims.
error NothingToRevoke(bytes32 node);
Parameters
| Name | Type | Description |
|---|---|---|
node | bytes32 | Namehash of the label under the active TLD. |
NotGovernance
Thrown when a governance-gated call is not a substrate Root dispatch.
Grant, revoke, accept, reject and reserve are Root-only: no signed account, owner included, can make them.
error NotGovernance();
NotController
Thrown when consume is called by any address other than a registrar controller.
error NotController(address caller);
Parameters
| Name | Type | Description |
|---|---|---|
caller | address | Rejected caller. |
NotWinner
Thrown when consume is called for a name not won by the registrant.
error NotWinner(address registrant, bytes32 node);
Parameters
| Name | Type | Description |
|---|---|---|
registrant | address | Address attempting to register the name. |
node | bytes32 | Namehash of the label under the active TLD. |
BadWindow
Thrown when the request window is set with a zero duration.
error BadWindow();
MaintainerWindowOutOfBounds
Thrown when the maintainer lengthens a window beyond
WHITELIST_MAINTAINER_MAX_WINDOW from its opening.
error MaintainerWindowOutOfBounds();
WindowClosed
Thrown when a claim is made outside the open window.
error WindowClosed();
TooManyLabels
Thrown when grantNames is passed more than maxGrantBatch labels.
error TooManyLabels();
Structs
Claim
A claim by one beneficiary on one name.
user, status and requestedAt co-locate in one storage slot; submitter takes the
next, and the dynamic reason is stored separately.
struct Claim {
address user;
ClaimStatus status;
uint64 requestedAt;
address submitter;
string reason;
}
Properties
| Name | Type | Description |
|---|---|---|
user | address | Beneficiary the name would bind to if this claim wins. |
status | ClaimStatus | Claim status; see ClaimStatus. |
requestedAt | uint64 | Timestamp the claim was made. |
submitter | address | Address that filed the claim, which may differ from the beneficiary. |
reason | string | Free-text justification for the claim. |
NameView
A name and its resolved state, for review.
struct NameView {
bytes32 node;
string label;
NameStatus status;
address winner;
}
Properties
| Name | Type | Description |
|---|---|---|
node | bytes32 | Namehash of the label under the active TLD. |
label | string | Bare label. |
status | NameStatus | Name status; see NameStatus. |
winner | address | Winning beneficiary when Claimed, otherwise the zero address. |
NameRecord
Stored resolved state of a name.
status, winner and expiresAt are ordered first so the 1-byte enum, the 20-byte
address and the 8-byte timestamp share one storage slot; the dynamic label is stored
separately. The stored status stays Claimed after a grant expires, until a write
on the name clears it. That clearing emits no event: indexers derive expiry from the
grant's NameAccepted timestamp and the GrantDurationSet value in force then, or
read grantExpiresAt.
struct NameRecord {
NameStatus status;
address winner;
uint64 expiresAt;
string label;
}
Properties
| Name | Type | Description |
|---|---|---|
status | NameStatus | Name status; see NameStatus. |
winner | address | Winning beneficiary when Claimed, otherwise the zero address. |
expiresAt | uint64 | Timestamp the grant expires at, fixed when the name became Claimed; zero otherwise, and for a grant recorded before grant expiry was initialised. |
label | string | Bare label, kept so reserved and claimed names are reviewable. |
Enums
NameStatus
Status of a name.
Open is the zero-value default: claimable, not reserved, not won. Reserved is
withheld by governance. Claimed has a single winner until the grant expires
grantDuration after it was made; every view and gate reads an expired grant as
Open.
enum NameStatus {
Open,
Reserved,
Claimed
}
ClaimStatus
Status of a single claim on a name.
None is the zero-value default of an absent claim. Rejected is sticky for the round
of claims it was made in: it is kept only when the beneficiary filed the claim
themselves, so they cannot re-request until the name is resolved; a claim filed on
their behalf is deleted on rejection and does not bind them.
enum ClaimStatus {
None,
Requested,
Rejected
}