RegistrationUtils
Title: DotNS Registration Utilities Library
Single canonical implementation of the "mint + forward-registry + store-write" triad used by every DotNS registration flow.
Exists so that every controller (public commit-reveal, PoP gateway, future privileged flows) calls the same sequence. Without this library each controller re-implements the sequence, and the implementations drift.
Scope: this library is deliberately minimal. It only performs the steps that every registration flow needs regardless of policy:
- Mint the ERC721 name token on the base registrar.
- Write the forward registry entry (node => owner + default resolver).
- Resolve the per-user
LabelStore(deploying on demand) so the caller can pass it back. The registrar writes the labels-only store entry internally. Flow-specific concerns (pricing, reverse-record setting, chat-key persistence, reservation queue mutation) stay inside the calling controller.
Note: security-contact: admin@parity.io
Functions
registerAndStore
Performs the canonical mint + forward-registry + store-write sequence.
Callable by any authorised controller. Emits no events; each controller
emits its own flow-level event after this returns, so behavioural drift
between flows stays contained at the emission layer rather than at the
underlying state-transition layer. Store authorisation is handled by the
protocol registry (isRegisteredAddress) on every write, so no per-store
allowlist bookkeeping is needed here.
The registrar writes the LabelStore entry directly inside register
so this helper deliberately does not call StoreUtils.writeLabel.
Doing it twice would deploy or touch the store on every flow and
could conflict with the registrar's locked-entry semantics.
function registerAndStore(RegistrationContext memory context)
internal
returns (address labelStore);
Parameters
| Name | Type | Description |
|---|---|---|
context | RegistrationContext | Registration inputs. See @custom:struct RegistrationContext. |
Returns
| Name | Type | Description |
|---|---|---|
labelStore | address | The resolved or newly deployed LabelStore address for context.user. |
_resolveSiblings
Resolves sibling contracts via the protocol registry.
Exists so that resolution is one round-trip through a single helper and not duplicated inline at every call site. If protocol-registry key conventions change, the change lands here.
function _resolveSiblings(IDotnsProtocolRegistry protocolRegistry)
private
view
returns (Siblings memory siblings);
Structs
RegistrationContext
Inputs describing a single name registration.
Passed as a struct so callers do not have to thread a growing positional argument list, and so future additions (e.g. a subname parent node) can be made additively without breaking call sites.
struct RegistrationContext {
IDotnsProtocolRegistry protocolRegistry;
address user;
string label;
bytes32 labelhash;
bytes32 node;
}
Properties
| Name | Type | Description |
|---|---|---|
protocolRegistry | IDotnsProtocolRegistry | The protocol-level address registry for sibling lookups. |
user | address | Address receiving the name. |
label | string | Human-readable label (without the TLD). |
labelhash | bytes32 | keccak256(bytes(label)). |
node | bytes32 | namehash(DOT_NODE, labelhash). |
Siblings
Resolved sibling contracts for a registration call.
Held as a struct internally so the helper can pass a single value to the
downstream steps rather than three separate locals. Never returned to
callers; kept in memory for the lifetime of one registerAndStore.
struct Siblings {
IDotnsRegistrar registrar;
IDotnsRegistry registry;
IStoreFactory storeFactory;
}