IStoreFactory
Title: IStoreFactory
Interface for the DotNS per-user store factory.
Owns two UpgradeableBeacon instances; one for LabelStore (protocol-managed),
one for UserStore (user-claimed). Each user may acquire at most one of each,
forever. There is no transfer, no redeploy, no additional store type.
Note: security-contact: admin@parity.io
Functions
labelStoreBeacon
Returns the UpgradeableBeacon address backing all LabelStore proxies.
function labelStoreBeacon() external view returns (address beacon);
Returns
| Name | Type | Description |
|---|---|---|
beacon | address | Address of the beacon contract. |
userStoreBeacon
Returns the UpgradeableBeacon address backing all UserStore proxies.
function userStoreBeacon() external view returns (address beacon);
Returns
| Name | Type | Description |
|---|---|---|
beacon | address | Address of the beacon contract. |
protocolRegistry
Returns the protocol registry address used for writer authorisation.
function protocolRegistry() external view returns (address registry);
Returns
| Name | Type | Description |
|---|---|---|
registry | address | Address of the protocol registry. |
deployLabelStoreFor
Deploys a LabelStore beacon-proxy bound to user.
Callable by the factory owner or any address currently registered in the protocol
registry; any other caller @custom:reverts NotAuthorised. user must be non-zero,
otherwise @custom:reverts InvalidUser. The user must not already have a
LabelStore, otherwise @custom:reverts AlreadyDeployed. After deployment the
freshly initialised proxy must report user as its owner, otherwise
Notes:
-
reverts: ImplementationBindingMismatch. Emits
-
emits: LabelStoreDeployed on success.
function deployLabelStoreFor(address user) external returns (address store);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user the store is bound to forever. |
Returns
| Name | Type | Description |
|---|---|---|
store | address | The deployed store address. |
getLabelStore
Returns the LabelStore address bound to user, or the zero address if none.
function getLabelStore(address user) external view returns (address store);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user to look up. |
Returns
| Name | Type | Description |
|---|---|---|
store | address | The bound store address, or zero. |
getLabelStoreCount
Returns the total number of LabelStore proxies ever deployed.
function getLabelStoreCount() external view returns (uint256 count);
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Length of the deployment list. |
getLabelStores
Paginated enumeration over every LabelStore proxy ever deployed.
Insertion order of deployLabelStoreFor calls. offset >= getLabelStoreCount()
returns an empty array; result length is min(limit, count - offset).
function getLabelStores(
uint256 offset,
uint256 limit
)
external
view
returns (address[] memory stores);
Parameters
| Name | Type | Description |
|---|---|---|
offset | uint256 | Start index. |
limit | uint256 | Maximum entries to return. |
Returns
| Name | Type | Description |
|---|---|---|
stores | address[] | Slice of label-store addresses. |
upgradeLabelStoreImplementation
Upgrades the LabelStore implementation for every existing and future proxy.
Callable by the factory owner only, otherwise
Notes:
-
reverts: OwnableUnauthorizedAccount.
newImplementationmust be non-zero, otherwise @custom:reverts InvalidImplementation. The candidate is sentinel-probed by callingILabelStore.protocolRegistryon it before the beacon is rotated; if the address does not implement that selector the probe reverts and the upgrade does not land (deliberate fail-fast guard, no named error). Delegates toUpgradeableBeacon.upgradeToand emits -
emits: LabelStoreImplementationUpgraded on success.
function upgradeLabelStoreImplementation(address newImplementation) external;
Parameters
| Name | Type | Description |
|---|---|---|
newImplementation | address | The new implementation address. |
claimUserStore
Caller claims their UserStore beacon-proxy.
Self-claim only; _owner on the resulting store is always msg.sender,
regardless of who pays gas. One store per caller, forever: a caller who already
has a UserStore @custom:reverts AlreadyDeployed. After deployment the freshly
initialised proxy must report msg.sender as its owner, otherwise
Notes:
-
reverts: ImplementationBindingMismatch. Emits
-
emits: UserStoreClaimed on success.
function claimUserStore() external returns (address store);
Returns
| Name | Type | Description |
|---|---|---|
store | address | The deployed store address. |
getUserStore
Returns the UserStore address bound to user, or the zero address if none.
function getUserStore(address user) external view returns (address store);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user to look up. |
Returns
| Name | Type | Description |
|---|---|---|
store | address | The bound store address, or zero. |
getUserStoreCount
Returns the total number of UserStore proxies ever claimed.
function getUserStoreCount() external view returns (uint256 count);
Returns
| Name | Type | Description |
|---|---|---|
count | uint256 | Length of the claim list. |
getUserStores
Paginated enumeration over every UserStore proxy ever claimed.
Insertion order of claimUserStore calls. offset >= getUserStoreCount()
returns an empty array; result length is min(limit, count - offset).
function getUserStores(
uint256 offset,
uint256 limit
)
external
view
returns (address[] memory stores);
Parameters
| Name | Type | Description |
|---|---|---|
offset | uint256 | Start index. |
limit | uint256 | Maximum entries to return. |
Returns
| Name | Type | Description |
|---|---|---|
stores | address[] | Slice of user-store addresses. |
upgradeUserStoreImplementation
Upgrades the UserStore implementation for every existing and future proxy.
Callable by the factory owner only, otherwise
Notes:
-
reverts: OwnableUnauthorizedAccount.
newImplementationmust be non-zero, otherwise @custom:reverts InvalidImplementation. The candidate is sentinel-probed by callingIUserStore.getKeyCounton it before the beacon is rotated; if the address does not implement that selector the probe reverts and the upgrade does not land (deliberate fail-fast guard, no named error). Delegates toUpgradeableBeacon.upgradeToand emits -
emits: UserStoreImplementationUpgraded on success.
function upgradeUserStoreImplementation(address newImplementation) external;
Parameters
| Name | Type | Description |
|---|---|---|
newImplementation | address | The new implementation address. |
Events
LabelStoreDeployed
Emitted when a LabelStore beacon-proxy is deployed for user.
event LabelStoreDeployed(address indexed user, address indexed store);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user the store is bound to. |
store | address | The deployed store address. |
UserStoreClaimed
Emitted when user claims their UserStore beacon-proxy.
event UserStoreClaimed(address indexed user, address indexed store);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user the store is bound to. |
store | address | The deployed store address. |
LabelStoreImplementationUpgraded
Emitted when the LabelStore implementation behind the label beacon is upgraded.
event LabelStoreImplementationUpgraded(address indexed newImplementation);
Parameters
| Name | Type | Description |
|---|---|---|
newImplementation | address | The new implementation address. |
UserStoreImplementationUpgraded
Emitted when the UserStore implementation behind the user beacon is upgraded.
event UserStoreImplementationUpgraded(address indexed newImplementation);
Parameters
| Name | Type | Description |
|---|---|---|
newImplementation | address | The new implementation address. |
Errors
AlreadyDeployed
Thrown when attempting to deploy or claim a store that already exists.
error AlreadyDeployed(address user, address existingStore);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The user for whom the store exists. |
existingStore | address | The already-deployed store address. |
InvalidUser
Thrown when a zero user address is supplied.
error InvalidUser(address user);
Parameters
| Name | Type | Description |
|---|---|---|
user | address | The invalid user argument. |
InvalidProtocolRegistry
Thrown when a zero protocol registry address is supplied to the constructor.
error InvalidProtocolRegistry(address protocolRegistry);
Parameters
| Name | Type | Description |
|---|---|---|
protocolRegistry | address | The invalid registry argument. |
InvalidImplementation
Thrown when a zero implementation address is supplied to the constructor or an upgrade. @param implementation The invalid implementation argument.
error InvalidImplementation(address implementation);
NotAuthorised
Thrown when an unauthorised address attempts to deploy a label store.
error NotAuthorised(address caller);
Parameters
| Name | Type | Description |
|---|---|---|
caller | address | The unauthorised msg.sender. |
ImplementationBindingMismatch
Thrown when a freshly deployed proxy does not report the expected owner.
error ImplementationBindingMismatch();