Skip to main content

Pool

Pool

Tranched pool where credit investors can participate in specific credit investment opportunities.

registry

contract Registry registry

InsertNFTAsset

event InsertNFTAsset(address token, uint256 tokenId)

Repay

event Repay(address poolAddress, uint256 increaseInterestRepay, uint256 increasePrincipalRepay, uint256 timestamp)

requirePoolAdminOrOwner

modifier requirePoolAdminOrOwner()

initialize

function initialize(address _registryAddress, bytes params) public

CONSTRUCTOR

tgeAddress

function tgeAddress() public view returns (address)

Returns the address of the TGE contract.

Return Values

NameTypeDescription
[0]addressThe address of the TGE contract.

getNFTAssetsLength

function getNFTAssetsLength() external view returns (uint256)

This function returns the length of nftAssets array.

Return Values

NameTypeDescription
[0]uint256The number of elements in the _poolStorage.nftAssets array.

getRiskScoresLength

function getRiskScoresLength() external view returns (uint256)

Riks scores length

Return Values

NameTypeDescription
[0]uint256the length of the risk scores array

riskScores

function riskScores(uint256 index) external view returns (struct DataTypes.RiskScore)

Returns the risk score of a specific pool index

This function allows users to get the risk scores of pools.

Parameters

NameTypeDescription
indexuint256The index of the pool in the array

Return Values

NameTypeDescription
[0]struct DataTypes.RiskScoreA struct containing the risk score details

nftAssets

function nftAssets(uint256 idx) external view returns (struct DataTypes.NFTAsset)

Returns the details of the nft asset at the given index in the pool storage.

Parameters

NameTypeDescription
idxuint256The index of the NFT asset to fetch from the array.

Return Values

NameTypeDescription
[0]struct DataTypes.NFTAssetThe details of the requested NFT asset, including its token address and ID.

setupRiskScores

function setupRiskScores(uint32[] _daysPastDues, uint32[] _ratesAndDefaults, uint32[] _periodsAndWriteOffs) external

Setup risk scores for pool assets.

Parameters

NameTypeDescription
_daysPastDuesuint32[]An array of days past due values.
_ratesAndDefaultsuint32[]An array of rates and defaults values.
_periodsAndWriteOffsuint32[]An array of periods and write offs values.

exportAssets

function exportAssets(address tokenAddress, address toPoolAddress, uint256[] tokenIds) external

Export assets from pool to another address.

Parameters

NameTypeDescription
tokenAddressaddressThe address of the ERC721 token that is being exported.
toPoolAddressaddressThe address where the tokens will be sent.
tokenIdsuint256[]An array containing the IDs of the NFTs that are being exported.

withdrawAssets

function withdrawAssets(address[] tokenAddresses, uint256[] tokenIds, address[] recipients) external

Withdraws assets from the pool based on token addresses and IDs.

The caller must have OWNER_ROLE. The contract must not be paused.

Parameters

NameTypeDescription
tokenAddressesaddress[]Array of token addresses to withdraw.
tokenIdsuint256[]Array of token IDs to withdraw.
recipientsaddress[]Array of recipient addresses for the tokens.

getLoansValue

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

Returns the total value of loans based on tokenIds and loanEntries

Parameters

NameTypeDescription
tokenIdsuint256[]Array of token IDs
loanEntriesstruct DataTypes.LoanEntry[]Array of LoanEntry structs

Return Values

NameTypeDescription
[0]uint256uint256 Total value of loans
[1]uint256[]uint256[] Array of values for each tokenId in the same order as input array

collectAssets

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

Collects assets from loan entries for given tokenIds

Function can only be called by a registered loan kernel in the registry

Parameters

NameTypeDescription
tokenIdsuint256[]Array of token ids to collect assets for
loanEntriesstruct DataTypes.LoanEntry[]Array of LoanEntry structs containing details about loans

Return Values

NameTypeDescription
[0]uint256uint256 Returns total amount of collected assets

setUpOpeningBlockTimestamp

function setUpOpeningBlockTimestamp() external

This function sets up the opening block timestamp of the pool. Only the tge address can call this function.

onERC721Received

function onERC721Received(address, address, uint256 tokenId, bytes) external returns (bytes4)

