Skip to main content

SnapshotsFacet

Asset Tokenization Studio Team

SnapshotsFacet

Diamond facet that exposes snapshot creation, scheduling, and historical balance, supply, and partition queries through the ISnapshots interface.

Inherits behaviour from Snapshots and satisfies IStaticFunctionSelectors for registration in the Diamond proxy under RESOLVER_KEY_SNAPSHOTS. Selectors are written into a fixed-size array using pre-decrement indexing inside an unchecked block; the declared selectorIndex initial value must match the array length.

Methods​

getScheduledSnapshots​

function getScheduledSnapshots(uint256 _pageIndex, uint256 _pageLength, bool _includeDisabled) external view returns (struct ScheduledTask[] scheduledSnapshot_)

Returns a paginated list of scheduled snapshots.

Does not mutate state. Pagination bounds are interpreted by the implementation and should be selected to avoid excessive gas in on-chain callers.

Parameters​

NameTypeDescription
_pageIndexuint256Zero-based page number.
_pageLengthuint256Maximum number of tasks to return per page.
_includeDisabledboolWhen true, snapshots belonging to cancelled corporate actions are included; when false, only active scheduled snapshots are returned.

Returns​

NameTypeDescription
scheduledSnapshot_ScheduledTask[]Array of ScheduledTask structs for the requested page.

getStaticFunctionSelectors​

function getStaticFunctionSelectors() external pure returns (bytes4[])

Gets all function selectors of a facet

Returns​

NameTypeDescription
_0bytes4[]Face functions selectors

getStaticInterfaceIds​

function getStaticInterfaceIds() external pure returns (bytes4[])

Gets all interfaces ids of a facet.

Returns​

NameTypeDescription
_0bytes4[]Face interface ids

getStaticResolverKey​

function getStaticResolverKey() external pure returns (bytes32 staticResolverKey_)

Gets the static resolver key

Returns​

NameTypeDescription
staticResolverKey_bytes32Static resolver key

initializeSnapshots​

function initializeSnapshots() external nonpayable

Initialises the snapshots capability on the token.

Callable once; subsequent calls revert with FacetAlreadyRegistered. Requires DEFAULT_ADMIN_ROLE. Called by the factory during deployment. Emits SnapshotsInitialized after successful registration.

scheduledSnapshotCount​

function scheduledSnapshotCount(bool _includeDisabled) external view returns (uint256)

Returns the number of snapshots scheduled to run on this asset.

Does not mutate state and reflects the current scheduled-task registry state.

Parameters​

NameTypeDescription
_includeDisabledboolWhen true, snapshots belonging to cancelled corporate actions are counted; when false, only active scheduled snapshots are counted.

Returns​

NameTypeDescription
_0uint256Count of scheduled snapshot tasks.

takeSnapshot​

function takeSnapshot() external nonpayable returns (uint256 snapshotID_)

Creates a snapshot of current balances and total supplies.

Records a new snapshot identifier and defers per-account and supply writes until the next relevant balance mutation. Implementations may revert if the caller is not authorised. Emits SnapshotTaken on success.

Returns​

NameTypeDescription
snapshotID_uint256Identifier assigned to the created snapshot.

Events​

SnapshotTaken​

event SnapshotTaken(address indexed operator, uint256 indexed snapshotID)

Emitted when an operator creates a new snapshot.

Parameters​

NameTypeDescription
operator indexedaddressAccount that initiated the snapshot creation.
snapshotID indexeduint256Identifier assigned to the created snapshot.

SnapshotTriggered​

event SnapshotTriggered(uint256 snapshotId, bytes metadata)

Emitted when a scheduled snapshot is executed.

Parameters​

NameTypeDescription
snapshotIduint256Identifier assigned to the triggered snapshot.
metadatabytesArbitrary metadata associated with the scheduled execution.

SnapshotsInitialized​

event SnapshotsInitialized()

Emitted once when the snapshots capability is initialised on a token.

Fires exclusively from initializeSnapshots.

Errors​

AccountHasNoRole​

error AccountHasNoRole(address account, bytes32 role)

Thrown when an account does not hold a required role.

Parameters​

NameTypeDescription
accountaddressThe account that lacks the role.
rolebytes32The role that is not held.

AssetNotOperational​

error AssetNotOperational(bytes32 configId, uint256 versionId)

Raised by InitializerStorageWrapper.checkOperational (and the related isConfigVersionOperational helper) when an operation is attempted on a configuration version that has not yet been marked operational.

Parameters​

NameTypeDescription
configIdbytes32Resolver-proxy configuration whose operational status was checked.
versionIduint256Configuration version whose operational status was checked.

Deactivated​

error Deactivated()

Thrown when an operation guarded by onlyActivated is attempted on a token whose deactivation flag has already been set.

FacetAlreadyRegistered​

error FacetAlreadyRegistered(bytes32 facetId, uint256 lastVersion)

Raised when an initialiser tries to register a facet that already has a non-zero last registered version (i.e. the facet is being re-initialised on a fresh install).

Parameters​

NameTypeDescription
facetIdbytes32Identifier of the offending facet.
lastVersionuint256Last version recorded for that facet at the time of the check.

IsPaused​

error IsPaused()

Thrown when an operation that requires the token to be unpaused is attempted while the token is paused (own flag or any external pause contract).

SnapshotIdDoesNotExists​

error SnapshotIdDoesNotExists(uint256 snapshotId)

Thrown when the requested snapshot identifier has never been taken on this token.

Parameters​

NameTypeDescription
snapshotIduint256The unrecognised snapshot identifier that was supplied.

SnapshotIdNull​

error SnapshotIdNull()

Thrown when a snapshot identifier of zero is supplied; zero is reserved and never assigned to a valid snapshot.

UnexpectedError​

error UnexpectedError(bytes4 _errorId)

Reverts when an unreachable validation state is detected.

Replaces assertions for defensive handling of logically impossible states.

Parameters​

NameTypeDescription
_errorIdbytes4Identifier of the unexpected validation condition.

UnrecognizedResolverProxyVersion​

error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)

Thrown when the provided proxy version does not match any BLR compatible standard.

Parameters​

NameTypeDescription
_resolverProxyVersionbytes8proxy version that is not compatible with the BLR.

WalletRecovered​

error WalletRecovered()

Thrown when attempting to recover a wallet that has already been recovered.