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
| Name | Type | Description |
|---|---|---|
| _pageIndex | uint256 | Zero-based page number. |
| _pageLength | uint256 | Maximum number of tasks to return per page. |
| _includeDisabled | bool | When true, snapshots belonging to cancelled corporate actions are included; when false, only active scheduled snapshots are returned. |
Returns
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| _0 | bytes4[] | Face functions selectors |
getStaticInterfaceIds
function getStaticInterfaceIds() external pure returns (bytes4[])
Gets all interfaces ids of a facet.
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bytes4[] | Face interface ids |
getStaticResolverKey
function getStaticResolverKey() external pure returns (bytes32 staticResolverKey_)
Gets the static resolver key
Returns
| Name | Type | Description |
|---|---|---|
| staticResolverKey_ | bytes32 | Static 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
| Name | Type | Description |
|---|---|---|
| _includeDisabled | bool | When true, snapshots belonging to cancelled corporate actions are counted; when false, only active scheduled snapshots are counted. |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | Count 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
| Name | Type | Description |
|---|---|---|
| snapshotID_ | uint256 | Identifier assigned to the created snapshot. |
Events
SnapshotTaken
event SnapshotTaken(address indexed operator, uint256 indexed snapshotID)
Emitted when an operator creates a new snapshot.
Parameters
| Name | Type | Description |
|---|---|---|
operator indexed | address | Account that initiated the snapshot creation. |
snapshotID indexed | uint256 | Identifier assigned to the created snapshot. |
SnapshotTriggered
event SnapshotTriggered(uint256 snapshotId, bytes metadata)
Emitted when a scheduled snapshot is executed.
Parameters
| Name | Type | Description |
|---|---|---|
| snapshotId | uint256 | Identifier assigned to the triggered snapshot. |
| metadata | bytes | Arbitrary 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
| Name | Type | Description |
|---|---|---|
| account | address | The account that lacks the role. |
| role | bytes32 | The 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
| Name | Type | Description |
|---|---|---|
| configId | bytes32 | Resolver-proxy configuration whose operational status was checked. |
| versionId | uint256 | Configuration 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
| Name | Type | Description |
|---|---|---|
| facetId | bytes32 | Identifier of the offending facet. |
| lastVersion | uint256 | Last 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
| Name | Type | Description |
|---|---|---|
| snapshotId | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| _errorId | bytes4 | Identifier of the unexpected validation condition. |
UnrecognizedResolverProxyVersion
error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)
Thrown when the provided proxy version does not match any BLR compatible standard.
Parameters
| Name | Type | Description |
|---|---|---|
| _resolverProxyVersion | bytes8 | proxy version that is not compatible with the BLR. |
WalletRecovered
error WalletRecovered()
Thrown when attempting to recover a wallet that has already been recovered.