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
Name | Type | Description |
---|---|---|
[0] | address | The address of the TGE contract. |
getNFTAssetsLength
function getNFTAssetsLength() external view returns (uint256)
This function returns the length of nftAssets array.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The number of elements in the _poolStorage.nftAssets array. |
getRiskScoresLength
function getRiskScoresLength() external view returns (uint256)
Riks scores length
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | the 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
Name | Type | Description |
---|---|---|
index | uint256 | The index of the pool in the array |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct DataTypes.RiskScore | A 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
Name | Type | Description |
---|---|---|
idx | uint256 | The index of the NFT asset to fetch from the array. |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct DataTypes.NFTAsset | The 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
Name | Type | Description |
---|---|---|
_daysPastDues | uint32[] | An array of days past due values. |
_ratesAndDefaults | uint32[] | An array of rates and defaults values. |
_periodsAndWriteOffs | uint32[] | 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
Name | Type | Description |
---|---|---|
tokenAddress | address | The address of the ERC721 token that is being exported. |
toPoolAddress | address | The address where the tokens will be sent. |
tokenIds | uint256[] | 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
Name | Type | Description |
---|---|---|
tokenAddresses | address[] | Array of token addresses to withdraw. |
tokenIds | uint256[] | Array of token IDs to withdraw. |
recipients | address[] | 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
Name | Type | Description |
---|---|---|
tokenIds | uint256[] | Array of token IDs |
loanEntries | struct DataTypes.LoanEntry[] | Array of LoanEntry structs |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 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
Name | Type | Description |
---|---|---|
tokenIds | uint256[] | Array of token ids to collect assets for |
loanEntries | struct DataTypes.LoanEntry[] | Array of LoanEntry structs containing details about loans |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 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
Name | Type | Description |
---|---|---|
address | ||
address | ||
tokenId | uint256 | The id of the token being transferred |
bytes |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes4 | Returns 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
Name | Type | Description |
---|---|---|
loan | uint256 | The 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
Name | Type | Description |
---|---|---|
loans | uint256[] | An array of loan IDs to be repaid. |
amounts | uint256[] | An array of amounts to be repaid for each corresponding loan in loans . |
Return Values
Name | Type | Description |
---|---|---|
[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
Name | Type | Description |
---|---|---|
[0] | uint256 | The 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
Name | Type | Description |
---|---|---|
loan | uint256 | The ID of the loan to calculate the debt for. |
Return Values
Name | Type | Description |
---|---|---|
loanDebt | uint256 | The 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
Name | Type | Description |
---|---|---|
nft_ | bytes32 | The identifier of the NFT to check the risk level for. |
Return Values
Name | Type | Description |
---|---|---|
risk_ | uint256 | The 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
Name | Type | Description |
---|---|---|
nav_ | uint256 | The current NAV of the pool. |
currentNAVAsset
function currentNAVAsset(bytes32 tokenId) external view returns (uint256)
Returns the current NAV value of an asset.
Parameters
Name | Type | Description |
---|---|---|
tokenId | bytes32 | The ID of the asset to get the NAV for. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The 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
Name | Type | Description |
---|---|---|
[0] | uint256 | The current amount of income reserve. |
[1] | uint256 | The 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
Name | Type | Description |
---|---|---|
nft_ | bytes32 | The identifier of the NFT. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | Returns 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
Name | Type | Description |
---|---|---|
nft_ | bytes32 | The ID of the NFT for which we want to know the maturity date. |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 Returns the maturity date of the specified NFT. |
discountRate
function discountRate() external view returns (uint256)
Returns the discount rate of the pool.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The 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
Name | Type | Description |
---|---|---|
nftID_ | bytes32 | ID of the NFT representing the asset within the pool. |
risk_ | uint256 | New 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
Name | Type | Description |
---|---|---|
agreementId | bytes32 | The ID of the agreement for which we want to get the asset details |
Return Values
Name | Type | Description |
---|---|---|
[0] | struct DataTypes.NFTDetails | An 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
Name | Type | Description |
---|---|---|
_pot | address | The 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
Name | Type | Description |
---|---|---|
_debtCeiling | uint256 | The new value of the debt ceiling. |
setMinFirstLossCushion
function setMinFirstLossCushion(uint32 _minFirstLossCushion) external
Set minimum first loss cushion for pool
Parameters
Name | Type | Description |
---|---|---|
_minFirstLossCushion | uint32 | The new minimum first loss cushion value |
pot
function pot() external view returns (address)
Returns the address of the pot contract.
Return Values
Name | Type | Description |
---|---|---|
[0] | address | Address 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
Name | Type | Description |
---|---|---|
currencyAmount | uint256 | The 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
Name | Type | Description |
---|---|---|
amount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
currencyAmount | uint256 | The 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
Name | Type | Description |
---|---|---|
currencyAmount | uint256 | The 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
Name | Type | Description |
---|---|---|
[0] | address | The address of the second TGE contract. |
sotToken
function sotToken() external view returns (address)
Returns the address of the SOT token.
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The 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
Name | Type | Description |
---|---|---|
[0] | address | The 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
Name | Type | Description |
---|---|---|
[0] | address | The address of the underlying currency contract. |
reserve
function reserve() external view returns (uint256)
Returns the current amount of tokens in the pool.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The amount of tokens currently in the pool. |
debtCeiling
function debtCeiling() external view returns (uint256)
Returns the current debt ceiling of the pool.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The current debt ceiling. |
interestRateSOT
function interestRateSOT() external view returns (uint256)
Returns the current interest rate of SOT (Stable Over Time)
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The current interest rate in uint256 format |
setInterestRateSOT
function setInterestRateSOT(uint32 _newRate) external
Set new interest rate for SOT (Savings Over Time)
Parameters
Name | Type | Description |
---|---|---|
_newRate | uint32 | New interest rate value |
minFirstLossCushion
function minFirstLossCushion() external view returns (uint32)
Returns the minimum first loss cushion value set in the pool storage.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint32 | The 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
Name | Type | Description |
---|---|---|
[0] | uint256 | The 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
Name | Type | Description |
---|---|---|
_tgeAddress | address | Address of the TGE contract |
_noteToken | enum Configuration.NOTE_TOKEN_TYPE | Type 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
Name | Type | Description |
---|---|---|
amount | uint256 | The 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
Name | Type | Description |
---|---|---|
usr | address | The address of the user to whom the funds will be sent. |
currencyAmount | uint256 | The 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
Name | Type | Description |
---|---|---|
recipientWallet | address | Address 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
Name | Type | Description |
---|---|---|
[0] | uint64 | The timestamp of when the pool was opened. |
withdraw
function withdraw(address to, uint256 amount) external
Function to withdraw funds from the pool.
Parameters
Name | Type | Description |
---|---|---|
to | address | Address where the funds will be sent. |
amount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
_seniorSupply | uint256 | Amount of senior asset to be supplied. |
_seniorRedeem | uint256 | Amount of senior asset to be redeemed. |
seniorDebtAndBalance
function seniorDebtAndBalance() external view returns (uint256, uint256)
Returns the senior debt and balance.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The total amount of senior debt. |
[1] | uint256 | The 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
Name | Type | Description |
---|---|---|
juniorTokenPrice | uint256 | The price of a junior token in terms of note tokens (1e18). |
seniorTokenPrice | uint256 | The 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
Name | Type | Description |
---|---|---|
juniorRatio | uint256 | The 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
Name | Type | Description |
---|---|---|
[0] | bool | bool - Returns true if the minimum first loss cushion is less than or equal to the calculated junior ratio, otherwise false. |