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