LoansPortfolio
Asset Tokenization Studio Team
LoansPortfolio
Abstract implementation of ILoansPortfolio.
Delegates persistence to LoansPortfolioStorageWrapper; writers are gated by ROLE_LOANS_PORTFOLIO_MANAGER plus the global activation, pause, and zero-address invariants enforced via Modifiers.
Methods
addHoldingsAsset
function addHoldingsAsset(ILoansPortfolio.HoldingsAsset _holdingsAsset) external nonpayable returns (bool success_)
Parameters
| Name | Type | Description |
|---|---|---|
| _holdingsAsset | ILoansPortfolio.HoldingsAsset | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| success_ | bool | undefined |
getDefaultedLoansRatio
function getDefaultedLoansRatio() external view returns (uint256 numerator_, uint256 denominator_)
Returns the defaulted-loans ratio as a numerator/denominator pair.
Returns
| Name | Type | Description |
|---|---|---|
| numerator_ | uint256 | Numerator of the defaulted-loans ratio. |
| denominator_ | uint256 | Denominator of the defaulted-loans ratio. |
getHoldingsAssetOwnership
function getHoldingsAssetOwnership(uint256 _pageIndex, uint256 _pageLength) external view returns (address[] assets_, uint256[] balances_)
Returns a paginated slice of holdings assets paired with the portfolio's current balance in each.
Parameters
| Name | Type | Description |
|---|---|---|
| _pageIndex | uint256 | Zero-based page index. |
| _pageLength | uint256 | Number of entries per page. |
Returns
| Name | Type | Description |
|---|---|---|
| assets_ | address[] | Slice of asset addresses for the requested page. |
| balances_ | uint256[] | Balances held by the portfolio for each entry in assets_. |
getHoldingsAssets
function getHoldingsAssets(uint256 _pageIndex, uint256 _pageLength) external view returns (address[] assets_)
Returns a paginated slice of every registered holdings asset address.
Parameters
| Name | Type | Description |
|---|---|---|
| _pageIndex | uint256 | Zero-based page index. |
| _pageLength | uint256 | Number of entries per page. |
Returns
| Name | Type | Description |
|---|---|---|
| assets_ | address[] | Slice of asset addresses for the requested page. |
getLoanHoldingsAssets
function getLoanHoldingsAssets(uint256 _pageIndex, uint256 _pageLength) external view returns (address[] assets_)
Returns a paginated slice of holdings assets whose type is LOAN.
Parameters
| Name | Type | Description |
|---|---|---|
| _pageIndex | uint256 | Zero-based page index. |
| _pageLength | uint256 | Number of entries per page. |
Returns
| Name | Type | Description |
|---|---|---|
| assets_ | address[] | Slice of loan-holdings addresses for the requested page. |
getLoansPortfolioData
function getLoansPortfolioData() external view returns (struct ILoansPortfolio.LoansPortfolioDetailsData loansPortfolioData_)
Returns the portfolio-level configuration captured at initialisation.
Returns
| Name | Type | Description |
|---|---|---|
| loansPortfolioData_ | ILoansPortfolio.LoansPortfolioDetailsData | The persisted portfolio configuration. |
getNonPerformingLoansRatio
function getNonPerformingLoansRatio() external view returns (uint256 numerator_, uint256 denominator_)
Returns the non-performing-loans ratio as a numerator/denominator pair.
Returns
| Name | Type | Description |
|---|---|---|
| numerator_ | uint256 | Numerator of the non-performing-loans ratio. |
| denominator_ | uint256 | Denominator of the non-performing-loans ratio. |
getNumberDefaultedLoans
function getNumberDefaultedLoans() external view returns (uint256 numberDefaultedLoans_)
Returns the count of loan holdings currently in default.
Returns
| Name | Type | Description |
|---|---|---|
| numberDefaultedLoans_ | uint256 | Count of defaulted loans. |
getNumberOfAssets
function getNumberOfAssets() external view returns (uint256 numberOfAssets_)
Returns the total number of registered holdings assets.
Returns
| Name | Type | Description |
|---|---|---|
| numberOfAssets_ | uint256 | Count of holdings assets. |
getNumberOfCash
function getNumberOfCash() external view returns (uint256 numberOfCash_)
Returns the count of holdings assets with type CASH.
Returns
| Name | Type | Description |
|---|---|---|
| numberOfCash_ | uint256 | Count of cash holdings. |
getNumberOfLoans
function getNumberOfLoans() external view returns (uint256 numberOfLoans_)
Returns the count of holdings assets with type LOAN.
Returns
| Name | Type | Description |
|---|---|---|
| numberOfLoans_ | uint256 | Count of loan holdings. |
getNumberOfNonPerformingLoans
function getNumberOfNonPerformingLoans() external view returns (uint256 numberOfNonPerformingLoans_)
Returns the count of loan holdings currently classified as non-performing.
Returns
| Name | Type | Description |
|---|---|---|
| numberOfNonPerformingLoans_ | uint256 | Count of non-performing loans. |
getNumberOfPerformingLoans
function getNumberOfPerformingLoans() external view returns (uint256 numberOfPerformingLoans_)
Returns the count of loan holdings currently classified as performing.
Returns
| Name | Type | Description |
|---|---|---|
| numberOfPerformingLoans_ | uint256 | Count of performing loans. |
getPerformingLoansRatio
function getPerformingLoansRatio() external view returns (uint256 numerator_, uint256 denominator_)
Returns the performing-loans ratio as a numerator/denominator pair.
Returns
| Name | Type | Description |
|---|---|---|
| numerator_ | uint256 | Numerator of the performing-loans ratio. |
| denominator_ | uint256 | Denominator of the performing-loans ratio. |
getSecuredLoansRatio
function getSecuredLoansRatio() external view returns (uint256 numerator_, uint256 denominator_)
Returns the secured-loans ratio as a numerator/denominator pair.
Pair semantics avoid loss-of-precision compared to a single fixed-point value.
Returns
| Name | Type | Description |
|---|---|---|
| numerator_ | uint256 | Numerator of the secured-loans ratio. |
| denominator_ | uint256 | Denominator of the secured-loans ratio. |
initializeLoansPortfolio
function initializeLoansPortfolio(ILoansPortfolio.LoansPortfolioDetailsData _loansPortfolioData) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| _loansPortfolioData | ILoansPortfolio.LoansPortfolioDetailsData | undefined |
loansPortfolioWithdraw
function loansPortfolioWithdraw(address _assetAddress, address _to, uint256 _amount) external nonpayable returns (bool success_)
Withdraws an amount from a holdings asset to an external recipient.
Parameters
| Name | Type | Description |
|---|---|---|
| _assetAddress | address | Holdings asset funds are drawn from. |
| _to | address | Recipient of the withdrawn amount. |
| _amount | uint256 | Amount to withdraw. |
Returns
| Name | Type | Description |
|---|---|---|
| success_ | bool | True when the withdrawal completed. |
notifyLoanHoldingsAssetUpdate
function notifyLoanHoldingsAssetUpdate(address _holdingsAssetAddress) external nonpayable returns (bool success_)
Broadcasts that the loan holdings asset's state has changed off-portfolio.
Pure notification path — does not mutate the underlying loan; merely emits LoanHoldingsAssetUpdated so indexers refresh their view.
Parameters
| Name | Type | Description |
|---|---|---|
| _holdingsAssetAddress | address | Address of the loan holdings asset that was updated. |
Returns
| Name | Type | Description |
|---|---|---|
| success_ | bool | True when the notification was accepted. |
removeHoldingsAsset
function removeHoldingsAsset(ILoansPortfolio.HoldingsAsset _holdingsAsset) external nonpayable returns (bool success_)
Parameters
| Name | Type | Description |
|---|---|---|
| _holdingsAsset | ILoansPortfolio.HoldingsAsset | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| success_ | bool | undefined |
Events
HoldingsAssetAdded
event HoldingsAssetAdded(ILoansPortfolio.HoldingsAsset holdingsAsset)
Emitted when a new holdings asset is added to the portfolio.
Parameters
| Name | Type | Description |
|---|---|---|
| holdingsAsset | ILoansPortfolio.HoldingsAsset | The asset descriptor that was registered. |
HoldingsAssetRemoved
event HoldingsAssetRemoved(ILoansPortfolio.HoldingsAsset holdingsAsset)
Emitted when an existing holdings asset is removed from the portfolio.
Parameters
| Name | Type | Description |
|---|---|---|
| holdingsAsset | ILoansPortfolio.HoldingsAsset | The asset descriptor that was removed. |
LoanHoldingsAssetUpdated
event LoanHoldingsAssetUpdated(address loanHoldingsAsset)
Emitted when a registered loan holdings asset notifies a state update.
Parameters
| Name | Type | Description |
|---|---|---|
| loanHoldingsAsset | address | Address of the loan whose state was advertised. |
LoansPortfolioInitialized
event LoansPortfolioInitialized(ILoansPortfolio.LoansPortfolioDetailsData loansPortfolioData)
Emitted once when the LoansPortfolio capability is initialised on a token.
Fires exclusively from initializeLoansPortfolio after the storage write succeeds.
Parameters
| Name | Type | Description |
|---|---|---|
| loansPortfolioData | ILoansPortfolio.LoansPortfolioDetailsData | undefined |
LoansPortfolioWithdrawn
event LoansPortfolioWithdrawn(address assetAddress, address to, uint256 amount)
Emitted when funds are withdrawn from a holdings asset to an external account.
Parameters
| Name | Type | Description |
|---|---|---|
| assetAddress | address | Address of the holdings asset funds were drawn from. |
| to | address | Recipient of the withdrawn amount. |
| amount | uint256 | Amount transferred to the recipient. |
Errors
AccountHasNoRole
error AccountHasNoRole(address account, bytes32 role)
Thrown when an account does not hold a required role.
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | The account that lacks the role. |
| role | bytes32 | The 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
| Name | Type | Description |
|---|---|---|
| configId | bytes32 | Resolver-proxy configuration whose operational status was checked. |
| versionId | uint256 | Configuration 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
| Name | Type | Description |
|---|---|---|
| facetId | bytes32 | Identifier of the offending facet. |
| lastVersion | uint256 | Last version recorded for that facet at the time of the check. |
HoldingAssetNotFound
error HoldingAssetNotFound(address assetAddress)
Thrown when looking up a holdings asset that has not been registered.
Parameters
| Name | Type | Description |
|---|---|---|
| assetAddress | address | Address of the asset that was not found. |
HoldingsAssetAlreadyExists
error HoldingsAssetAlreadyExists(address assetAddress)
Thrown when adding a holdings asset that is already registered.
Parameters
| Name | Type | Description |
|---|---|---|
| assetAddress | address | Address of the asset that is already present. |
HoldingsAssetTypeNotSupported
error HoldingsAssetTypeNotSupported(uint8 holdingsAssetType)
Thrown when a holdings asset declares a type outside the supported set.
Parameters
| Name | Type | Description |
|---|---|---|
| holdingsAssetType | uint8 | The unsupported HoldingsAssetType value (as uint8). |
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).
UnrecognizedResolverProxyVersion
error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)
Thrown when the provided proxy version does not match any BLR compatible standard.
Parameters
| Name | Type | Description |
|---|---|---|
| _resolverProxyVersion | bytes8 | proxy version that is not compatible with the BLR. |
WalletRecovered
error WalletRecovered()
Thrown when attempting to recover a wallet that has already been recovered.
ZeroAddressNotAllowed
error ZeroAddressNotAllowed()
Reverts when the zero address is supplied where it is not permitted.
Prevents invalid account, contract, or recipient references.
ZeroValue
error ZeroValue()
Thrown when a zero token amount is supplied to an operation that requires a positive value.