Skip to main content

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​

NameTypeDescription
_holdingsAssetILoansPortfolio.HoldingsAssetundefined

Returns​

NameTypeDescription
success_boolundefined

getDefaultedLoansRatio​

function getDefaultedLoansRatio() external view returns (uint256 numerator_, uint256 denominator_)

Returns the defaulted-loans ratio as a numerator/denominator pair.

Returns​

NameTypeDescription
numerator_uint256Numerator of the defaulted-loans ratio.
denominator_uint256Denominator 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​

NameTypeDescription
_pageIndexuint256Zero-based page index.
_pageLengthuint256Number of entries per page.

Returns​

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

NameTypeDescription
_pageIndexuint256Zero-based page index.
_pageLengthuint256Number of entries per page.

Returns​

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

NameTypeDescription
_pageIndexuint256Zero-based page index.
_pageLengthuint256Number of entries per page.

Returns​

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

NameTypeDescription
loansPortfolioData_ILoansPortfolio.LoansPortfolioDetailsDataThe 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​

NameTypeDescription
numerator_uint256Numerator of the non-performing-loans ratio.
denominator_uint256Denominator of the non-performing-loans ratio.

getNumberDefaultedLoans​

function getNumberDefaultedLoans() external view returns (uint256 numberDefaultedLoans_)

Returns the count of loan holdings currently in default.

Returns​

NameTypeDescription
numberDefaultedLoans_uint256Count of defaulted loans.

getNumberOfAssets​

function getNumberOfAssets() external view returns (uint256 numberOfAssets_)

Returns the total number of registered holdings assets.

Returns​

NameTypeDescription
numberOfAssets_uint256Count of holdings assets.

getNumberOfCash​

function getNumberOfCash() external view returns (uint256 numberOfCash_)

Returns the count of holdings assets with type CASH.

Returns​

NameTypeDescription
numberOfCash_uint256Count of cash holdings.

getNumberOfLoans​

function getNumberOfLoans() external view returns (uint256 numberOfLoans_)

Returns the count of holdings assets with type LOAN.

Returns​

NameTypeDescription
numberOfLoans_uint256Count of loan holdings.

getNumberOfNonPerformingLoans​

function getNumberOfNonPerformingLoans() external view returns (uint256 numberOfNonPerformingLoans_)

Returns the count of loan holdings currently classified as non-performing.

Returns​

NameTypeDescription
numberOfNonPerformingLoans_uint256Count of non-performing loans.

getNumberOfPerformingLoans​

function getNumberOfPerformingLoans() external view returns (uint256 numberOfPerformingLoans_)

Returns the count of loan holdings currently classified as performing.

Returns​

NameTypeDescription
numberOfPerformingLoans_uint256Count of performing loans.

getPerformingLoansRatio​

function getPerformingLoansRatio() external view returns (uint256 numerator_, uint256 denominator_)

Returns the performing-loans ratio as a numerator/denominator pair.

Returns​

NameTypeDescription
numerator_uint256Numerator of the performing-loans ratio.
denominator_uint256Denominator 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​

NameTypeDescription
numerator_uint256Numerator of the secured-loans ratio.
denominator_uint256Denominator of the secured-loans ratio.

initializeLoansPortfolio​

function initializeLoansPortfolio(ILoansPortfolio.LoansPortfolioDetailsData _loansPortfolioData) external nonpayable

Parameters​

NameTypeDescription
_loansPortfolioDataILoansPortfolio.LoansPortfolioDetailsDataundefined

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​

NameTypeDescription
_assetAddressaddressHoldings asset funds are drawn from.
_toaddressRecipient of the withdrawn amount.
_amountuint256Amount to withdraw.

Returns​

NameTypeDescription
success_boolTrue 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​

NameTypeDescription
_holdingsAssetAddressaddressAddress of the loan holdings asset that was updated.

Returns​

NameTypeDescription
success_boolTrue when the notification was accepted.

removeHoldingsAsset​

function removeHoldingsAsset(ILoansPortfolio.HoldingsAsset _holdingsAsset) external nonpayable returns (bool success_)

Parameters​

NameTypeDescription
_holdingsAssetILoansPortfolio.HoldingsAssetundefined

Returns​

NameTypeDescription
success_boolundefined

Events​

HoldingsAssetAdded​

event HoldingsAssetAdded(ILoansPortfolio.HoldingsAsset holdingsAsset)

Emitted when a new holdings asset is added to the portfolio.

Parameters​

NameTypeDescription
holdingsAssetILoansPortfolio.HoldingsAssetThe asset descriptor that was registered.

HoldingsAssetRemoved​

event HoldingsAssetRemoved(ILoansPortfolio.HoldingsAsset holdingsAsset)

Emitted when an existing holdings asset is removed from the portfolio.

Parameters​

NameTypeDescription
holdingsAssetILoansPortfolio.HoldingsAssetThe asset descriptor that was removed.

LoanHoldingsAssetUpdated​

event LoanHoldingsAssetUpdated(address loanHoldingsAsset)

Emitted when a registered loan holdings asset notifies a state update.

Parameters​

NameTypeDescription
loanHoldingsAssetaddressAddress 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​

NameTypeDescription
loansPortfolioDataILoansPortfolio.LoansPortfolioDetailsDataundefined

LoansPortfolioWithdrawn​

event LoansPortfolioWithdrawn(address assetAddress, address to, uint256 amount)

Emitted when funds are withdrawn from a holdings asset to an external account.

Parameters​

NameTypeDescription
assetAddressaddressAddress of the holdings asset funds were drawn from.
toaddressRecipient of the withdrawn amount.
amountuint256Amount transferred to the recipient.

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.

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.

HoldingAssetNotFound​

error HoldingAssetNotFound(address assetAddress)

Thrown when looking up a holdings asset that has not been registered.

Parameters​

NameTypeDescription
assetAddressaddressAddress of the asset that was not found.

HoldingsAssetAlreadyExists​

error HoldingsAssetAlreadyExists(address assetAddress)

Thrown when adding a holdings asset that is already registered.

Parameters​

NameTypeDescription
assetAddressaddressAddress 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​

NameTypeDescription
holdingsAssetTypeuint8The 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​

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.

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.