Function called when a NFT is received by this contract. Requires that the sender be the Untangled loan asset token. Adds the received NFT to the pool's list of assets. Emits an event indicating the new NFT was added.

Parameters

NameTypeDescription
address
address
tokenIduint256The id of the token being transferred
bytes

Return Values

NameTypeDescription
[0]bytes4Returns the magic value 0x150b7a02 by convention.

writeOff

function writeOff(uint256 loan) public

Write off a specified amount of the pool's NAV.

This function is used to write off an amount from the pool's nav, essentially reducing it by that much. It also triggers the rebase function after writing off the loan.

Parameters

NameTypeDescription
loanuint256The amount to be written off in terms of the underlying asset.

repayLoan

function repayLoan(uint256[] loans, uint256[] amounts) external returns (uint256[], uint256[])

Repays a loan by the sender. The repayment amount and loan IDs are provided as inputs.

Only the LoanKernel can call this function.

Parameters

NameTypeDescription
loansuint256[]An array of loan IDs to be repaid.
amountsuint256[]An array of amounts to be repaid for each corresponding loan in loans.

Return Values

NameTypeDescription
[0]uint256[]Returns two arrays: - The first one contains the actual repayment amounts, which may differ from the requested ones due to liquidity restrictions or other factors. - The second one contains the previous debts before the repayments were made.
[1]uint256[]

getRepaidAmount

function getRepaidAmount() external view returns (uint256, uint256)

Returns the total principal and interest repaid by users in the pool.

Return Values

NameTypeDescription
[0]uint256The total principal repaid, the total interest repaid.
[1]uint256

debt

function debt(uint256 loan) external view returns (uint256 loanDebt)

Calculates the debt for a given loan.

Parameters

NameTypeDescription
loanuint256The ID of the loan to calculate the debt for.

Return Values

NameTypeDescription
loanDebtuint256The calculated debt amount.

risk

function risk(bytes32 nft_) external view returns (uint256 risk_)

This function returns the risk level of a specific NFT in the pool.

Parameters

NameTypeDescription
nft_bytes32The identifier of the NFT to check the risk level for.

Return Values

NameTypeDescription
risk_uint256The risk level of the specified NFT.

currentNAV

function currentNAV() external view returns (uint256 nav_)

Returns the current Net Asset Value (NAV) of the pool.

Return Values

NameTypeDescription
nav_uint256The current NAV of the pool.

currentNAVAsset

function currentNAVAsset(bytes32 tokenId) external view returns (uint256)

Returns the current NAV value of an asset.

Parameters

NameTypeDescription
tokenIdbytes32The ID of the asset to get the NAV for.

Return Values

NameTypeDescription
[0]uint256The current NAV value of the specified asset.

getReserves

function getReserves() external view returns (uint256, uint256)

Returns the current amount of income and capital reserves.

Return Values

NameTypeDescription
[0]uint256The current amount of income reserve.
[1]uint256The current amount of capital reserve.

futureValue

function futureValue(bytes32 nft_) external view returns (uint256)

This function allows to get the future value of an NFT in the pool.

Parameters

NameTypeDescription
nft_bytes32The identifier of the NFT.

Return Values

NameTypeDescription
[0]uint256Returns the future value of the NFT.

maturityDate

function maturityDate(bytes32 nft_) external view returns (uint256)

This function returns the maturity date of an NFT.

Parameters

NameTypeDescription
nft_bytes32The ID of the NFT for which we want to know the maturity date.

Return Values

NameTypeDescription
[0]uint256uint256 Returns the maturity date of the specified NFT.

discountRate

function discountRate() external view returns (uint256)

Returns the discount rate of the pool.

Return Values

NameTypeDescription
[0]uint256The current discount rate in basis points (bps).

updateAssetRiskScore

function updateAssetRiskScore(bytes32 nftID_, uint256 risk_) external

_Updates the risk score of an asset within the pool. The risk score is used by the PoolNAVLogic to determine the value of the asset relative to other assets in the pool. Requirements:

  • The caller must have the POOLADMIN_ROLE role.

Parameters

NameTypeDescription
nftID_bytes32ID of the NFT representing the asset within the pool.
risk_uint256New risk score for the asset.

