StoreUtils
Title: DotNS Store Utilities Library
Canonical helpers for protocol writes into per-user LabelStore instances.
One auth rule, one write path. Every DotNS consumer (controller, registrar,
registry, PoP controller) funnels label writes through writeLabel so
authorisation and deploy-on-first-use semantics are identical across flows.
Note: security-contact: admin@parity.io
Functions
ensureLabelStore
Returns the LabelStore for user, deploying one via the factory if absent.
Deploy-on-demand: a user's store is created on their first protocol write so unused accounts never pay the deployment cost. The deploy path is gated by the factory, so callers that are not the factory owner and not protocol-registered
Note: reverts: NotAuthorised when a deployment is required.
function ensureLabelStore(IStoreFactory factory, address user)
internal
returns (address store);
Parameters
| Name | Type | Description |
|---|---|---|
factory | IStoreFactory | The store factory. |
user | address | The user whose label store is being resolved. |
Returns
| Name | Type | Description |
|---|---|---|
store | address | The resolved or newly deployed store address. |
writeLabel
Writes label under labelhash for user, deploying their LabelStore if needed.
Idempotent on locked entries: once a label is locked the call is a no-op rather than a revert, so retried protocol flows (e.g. an ERC721 transfer back to a prior owner) pass through without failing on the existing lock. Inherits the factory's writer authorisation: callers that are not the factory owner and not protocol-registered @custom:reverts NotAuthorised when the user has no store yet.
function writeLabel(
IStoreFactory factory,
address user,
bytes32 labelhash,
string memory label
)
internal
returns (address store);
Parameters
| Name | Type | Description |
|---|---|---|
factory | IStoreFactory | The store factory. |
user | address | The label store owner. |
labelhash | bytes32 | The labelhash key. |
label | string | The label string (typically the full name, e.g. "alice.dot"). |
Returns
| Name | Type | Description |
|---|---|---|
store | address | The resolved or newly deployed store address. |