Skip to main content

AmortizationFacet

Asset Tokenization Studio Team

AmortizationFacet

Diamond facet that exposes amortization schedule management to the proxy.

Selectors exposed: - initializeAmortization - setAmortization - cancelAmortization - forceCancelAmortization - getAmortization - getAmortizationFor - getAmortizationsFor - getAmortizationsCount - getAmortizationHolders - getTotalAmortizationHolders - setAmortizationHold - releaseAmortizationHold - getAmortizationActiveHolders - getTotalAmortizationActiveHolders - getActiveAmortizationIds - getTotalActiveAmortizationIds - getTotalHoldByAmortizationId - migrateAmortizationHoldAccounting - isAmortizationHoldAccountingMigrationPending

Methods​

cancelAmortization​

function cancelAmortization(uint256 _amortizationID) external nonpayable

Cancels an existing amortization.

Requires no active amortization holds for the specified corporate action.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization to cancel.

forceCancelAmortization​

function forceCancelAmortization(uint256 _amortizationID) external nonpayable

Force-cancels an amortization regardless of its execution date.

Restricted to ROLE_CORPORATE_ACTION_FORCE_CANCEL; gated by onlyUnpaused, onlyWithoutMultiPartition, and onlyMatchingActionType(CORPORATE_ACTION_TYPE_AMORTIZATION, _amortizationID - 1).

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization to force-cancel.

getActiveAmortizationIds​

function getActiveAmortizationIds(uint256 _pageIndex, uint256 _pageLength) external view returns (uint256[] activeIds_)

Retrieves a paginated list of non-cancelled amortization IDs.

Cancelled amortizations (isDisabled=true) are excluded from the result.

Parameters​

NameTypeDescription
_pageIndexuint256The page index for pagination.
_pageLengthuint256The number of records per page.

Returns​

NameTypeDescription
activeIds_uint256[]Array of amortization IDs that have not been cancelled.

getAmortization​

function getAmortization(uint256 _amortizationID) external view returns (struct IAmortization.RegisteredAmortization registeredAmortization_, bool isDisabled_)

Retrieves a registered amortization by its ID.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization to retrieve.

Returns​

NameTypeDescription
registeredAmortization_IAmortization.RegisteredAmortizationThe registered amortization data.
isDisabled_boolWhether the amortization is disabled.

getAmortizationActiveHolders​

function getAmortizationActiveHolders(uint256 _amortizationID, uint256 _pageIndex, uint256 _pageLength) external view returns (address[] holders_)

Retrieves a paginated list of token holders that still have an active hold for a given amortization.

Use this to identify which holders must have their hold released before cancelAmortization can succeed.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.
_pageIndexuint256The page index for pagination.
_pageLengthuint256The number of holders per page.

Returns​

NameTypeDescription
holders_address[]Array of addresses with an active hold for this amortization.

getAmortizationFor​

function getAmortizationFor(uint256 _amortizationID, address _account) external view returns (struct IAmortization.AmortizationFor amortizationFor_)

Retrieves amortization payment information for a specific account.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.
_accountaddressThe account address.

Returns​

NameTypeDescription
amortizationFor_IAmortization.AmortizationForAmortization payment information for the specified account.

getAmortizationHolders​

function getAmortizationHolders(uint256 _amortizationID, uint256 _pageIndex, uint256 _pageLength) external view returns (address[] holders_)

Retrieves a paginated list of amortization holders for a specific amortization ID.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.
_pageIndexuint256The page index for pagination.
_pageLengthuint256The number of holders per page.

Returns​

NameTypeDescription
holders_address[]Array of holder addresses.

getAmortizationsCount​

function getAmortizationsCount() external view returns (uint256 amortizationCount_)

Retrieves the total number of amortizations set for the security.

Cancelled amortizations are included in the count.

Returns​

NameTypeDescription
amortizationCount_uint256The total count of registered amortizations.

getAmortizationsFor​

function getAmortizationsFor(uint256 _amortizationID, uint256 _pageIndex, uint256 _pageLength) external view returns (struct IAmortization.AmortizationFor[] amortizationsFor_, address[] holders_)

Retrieves amortization payment information for multiple holders (paginated).

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.
_pageIndexuint256The page index for pagination.
_pageLengthuint256The number of records per page.

Returns​

NameTypeDescription
amortizationsFor_IAmortization.AmortizationFor[]List of amortization payment information per holder.
holders_address[]The holder addresses aligned by index with amortizationsFor_.

getStaticFunctionSelectors​

function getStaticFunctionSelectors() external pure returns (bytes4[] staticFunctionSelectors_)

Gets all function selectors of a facet

Returns​

NameTypeDescription
staticFunctionSelectors_bytes4[]Face functions selectors