getAsset

function getAsset(bytes32 agreementId) external view returns (struct DataTypes.NFTDetails)

Returns details about an NFT based on agreementId

Parameters

NameTypeDescription
agreementIdbytes32The ID of the agreement for which we want to get the asset details

Return Values

NameTypeDescription
[0]struct DataTypes.NFTDetailsAn instance of DataTypes.NFTDetails containing all relevant information about the NFT

setPot

function setPot(address _pot) external

This function sets the pot for the pool.

Parameters

NameTypeDescription
_potaddressThe address of the new pot.

setDebtCeiling

function setDebtCeiling(uint256 _debtCeiling) external

_Sets a new debt ceiling for the pool. Requirements:

  • The caller must be either the pool admin or owner.
  • The contract must not be paused._

Parameters

NameTypeDescription
_debtCeilinguint256The new value of the debt ceiling.

setMinFirstLossCushion

function setMinFirstLossCushion(uint32 _minFirstLossCushion) external

Set minimum first loss cushion for pool

Parameters

NameTypeDescription
_minFirstLossCushionuint32The new minimum first loss cushion value

pot

function pot() external view returns (address)

Returns the address of the pot contract.

Return Values

NameTypeDescription
[0]addressAddress of the pot contract.

increaseCapitalReserve

function increaseCapitalReserve(uint256 currencyAmount) external

Increases the capital reserve by a specified amount. Can only be called by the SecuritizationManager or NoteTokenVault.

Parameters

NameTypeDescription
currencyAmountuint256The amount of currency to increase the capital reserve by.

contributeToCapitalReserve

function contributeToCapitalReserve(uint256 amount) external

Contributes specified amount of tokens to capital reserve

The function is only callable when not paused

Parameters

NameTypeDescription
amountuint256Amount of tokens to contribute

decreaseIncomeReserve

function decreaseIncomeReserve(uint256 currencyAmount) external

Decreases the income reserve by a specified amount. Can only be called by the SecuritizationManager or DistributionOperator.

Parameters

NameTypeDescription
currencyAmountuint256The amount of currency to decrease the income reserve by.

decreaseCapitalReserve

function decreaseCapitalReserve(uint256 currencyAmount) external

Decreases capital reserve by a certain amount. Can only be called by SecuritizationManager or DistributionOperator.

Parameters

NameTypeDescription
currencyAmountuint256The amount of currency to decrease the capital reserve with.

secondTGEAddress

function secondTGEAddress() external view returns (address)

Returns the address of the second TGE contract.

Return Values

NameTypeDescription
[0]addressThe address of the second TGE contract.

sotToken

function sotToken() external view returns (address)

Returns the address of the SOT token.

Return Values

NameTypeDescription
[0]addressThe address of the SOT token.

jotToken

function jotToken() external view returns (address)

Returns the address of the JOT token used by this pool.

Return Values

NameTypeDescription
[0]addressThe address of the JOT token.

underlyingCurrency

function underlyingCurrency() external view returns (address)

Returns the address of the underlying currency used by the pool.

Return Values

NameTypeDescription
[0]addressThe address of the underlying currency contract.

reserve

function reserve() external view returns (uint256)

Returns the current amount of tokens in the pool.

Return Values

NameTypeDescription
[0]uint256The amount of tokens currently in the pool.

debtCeiling

function debtCeiling() external view returns (uint256)

Returns the current debt ceiling of the pool.

Return Values

NameTypeDescription
[0]uint256The current debt ceiling.

interestRateSOT

function interestRateSOT() external view returns (uint256)

Returns the current interest rate of SOT (Stable Over Time)

Return Values

NameTypeDescription
[0]uint256The current interest rate in uint256 format

setInterestRateSOT

function setInterestRateSOT(uint32 _newRate) external

Set new interest rate for SOT (Savings Over Time)

Parameters

NameTypeDescription
_newRateuint32New interest rate value

minFirstLossCushion

function minFirstLossCushion() external view returns (uint32)

Returns the minimum first loss cushion value set in the pool storage.

Return Values

NameTypeDescription
[0]uint32The current minimum first loss cushion value.

totalAssetRepaidCurrency

