Skip to main content

ScheduledBalanceAdjustmentFacet

Asset Tokenization Studio Team

ScheduledBalanceAdjustmentFacet

Diamond facet that consolidates all 8 scheduled balance-adjustment selectors under a single RESOLVER_KEY_SCHEDULED_BALANCE_ADJUSTMENT.

Inherits implementation from ScheduledBalanceAdjustment and satisfies the IStaticFunctionSelectors contract required by the Diamond proxy for selector registration. Exposes: setScheduledBalanceAdjustment, cancelScheduledBalanceAdjustment, getScheduledBalanceAdjustment, getBalanceAdjustmentCount, getPendingBalanceAdjustmentCount, getScheduledBalanceAdjustments.

Methods​

cancelScheduledBalanceAdjustment​

function cancelScheduledBalanceAdjustment(uint256 _balanceAdjustmentId) external nonpayable returns (bool success_)

Cancels a previously scheduled balance adjustment.

Caller must hold ROLE_CORPORATE_ACTION. The token must not be paused. Emits ScheduledBalanceAdjustmentCancelled on success.

Parameters​

NameTypeDescription
_balanceAdjustmentIduint256undefined

Returns​

NameTypeDescription
success_boolTrue if the cancellation succeeded.

forceCancelScheduledBalanceAdjustment​

function forceCancelScheduledBalanceAdjustment(uint256 _balanceAdjustmentId) external nonpayable returns (bool success_)

Force-cancels a balance adjustment regardless of its execution date.

Restricted to ROLE_CORPORATE_ACTION_FORCE_CANCEL; gated by onlyUnpaused and onlyMatchingActionType(CORPORATE_ACTION_TYPE_BALANCE_ADJUSTMENT, _balanceAdjustmentId - 1).

Parameters​

NameTypeDescription
_balanceAdjustmentIduint256undefined

Returns​

NameTypeDescription
success_boolTrue if the force-cancellation succeeded.

getBalanceAdjustmentCount​

function getBalanceAdjustmentCount() external view returns (uint256 balanceAdjustmentCount_)

Returns the total number of balance adjustments ever scheduled, including cancelled ones.

Returns​

NameTypeDescription
balanceAdjustmentCount_uint256Total count of corporate-action balance adjustment records.

getPendingBalanceAdjustmentCount​

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

Returns the number of pending scheduled balance adjustments in the task queue.

Reads directly from ScheduledTasksStorageWrapper; excludes already-executed tasks.

Parameters​

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

Returns​

NameTypeDescription
_0uint256Count of pending balance adjustment tasks.

getScheduledBalanceAdjustment​

function getScheduledBalanceAdjustment(uint256 _balanceAdjustmentID) external view returns (struct IScheduledBalanceAdjustment.ScheduledBalanceAdjustment balanceAdjustment_, bool isDisabled_)

Returns the parameters and disabled state of a previously scheduled balance adjustment.

Reverts if the corporate action type stored at index _balanceAdjustmentID - 1 does not match CORPORATE_ACTION_TYPE_BALANCE_ADJUSTMENT.

Parameters​

NameTypeDescription
_balanceAdjustmentIDuint256Identifier of the scheduled adjustment to query.

Returns​

NameTypeDescription
balanceAdjustment_IScheduledBalanceAdjustment.ScheduledBalanceAdjustmentStruct containing executionDate, factor, and decimals.
isDisabled_boolTrue if the adjustment has been cancelled or already executed.

getScheduledBalanceAdjustments​

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

Returns a paginated slice of pending scheduled balance adjustment tasks.

Reads from ScheduledTasksStorageWrapper. Tasks are ordered by insertion index.

Parameters​

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

Returns​

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

initializeScheduledBalanceAdjustment​

function initializeScheduledBalanceAdjustment() external nonpayable

Initialises the scheduled balance adjustment capability on the token.

Callable once; subsequent calls revert with FacetAlreadyRegistered. Requires DEFAULT_ADMIN_ROLE. Called by the factory during deployment.

setScheduledBalanceAdjustment​