getStaticInterfaceIds​

function getStaticInterfaceIds() external pure returns (bytes4[] staticInterfaceIds_)

Gets all interfaces ids of a facet.

Returns​

NameTypeDescription
staticInterfaceIds_bytes4[]Face interface ids

getStaticResolverKey​

function getStaticResolverKey() external pure returns (bytes32 staticResolverKey_)

Gets the static resolver key

Returns​

NameTypeDescription
staticResolverKey_bytes32Static resolver key

getTotalActiveAmortizationIds​

function getTotalActiveAmortizationIds() external view returns (uint256)

Retrieves the total number of non-cancelled amortizations.

Returns​

NameTypeDescription
_0uint256The total count of active (non-cancelled) amortization IDs.

getTotalAmortizationActiveHolders​

function getTotalAmortizationActiveHolders(uint256 _amortizationID) external view returns (uint256)

Retrieves the total number of token holders that still have an active hold for a given amortization.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.

Returns​

NameTypeDescription
_0uint256The total count of holders with an active hold.

getTotalAmortizationHolders​

function getTotalAmortizationHolders(uint256 _amortizationID) external view returns (uint256)

Retrieves the total number of amortization holders for a specific amortization ID.

It is the list of token holders at the snapshot taken at the record date.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.

Returns​

NameTypeDescription
_0uint256The total number of amortization holders.

getTotalHoldByAmortizationId​

function getTotalHoldByAmortizationId(uint256 _amortizationID) external view returns (uint256)

Retrieves the total amount of tokens locked in holds for a given amortization.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.

Returns​

NameTypeDescription
_0uint256The total token amount held across all active holds for this amortization.

initializeAmortization​

function initializeAmortization() external nonpayable

Initialises the amortization capability on the token.

Registers the amortization facet as ready and can only be executed once by an admin.

isAmortizationHoldAccountingMigrationPending​

function isAmortizationHoldAccountingMigrationPending(uint256 _amortizationID) external view returns (bool)

Reports whether an amortization corporate action still needs migrateAmortizationHoldAccounting to be called for it.

Backed by the same raw-LABAF-read helper as the idempotency guard on the migration writer, depending only on labafByAmortizationId == 0 — never on totalHoldByAmortizationId. No role gate, matching the read-only nature of getTotalHoldByAmortizationId.

Parameters​

NameTypeDescription
_amortizationIDuint256The one-based identifier of the amortization to inspect.

Returns​

NameTypeDescription
_0boolTrue if the raw labafByAmortizationId is still 0 (never migrated and never regularly synced); false otherwise.

migrateAmortizationHoldAccounting​

function migrateAmortizationHoldAccounting(uint256 _amortizationID, uint256 _total, uint256 _labaf) external nonpayable

One-time, admin-gated repair that seeds totalHoldByAmortizationId and labafByAmortizationId for an amortization corporate action that accumulated holds before LABAF tracking existed on this aggregate.

Restricted to DEFAULT_ADMIN_ROLE; carries no onlyOperational, onlyActivated, or onlyUnpaused gate so it can repair state while the token is paused.

Parameters​