function totalAssetRepaidCurrency() external view returns (uint256)

Returns the total amount of repaid currency from all loans. This includes both principal and interest payments.

Return Values

NameTypeDescription
[0]uint256The total amount of repaid currency in the pool.

injectTGEAddress

function injectTGEAddress(address _tgeAddress, enum Configuration.NOTE_TOKEN_TYPE _noteToken) external

Function for injecting TGE address into pool storage

Parameters

NameTypeDescription
_tgeAddressaddressAddress of the TGE contract
_noteTokenenum Configuration.NOTE_TOKEN_TYPEType of note token to be used in securitization process

increaseTotalAssetRepaidCurrency

function increaseTotalAssetRepaidCurrency(uint256 amount) external

Increases total repaid currency by a specified amount.

This function can only be called by loan kernels. It increases the total repaid currency in the pool.

Parameters

NameTypeDescription
amountuint256The amount to increase the total repaid currency by.

disburse

function disburse(address usr, uint256 currencyAmount) external

Function for disbursement of funds from the pool to a user. Can only be called by NoteTokenVault contract.

Parameters

NameTypeDescription
usraddressThe address of the user to whom the funds will be sent.
currencyAmountuint256The amount of funds to be disbursed in wei.

hasFinishedRedemption

function hasFinishedRedemption() external view returns (bool)

checks if the redemption process has finished

isDebtCeilingValid

function isDebtCeilingValid() external view returns (bool)

check current debt ceiling is valid

claimCashRemain

function claimCashRemain(address recipientWallet) external

This function allows the owner of the contract to claim any remaining cash that has not been distributed yet.

The function requires that the redemption period has already finished and only the owner can call this function.

Parameters

NameTypeDescription
recipientWalletaddressAddress where the remaining cash will be sent.

openingBlockTimestamp

function openingBlockTimestamp() external view returns (uint64)

Returns the timestamp of when the pool was opened.

Return Values

NameTypeDescription
[0]uint64The timestamp of when the pool was opened.

withdraw

function withdraw(address to, uint256 amount) external

Function to withdraw funds from the pool.

Parameters

NameTypeDescription
toaddressAddress where the funds will be sent.
amountuint256Amount of tokens that will be withdrawn.

validatorRequired

function validatorRequired() external view returns (bool)

rebase

function rebase() public

Rebases the pool by updating the NAV and reserve based on current market conditions.

changeSeniorAsset

function changeSeniorAsset(uint256 _seniorSupply, uint256 _seniorRedeem) external

Function for changing senior asset parameters. Can only be called by SecuritizationManager or NoteTokenVault. Changes in supply/redemption of senior assets will trigger a rebase, which can lead to significant price changes. If the new senior supply is greater than zero, it checks if the first loss after this change would exceed MinFirstLoss.

Parameters

NameTypeDescription
_seniorSupplyuint256Amount of senior asset to be supplied.
_seniorRedeemuint256Amount of senior asset to be redeemed.

seniorDebtAndBalance

function seniorDebtAndBalance() external view returns (uint256, uint256)

Returns the senior debt and balance.

Return Values

NameTypeDescription
[0]uint256The total amount of senior debt.
[1]uint256The current balance of senior tokens.

calcTokenPrices

function calcTokenPrices() external view returns (uint256 juniorTokenPrice, uint256 seniorTokenPrice)

Calculates the prices for junior and senior tokens based on current NAV, reserve, senior debt etc.

Return Values

NameTypeDescription
juniorTokenPriceuint256The price of a junior token in terms of note tokens (1e18).
seniorTokenPriceuint256The price of a senior token in terms of note tokens (1e18).

calcJuniorRatio

function calcJuniorRatio() public view returns (uint256 juniorRatio)

Calculates the junior ratio of the pool.

Return Values

NameTypeDescription
juniorRatiouint256The calculated junior ratio.

isMinFirstLossValid

function isMinFirstLossValid() public view returns (bool)

Checks if the minimum first loss cushion is valid. The function checks whether the minimum first loss cushion is less than or equal to the calculated junior ratio.

Return Values

NameTypeDescription
[0]boolbool - Returns true if the minimum first loss cushion is less than or equal to the calculated junior ratio, otherwise false.