function setScheduledBalanceAdjustment(IScheduledBalanceAdjustment.ScheduledBalanceAdjustment _newBalanceAdjustment) external nonpayable returns (uint256 balanceAdjustmentID_)

Parameters​

NameTypeDescription
_newBalanceAdjustmentIScheduledBalanceAdjustment.ScheduledBalanceAdjustmentundefined

Returns​

NameTypeDescription
balanceAdjustmentID_uint256undefined

Events​

ScheduledBalanceAdjustmentCancelled​

event ScheduledBalanceAdjustmentCancelled(uint256 balanceAdjustmentId, address indexed operator)

Emitted when a previously scheduled balance adjustment is cancelled.

Parameters​

NameTypeDescription
balanceAdjustmentIduint256Sequential identifier of the cancelled adjustment.
operator indexedaddressAddress that performed the cancellation.

ScheduledBalanceAdjustmentForceCancelled​

event ScheduledBalanceAdjustmentForceCancelled(uint256 balanceAdjustmentId, address indexed operator)

Emitted when an admin force-cancels a balance adjustment, bypassing date guards.

Parameters​

NameTypeDescription
balanceAdjustmentIduint256Sequential identifier of the force-cancelled adjustment.
operator indexedaddressAddress that performed the force-cancellation.

ScheduledBalanceAdjustmentInitialized​

event ScheduledBalanceAdjustmentInitialized()

Emitted once when the scheduled balance adjustment capability is initialised on a token.

Fires exclusively from initializeScheduledBalanceAdjustment.

ScheduledBalanceAdjustmentSet​

event ScheduledBalanceAdjustmentSet(bytes32 corporateActionId, uint256 balanceAdjustmentId, address indexed operator, uint256 indexed executionDate, uint256 factor, uint256 decimals)

Emitted when a balance adjustment is successfully scheduled.

Parameters​

NameTypeDescription
corporateActionIdbytes32On-chain identifier of the associated corporate action record.
balanceAdjustmentIduint256Sequential identifier of the scheduled adjustment.
operator indexedaddressAddress that scheduled the adjustment.
executionDate indexeduint256Unix timestamp at which the adjustment will be executed.
factoruint256Numerator of the adjustment ratio.
decimalsuint256Denominator exponent; effective ratio = factor / 10^decimals.

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.

BalanceAdjustmentAlreadyExecuted​

error BalanceAdjustmentAlreadyExecuted(bytes32 corporateActionId, uint256 balanceAdjustmentId)

Reverts when attempting to cancel or re-execute an adjustment that has already run.

Parameters​

NameTypeDescription
corporateActionIdbytes32Identifier of the corporate action that was already executed.
balanceAdjustmentIduint256Identifier of the balance adjustment that was already executed.

BalanceAdjustmentCreationFailed​

error BalanceAdjustmentCreationFailed()

Reverts when the underlying storage layer fails to create a corporate action record.

Deactivated​

error Deactivated()

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

DecimalsOverflow​

error DecimalsOverflow()

Reverts when the cumulative decimals shift would overflow uint8.

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.

FactorIsZero​

error FactorIsZero()

Reverts when factor is zero, which would zero-out all holder balances.

FactorOverflow​

error FactorOverflow()

Reverts when the proposed factor would overflow the cumulative ABAF.

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).

TotalSupplyOverflow​

error TotalSupplyOverflow()

Reverts when the proposed factor would overflow the projected total supply.

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.

WrongIndexForAction​

error WrongIndexForAction(uint256 index, bytes32 actionType)

Thrown when a type-scoped index does not correspond to an existing action.

Parameters​

NameTypeDescription
indexuint256The out-of-range index that was provided.
actionTypebytes32The action type against which the index was validated.

WrongTimestamp​

error WrongTimestamp(uint256 timeStamp)

Reverts when a scheduled timestamp is not strictly in the future.

Used for shared scheduling validation where the current block time is read through TimeTravelStorageWrapper.

Parameters​

NameTypeDescription
timeStampuint256Timestamp rejected for scheduling.

ZeroValueNotAllowed​

error ZeroValueNotAllowed()

Reverts when zero is supplied where a positive value is required.

Used for shared validation of amounts, limits, factors, or identifiers.