Skip to main content

PoolAssetLogic

PoolAssetLogic

Provides pool's asset related functions

ExportNFTAsset

event ExportNFTAsset(address tokenAddress, address toPoolAddress, uint256[] tokenIds)

WithdrawNFTAsset

event WithdrawNFTAsset(address[] tokenAddresses, uint256[] tokenIds, address[] recipients)

UpdateOpeningBlockTimestamp

event UpdateOpeningBlockTimestamp(uint256 newTimestamp)

CollectNFTAsset

event CollectNFTAsset(uint256[] tokenIds, uint256 expectedAssetsValue)

CollectERC20Asset

event CollectERC20Asset(address token, uint256 currentBalance)

WithdrawERC20Asset

event WithdrawERC20Asset(address[] tokenAddresses, address[] recipients, uint256[] amounts)

SetRiskScore

event SetRiskScore(struct DataTypes.RiskScore[] riskscores)

setupRiskScores

function setupRiskScores(struct DataTypes.Storage _poolStorage, uint32[] _daysPastDues, uint32[] _ratesAndDefaults, uint32[] _periodsAndWriteOffs) external

This function sets up risk scores for securitization pool. It requires that the input arrays are sorted and have equal lengths, where each element of one array corresponds to an index in the other two arrays. The function also emits a 'SetRiskScore' event with the new risk scores as parameter.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.Storagestorage object for pool details
_daysPastDuesuint32[]array of days past due periods
_ratesAndDefaultsuint32[]array of rates and defaults corresponding to each day past due period
_periodsAndWriteOffsuint32[]array of periods and write offs corresponding to each day past due period

exportAssets

function exportAssets(struct DataTypes.NFTAsset[] _nftAssets, address tokenAddress, address toPoolAddress, uint256[] tokenIds) external

This function exports NFT assets from the pool to another address.

Parameters

NameTypeDescription
_nftAssetsstruct DataTypes.NFTAsset[]The array of NFT assets in the pool.
tokenAddressaddressThe address of the ERC721 token contract.
toPoolAddressaddressThe address where the assets will be transferred to.
tokenIdsuint256[]The IDs of the tokens that are being exported from the pool.

withdrawAssets

function withdrawAssets(struct DataTypes.NFTAsset[] _nftAssets, address[] tokenAddresses, uint256[] tokenIds, address[] recipients) external

This function allows users to withdraw their NFT assets from the pool.

Parameters

NameTypeDescription
_nftAssetsstruct DataTypes.NFTAsset[]The array of NFT assets in the pool.
tokenAddressesaddress[]The addresses of the tokens that represent the NFTs.
tokenIdsuint256[]The IDs of the NFTs to be withdrawn.
recipientsaddress[]The addresses of the users who will receive the NFTs.

getLoansValue

function getLoansValue(struct DataTypes.Storage _poolStorage, uint256[] tokenIds, struct DataTypes.LoanEntry[] loanEntries) external view returns (uint256 expectedAssetsValue, uint256[] expectedAssetValues)

Calculates the total value of loans and individual loan values.

The function calculates the expected asset value based on the provided loan entries for each tokenId. It also returns an array with the calculated values for each tokenId.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StoragePool storage object.
tokenIdsuint256[]Array of token IDs.
loanEntriesstruct DataTypes.LoanEntry[]Array of loan entries corresponding to the token IDs.

Return Values

NameTypeDescription
expectedAssetsValueuint256Total value of all loans.
expectedAssetValuesuint256[]Array with individual loan values for each tokenId.

collectAssets

function collectAssets(struct DataTypes.Storage _poolStorage, uint256[] tokenIds, struct DataTypes.LoanEntry[] loanEntries) external returns (uint256)

This function collects NFT assets from users and adds them to the pool. It also updates the pool's NAV (Net Asset Value).

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage of the pool.
tokenIdsuint256[]An array of token IDs representing the NFT assets being collected.
loanEntriesstruct DataTypes.LoanEntry[]An array of LoanEntry structs containing information about each loan.

Return Values

NameTypeDescription
[0]uint256expectedAssetsValue The total value of the collected assets.

setUpOpeningBlockTimestamp

function setUpOpeningBlockTimestamp(struct DataTypes.Storage _poolStorage) public

This function sets up the opening block timestamp for a pool.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object of the pool.

_setOpeningBlockTimestamp

function _setOpeningBlockTimestamp(struct DataTypes.Storage _poolStorage, uint64 _openingBlockTimestamp) internal

This function sets the opening block timestamp.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage of the pool.
_openingBlockTimestampuint64The new opening block timestamp.