Skip to main content

BalanceTracker

Asset Tokenization Studio Team

BalanceTracker

Abstract implementation of IBalanceTracker that consolidates token balance and total supply queries into a single, time-aware read layer.

Delegates all storage reads to ERC1410StorageWrapper and TokenCoreOps, passing the resolved timestamp from TimeTravelStorageWrapper to support non-triggered adjustment simulation. Intended to be inherited by BalanceTrackerFacet.

Methods​

balanceOf​

function balanceOf(address _tokenHolder) external view returns (uint256)

Returns the total token balance of a token holder across all partitions, simulating non-triggered balance adjustments up to the current timestamp.

Delegates to ERC1410StorageWrapper.balanceOfAdjustedAt. No state is mutated.

Parameters​

NameTypeDescription
_tokenHolderaddressThe address of the token holder.

Returns​

NameTypeDescription
_0uint256The adjusted total balance of the token holder at the current timestamp.

getTotalBalanceFor​

function getTotalBalanceFor(address _account) external view returns (uint256)

Returns the total balance held by an account across all partitions, including locked tokens, held tokens, and clearing amounts, simulating non-triggered adjustments up to the current timestamp.

Delegates to TokenCoreOps.getTotalBalanceForAdjustedAt. No state is mutated.

Parameters​

NameTypeDescription
_accountaddressThe address of the account.

Returns​

NameTypeDescription
_0uint256The adjusted total balance for the account at the current timestamp.

initializeBalanceTracker​

function initializeBalanceTracker() external nonpayable

Initialises the balance tracker capability on the token.

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

totalSupply​

function totalSupply() external view returns (uint256)

Returns the total token supply across all partitions, simulating non-triggered supply adjustments up to the current timestamp.

Delegates to ERC1410StorageWrapper.totalSupplyAdjustedAt. No state is mutated.

Returns​

NameTypeDescription
_0uint256The adjusted total supply at the current timestamp.

Events​

BalanceTrackerInitialized​

event BalanceTrackerInitialized()

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

Fires exclusively from initializeBalanceTracker 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.

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.

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.