Skip to main content

ISnapshots

Asset Tokenization Studio Team

Snapshots Interface

Defines the external API for token balance and supply snapshot management.

Extends ISnapshotsTypes and exposes initialisation, immediate snapshot creation, and scheduled snapshot inspection. Implementations are expected to preserve snapshot identifiers as stable historical references for downstream features.

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.

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​

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.