Skip to main content

AdjustBalances

Asset Tokenization Studio Team

AdjustBalances

Abstract implementation of IAdjustBalances providing immediate balance adjustment corporate actions for tokenised assets.

Inherits access-control guards from Modifiers. Immediate adjustments are applied via AdjustBalancesStorageWrapper. Scheduled adjustments are handled by IScheduledBalanceAdjustment. Intended to be inherited by AdjustBalancesFacet.

Methods​

adjustBalances​

function adjustBalances(uint256 factor, uint8 decimals) external nonpayable returns (bool success_)

Applies a balance adjustment to all token holders immediately.

Emits {AdjustmentBalanceSet}.

Parameters​

NameTypeDescription
factoruint256undefined
decimalsuint8undefined

Returns​

NameTypeDescription
success_boolTrue if the adjustment was applied without reverting.

initializeBalanceAdjustments​

function initializeBalanceAdjustments() external nonpayable

Initialises the balance adjustment capability on the token.

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

triggerAndSyncAll​

function triggerAndSyncAll(bytes32 _partition, address _from, address _to) external nonpayable

Triggers pending scheduled tasks and synchronises the balance snapshot for a transfer pair.

May emit {SnapshotTriggered} or {AdjustmentBalanceSet} depending on pending scheduled tasks.

Parameters​

NameTypeDescription
_partitionbytes32Partition identifier of the transfer.
_fromaddressSender address whose snapshot is synchronised.
_toaddressRecipient address whose snapshot is synchronised.

Events​

AdjustmentBalanceSet​

event AdjustmentBalanceSet(address indexed operator, uint256 factor, uint8 decimals)

Emitted when an immediate balance adjustment is applied.

Parameters​

NameTypeDescription
operator indexedaddressAddress that triggered the adjustment.
factoruint256Numerator of the adjustment ratio.
decimalsuint8Denominator exponent; effective ratio = factor / 10^decimals.

BalanceAdjustmentsInitialized​

event BalanceAdjustmentsInitialized()

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

Fires exclusively from initializeBalanceAdjustments after the storage write succeeds.

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.

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.