IStoreFactory

Git Source

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

NameTypeDescription
beaconaddressAddress of the beacon contract.

userStoreBeacon

Returns the UpgradeableBeacon address backing all UserStore proxies.

function userStoreBeacon() external view returns (address beacon);

Returns

NameTypeDescription
beaconaddressAddress of the beacon contract.

protocolRegistry

Returns the protocol registry address used for writer authorisation.

function protocolRegistry() external view returns (address registry);

Returns

NameTypeDescription
registryaddressAddress 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

NameTypeDescription
useraddressThe user the store is bound to forever.

Returns

NameTypeDescription
storeaddressThe 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

NameTypeDescription
useraddressThe user to look up.

Returns

NameTypeDescription
storeaddressThe bound store address, or zero.

getLabelStoreCount

Returns the total number of LabelStore proxies ever deployed.

function getLabelStoreCount() external view returns (uint256 count);

Returns

NameTypeDescription
countuint256Length 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

NameTypeDescription
offsetuint256Start index.
limituint256Maximum entries to return.

Returns

NameTypeDescription
storesaddress[]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. newImplementation must be non-zero, otherwise @custom:reverts InvalidImplementation. The candidate is sentinel-probed by calling ILabelStore.protocolRegistry on 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 to UpgradeableBeacon.upgradeTo and emits

  • emits: LabelStoreImplementationUpgraded on success.

function upgradeLabelStoreImplementation(address newImplementation) external;

Parameters

NameTypeDescription
newImplementationaddressThe 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

NameTypeDescription
storeaddressThe 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

NameTypeDescription
useraddressThe user to look up.

Returns

NameTypeDescription
storeaddressThe bound store address, or zero.

getUserStoreCount

Returns the total number of UserStore proxies ever claimed.

function getUserStoreCount() external view returns (uint256 count);

Returns

NameTypeDescription
countuint256Length 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

NameTypeDescription
offsetuint256Start index.
limituint256Maximum entries to return.

Returns

NameTypeDescription
storesaddress[]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. newImplementation must be non-zero, otherwise @custom:reverts InvalidImplementation. The candidate is sentinel-probed by calling IUserStore.getKeyCount on 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 to UpgradeableBeacon.upgradeTo and emits

  • emits: UserStoreImplementationUpgraded on success.

function upgradeUserStoreImplementation(address newImplementation) external;

Parameters

NameTypeDescription
newImplementationaddressThe new implementation address.

Events

LabelStoreDeployed

Emitted when a LabelStore beacon-proxy is deployed for user.

event LabelStoreDeployed(address indexed user, address indexed store);

Parameters

NameTypeDescription
useraddressThe user the store is bound to.
storeaddressThe deployed store address.

UserStoreClaimed

Emitted when user claims their UserStore beacon-proxy.

event UserStoreClaimed(address indexed user, address indexed store);

Parameters

NameTypeDescription
useraddressThe user the store is bound to.
storeaddressThe deployed store address.

LabelStoreImplementationUpgraded

Emitted when the LabelStore implementation behind the label beacon is upgraded.

event LabelStoreImplementationUpgraded(address indexed newImplementation);

Parameters

NameTypeDescription
newImplementationaddressThe new implementation address.

UserStoreImplementationUpgraded

Emitted when the UserStore implementation behind the user beacon is upgraded.

event UserStoreImplementationUpgraded(address indexed newImplementation);

Parameters

NameTypeDescription
newImplementationaddressThe new implementation address.

Errors

AlreadyDeployed

Thrown when attempting to deploy or claim a store that already exists.

error AlreadyDeployed(address user, address existingStore);

Parameters

NameTypeDescription
useraddressThe user for whom the store exists.
existingStoreaddressThe already-deployed store address.

InvalidUser

Thrown when a zero user address is supplied.

error InvalidUser(address user);

Parameters

NameTypeDescription
useraddressThe invalid user argument.

InvalidProtocolRegistry

Thrown when a zero protocol registry address is supplied to the constructor.

error InvalidProtocolRegistry(address protocolRegistry);

Parameters

NameTypeDescription
protocolRegistryaddressThe 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

NameTypeDescription
calleraddressThe unauthorised msg.sender.

ImplementationBindingMismatch

Thrown when a freshly deployed proxy does not report the expected owner.

error ImplementationBindingMismatch();