NameTypeDescription
_amortizationIDuint256The one-based identifier of the amortization to migrate.
_totaluint256The raw totalHoldByAmortizationId value to seed (no lower bound, 0 is valid; MUST NOT exceed the token's current totalSupply()).
_labafuint256The raw labafByAmortizationId value to seed; must satisfy 0 < _labaf <= currentAbaf.

releaseAmortizationHold​

function releaseAmortizationHold(uint256 _amortizationID, address _tokenHolder) external nonpayable

Releases the active hold for a specific token holder in an amortization.

Releases a holder-specific amortization hold for a valid amortization action.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.
_tokenHolderaddressThe address of the token holder whose hold will be released.

setAmortization​

function setAmortization(IAmortization.Amortization _amortization) external nonpayable returns (bool success_, uint256 amortizationID_)

Parameters​

NameTypeDescription
_amortizationIAmortization.Amortizationundefined

Returns​

NameTypeDescription
success_boolundefined
amortizationID_uint256undefined

setAmortizationHold​

function setAmortizationHold(uint256 _amortizationID, address _tokenHolder, uint256 _tokenAmount) external nonpayable returns (uint256 holdId_)

Creates or replaces the hold for a specific token holder in an amortization.

Creates or updates a positive holder-specific hold for a valid amortization action.

Parameters​

NameTypeDescription
_amortizationIDuint256The ID of the amortization.
_tokenHolderaddressThe address of the token holder.
_tokenAmountuint256The number of tokens to lock in the hold.

Returns​

NameTypeDescription
holdId_uint256The ID of the newly created hold.

Events​

AmortizationCancelled​

event AmortizationCancelled(uint256 amortizationId, address indexed operator)

Emitted when an amortization is cancelled.

Parameters​

NameTypeDescription
amortizationIduint256Identifier of the cancelled amortization.
operator indexedaddressAddress that performed the cancellation.

AmortizationForceCancelled​

event AmortizationForceCancelled(uint256 amortizationId, address indexed operator)

Emitted when an admin force-cancels an amortization, bypassing date guards.

Parameters​

NameTypeDescription
amortizationIduint256Identifier of the force-cancelled amortization.
operator indexedaddressAddress that performed the force-cancellation.

AmortizationHoldAccountingMigrated​

event AmortizationHoldAccountingMigrated(bytes32 indexed corporateActionId, uint256 indexed amortizationID, uint256 previousTotal, uint256 previousLabaf, uint256 total, uint256 labaf)

Emitted when the pre-fix hold-accounting state of an amortization corporate action is seeded by migrateAmortizationHoldAccounting.

Carries both the pre-migration stored values and the newly seeded ones so the migration is self-contained for audit purposes.

Parameters​

NameTypeDescription
corporateActionId indexedbytes32Unique identifier grouping related corporate actions.
amortizationID indexeduint256Identifier of the migrated amortization.
previousTotaluint256The raw totalHoldByAmortizationId stored before migration.
previousLabafuint256The raw labafByAmortizationId stored before migration (always 0).
totaluint256The totalHoldByAmortizationId seeded by this migration.
labafuint256The labafByAmortizationId seeded by this migration.

AmortizationHoldReleased​

event AmortizationHoldReleased(bytes32 indexed corporateActionId, uint256 indexed amortizationID, address indexed tokenHolder, uint256 holdId)

Emitted when a hold is released for a token holder in an amortization.

Parameters​

NameTypeDescription
corporateActionId indexedbytes32Unique identifier grouping related corporate actions.
amortizationID indexeduint256Identifier of the amortization.
tokenHolder indexedaddressAddress of the token holder whose hold was released.
holdIduint256ID of the released hold.

AmortizationHoldSet​

event AmortizationHoldSet(bytes32 indexed corporateActionId, uint256 indexed amortizationID, address indexed tokenHolder, uint256 holdId, uint256 tokenAmount)

Emitted when a hold is created or replaced for a token holder in an amortization.

Parameters​

NameTypeDescription
corporateActionId indexedbytes32Unique identifier grouping related corporate actions.
amortizationID indexeduint256Identifier of the amortization.
tokenHolder indexedaddressAddress of the token holder.
holdIduint256ID of the newly created hold.
tokenAmountuint256Amount of tokens locked in the hold.

AmortizationInitialized​

event AmortizationInitialized()

Emitted once when the amortization capability is initialised on a token.

Fires exclusively from initializeAmortization.

AmortizationSet​

event AmortizationSet(bytes32 corporateActionId, uint256 amortizationId, address indexed operator, uint256 recordDate, uint256 executionDate)

Emitted when an amortization is created or updated for a security.

Parameters​

NameTypeDescription
corporateActionIdbytes32Unique identifier grouping related corporate actions.
amortizationIduint256Identifier of the created or updated amortization.
operator indexedaddressAddress that performed the operation.
recordDateuint256Date at which token holder balances are snapshotted.
executionDateuint256Date at which the amortization payment is executed.

Transfer​

event Transfer(address indexed from, address indexed to, uint256 value)

Emitted whenever tokens move between accounts, are minted, or are burned.

Parameters​

NameTypeDescription
from indexedaddressSource account (zero address on mint).
to indexedaddressDestination account (zero address on burn).
valueuint256Amount of tokens transferred.

TransferByPartition​

event TransferByPartition(bytes32 indexed fromPartition, address operator, address indexed from, address indexed to, uint256 value, bytes data, bytes operatorData)

Emitted when tokens are transferred from one partition to another or within the same partition.

Parameters​

NameTypeDescription
fromPartition indexedbytes32Source partition.
operatoraddressAddress that initiated the transfer.
from indexedaddressToken holder whose balance decreased.
to indexedaddressRecipient whose balance increased.
valueuint256Token quantity transferred.
databytesCaller-supplied data.
operatorDatabytesOperator-supplied data.

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.

AmortizationAlreadyExecuted​

error AmortizationAlreadyExecuted(bytes32 corporateActionId, uint256 amortizationId)

Amortization execution failed because the amortization has already been executed.

Parameters​

NameTypeDescription
corporateActionIdbytes32The corporate action ID of the already-executed amortization.
amortizationIduint256The amortization ID that was already executed.

AmortizationCreationFailed​

error AmortizationCreationFailed()

Amortization creation failed due to an internal failure.

AmortizationHasActiveHolds​

error AmortizationHasActiveHolds(bytes32 corporateActionId, uint256 amortizationID)

Thrown when attempting to cancel an amortization that still has active holds.

Parameters​

NameTypeDescription
corporateActionIdbytes32The corporate action ID of the amortization.
amortizationIDuint256The amortization ID that still has pending holds.

AmortizationHoldAccountingAlreadyMigrated​

error AmortizationHoldAccountingAlreadyMigrated(bytes32 corporateActionId, uint256 amortizationID)

Thrown by migrateAmortizationHoldAccounting when the target amortization's raw, non-defaulted labafByAmortizationId is already non-zero.

The migration is a one-time contingency, not a setter; a non-zero raw LABAF means the amortization was already migrated or has already gone through a regular sync.

Parameters​

NameTypeDescription
corporateActionIdbytes32Unique identifier grouping related corporate actions.
amortizationIDuint256The amortization ID that was already migrated.

AmortizationHoldFailed​

error AmortizationHoldFailed(bytes32 corporateActionId, uint256 amortizationID)

Thrown when creating a hold for an amortization fails.

Parameters​

NameTypeDescription
corporateActionIdbytes32The corporate action ID of the amortization.
amortizationIDuint256The amortization ID for which hold creation failed.

AmortizationHoldNotActive​

error AmortizationHoldNotActive(bytes32 corporateActionId, uint256 amortizationID, address tokenHolder)

Thrown when attempting to release a hold that is not active for the given holder.

Parameters​

NameTypeDescription
corporateActionIdbytes32The corporate action ID of the amortization.
amortizationIDuint256The amortization ID.
tokenHolderaddressThe address of the token holder with no active hold.

AmortizationMigrationLabafAboveAbaf​

error AmortizationMigrationLabafAboveAbaf(uint256 amortizationID, uint256 labaf, uint256 abaf)

Thrown by migrateAmortizationHoldAccounting when _labaf exceeds the current ABAF.

A _labaf above the current ABAF would truncate abaf / labaf to 0 on the next sync.

Parameters​

NameTypeDescription
amortizationIDuint256The amortization ID being migrated.
labafuint256The invalid, out-of-range _labaf supplied by the caller.
abafuint256The current ABAF the supplied _labaf was compared against.

AmortizationMigrationTotalAboveSupply​

error AmortizationMigrationTotalAboveSupply(uint256 amortizationID, uint256 total, uint256 totalSupply)

Thrown by migrateAmortizationHoldAccounting when _total exceeds the token's current total supply.

_An unbounded _total would eventually overflow the checked total _= factor arithmetic on the next resync, permanently bricking amortization hold operations (including release) for that corporate action, since the migration is one-shot.*

Parameters​

NameTypeDescription
amortizationIDuint256The amortization ID being migrated.
totaluint256The invalid, out-of-range _total supplied by the caller.
totalSupplyuint256The current total supply that _total was compared against.

AmortizationNotActive​

error AmortizationNotActive(bytes32 corporateActionId, uint256 amortizationID)

Thrown when attempting to operate on a cancelled amortization.

Parameters​

NameTypeDescription
corporateActionIdbytes32The corporate action ID of the amortization.
amortizationIDuint256The amortization ID.

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.

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.

InvalidAmortizationHoldAmount​

error InvalidAmortizationHoldAmount(uint256 amortizationID)

Thrown when attempting to set a hold with a zero token amount.

Parameters​

NameTypeDescription
amortizationIDuint256The amortization ID.

InvalidAmortizationMigrationLabaf​

error InvalidAmortizationMigrationLabaf(uint256 amortizationID)

Thrown by migrateAmortizationHoldAccounting when _labaf is 0.

A zero _labaf would recreate the very "never held" ambiguity this migration exists to resolve, since the getter defaults a raw 0 to 1 via zeroToOne.

Parameters​

NameTypeDescription
amortizationIDuint256The amortization ID being migrated.

InvalidPartition​

error InvalidPartition(address account, bytes32 partition)

Thrown when an account does not hold or is not associated with the specified partition.

Parameters​

NameTypeDescription
accountaddressAddress that was checked.
partitionbytes32Partition that was not found for the account.

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

NotAllowedInMultiPartitionMode​

error NotAllowedInMultiPartitionMode()

Thrown when a single-partition operation is attempted on a multi-partition token.

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.

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.

WrongDates​

error WrongDates(uint256 firstDate, uint256 secondDate)

Reverts when two date values fail their required ordering constraint.

The expected relationship between both dates is defined by the caller's validation context.

Parameters​

NameTypeDescription
firstDateuint256First date participating in the failed comparison.
secondDateuint256Second date participating in the failed comparison.

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.