Skip to main content

TGELogic

TGELogic

UpdateTGEAddress

event UpdateTGEAddress(address tge, enum Configuration.NOTE_TOKEN_TYPE noteType)

IncreaseReserve

event IncreaseReserve(uint256 increasingAmount, uint256 currencyAmount)

IncreaseCapitalReserve

event IncreaseCapitalReserve(uint256 increasingAmount, uint256 currencyAmount)

DecreaseReserve

event DecreaseReserve(uint256 decreasingAmount, uint256 currencyAmount)

DecreaseCapitalReserve

event DecreaseCapitalReserve(uint256 decreasingAmount, uint256 currencyAmount)

DecreaseIncomeReserve

event DecreaseIncomeReserve(uint256 decreasingAmount, uint256 currencyAmount)

UpdateDebtCeiling

event UpdateDebtCeiling(uint256 _debtCeiling)

UpdateMintFirstLoss

event UpdateMintFirstLoss(uint32 _mintFirstLoss)

UpdateInterestRateSot

event UpdateInterestRateSot(uint32 _interestRateSot)

Withdraw

event Withdraw(address originatorAddress, uint256 amount)

ClaimCashRemain

event ClaimCashRemain(address pot, address recipientWallet, uint256 balance)

sotToken

function sotToken(struct DataTypes.Storage _poolStorage) public view returns (address)

Returns the address of the SOT (Senior Obligation Token) for this pool.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object containing all data related to a specific pool.

Return Values

NameTypeDescription
[0]addressThe address of the SOT token, or zero if no TGE is set up yet.

jotToken

function jotToken(struct DataTypes.Storage _poolStorage) public view returns (address)

Returns the address of the JOT (Junior Obligation Token) for this pool.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object containing all data related to a specific pool.

Return Values

NameTypeDescription
[0]addressThe address of the JOT token, or zero if no TGE is set up yet.

underlyingCurrency

function underlyingCurrency(struct DataTypes.Storage _poolStorage) public view returns (address)

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

This information is stored in storage and can be accessed without any external calls.

Return Values

NameTypeDescription
[0]addressThe address of the underlying currency.

minFirstLossCushion

function minFirstLossCushion(struct DataTypes.Storage _poolStorage) public view returns (uint32)

Returns the value of the min first loss cushion used by the pool.

This information is stored in storage and can be accessed without any external calls.

Return Values

NameTypeDescription
[0]uint32the value of the min first loss cushion.

debtCeiling

function debtCeiling(struct DataTypes.Storage _poolStorage) public view returns (uint256)

Returns the current debt ceiling of the pool

The debt ceiling is the maximum amount that can be borrowed from the pool at any given time

Return Values

NameTypeDescription
[0]uint256The current debt ceiling value

interestRateSOT

function interestRateSOT(struct DataTypes.Storage _poolStorage) public view returns (uint256)

This function returns the interest rate of SOT

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.Storage- The storage object of the pool

Return Values

NameTypeDescription
[0]uint256uint256 - Returns the interestRateSOT value from the storage object

totalAssetRepaidCurrency

function totalAssetRepaidCurrency(struct DataTypes.Storage _poolStorage) public view returns (uint256)

Returns total amount of repaid assets in the pool.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object of the pool.

Return Values

NameTypeDescription
[0]uint256Total amount of repaid assets in the pool.

injectTGEAddress

function injectTGEAddress(struct DataTypes.Storage _poolStorage, address _tgeAddress, enum Configuration.NOTE_TOKEN_TYPE _noteType) external

This function is used to inject TGE address and token into pool storage.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage of securitization pool.
_tgeAddressaddressAddress of TGE contract.
_noteTypeenum Configuration.NOTE_TOKEN_TYPEType of note (SENIOR or JUNIOR).

disburse

function disburse(struct DataTypes.Storage _poolStorage, address usr, uint256 currencyAmount) external

This function transfers specified amount of currency from pool's pot to user address.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object for the pool.
usraddressThe address that will receive the funds.
currencyAmountuint256The amount of currency to transfer.

isDebtCeilingValid

function isDebtCeilingValid(struct DataTypes.Storage _poolStorage) public view returns (bool)

This function checks if the total amount of debt raised by both TGE contracts doesn't exceed the pool's debt ceiling.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object for the pool.

Return Values

NameTypeDescription
[0]boolReturns true if the totalDebt is less than or equal to the debtCeiling, false otherwise.

increaseTotalAssetRepaidCurrency

function increaseTotalAssetRepaidCurrency(struct DataTypes.Storage _poolStorage, uint256 amount) external

Increase total repaid currency by specific amount.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object for pool data.
amountuint256Amount to increase the total repaid currency with.

hasFinishedRedemption

function hasFinishedRedemption(struct DataTypes.Storage _poolStorage) public view returns (bool)

Checks whether the redemptions of both Senior and Junior tokens have finished.

The function requires that both SOT and JOT tokens must not have any supply left.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StoragePool storage object to check from.

Return Values

NameTypeDescription
[0]boolReturns true if all redemptions are complete, false otherwise.

setPot

function setPot(struct DataTypes.Storage _poolStorage, address _pot) external

This function sets the pot address for the securitization pool. It also checks if the new pot is this contract and approves it to spend all underlying currency tokens on behalf of the pool.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object of the securitization pool.
_potaddressThe address of the new pot.

setMinFirstLossCushion

function setMinFirstLossCushion(struct DataTypes.Storage _poolStorage, uint32 _minFirstLossCushion) external

Set the minimum first loss cushion.

This function sets the minimum first loss cushion in the pool storage.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage of the pool to set the minimum first loss cushion for.
_minFirstLossCushionuint32The new minimum first loss cushion value.

_setMinFirstLossCushion

function _setMinFirstLossCushion(struct DataTypes.Storage _poolStorage, uint32 _minFirstLossCushion) internal

Set minimum first loss cushion value

The minFirstLossCushion must not exceed 100% (i.e., 100 * RATE_SCALING_FACTOR)

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.Storagestorage of the pool
_minFirstLossCushionuint32minimum first loss cushion value to be set

setDebtCeiling

function setDebtCeiling(struct DataTypes.Storage _poolStorage, uint256 _debtCeiling) external

Sets the debt ceiling of a pool.

This function sets the maximum amount that can be borrowed from the pool.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object for the pool.
_debtCeilinguint256The new value for the debt ceiling.

_setDebtCeiling

function _setDebtCeiling(struct DataTypes.Storage _poolStorage, uint256 _debtCeiling) internal

Setter for debt ceiling in pool storage

Sets a new value for the debt ceiling of the pool

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StoragePool's storage object
_debtCeilinguint256New value to set as the debt ceiling

_setInterestRateSOT

function _setInterestRateSOT(struct DataTypes.Storage _poolStorage, uint32 _newRate) external

This function sets the interest rate for SOT.

It updates the 'interestRateSOT' in storage and emits an event to notify about the change.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.Storage
_newRateuint32The new value of the interest rate.

increaseCapitalReserve

function increaseCapitalReserve(struct DataTypes.Storage _poolStorage, uint256 currencyAmount) public

This function increases the capital reserve by a certain amount.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object for the pool.
currencyAmountuint256The amount to increase the capital reserve by.

contributeToCapitalReserve

function contributeToCapitalReserve(struct DataTypes.Storage _poolStorage, address contributor, uint256 currencyAmount) external

This function allows a contributor to contribute capital into the pool. The amount of currency is transferred from the contributor's address to the pool's pot, and then increases the total capital reserve.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageA reference to the storage object for this pool.
contributoraddressThe address of the contributor.
currencyAmountuint256The amount of currency contributed by the contributor.

decreaseCapitalReserve

function decreaseCapitalReserve(struct DataTypes.Storage _poolStorage, uint256 currencyAmount) external

This function decreases the capital reserve by a certain amount. Requires that there is sufficient balance of capital reserve. Emits an event DecreaseCapitalReserve with the decreased amount and new total after decrease.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object for the pool.
currencyAmountuint256The amount to decrease the capital reserve by.

decreaseIncomeReserve

function decreaseIncomeReserve(struct DataTypes.Storage _poolStorage, uint256 currencyAmount) external

Decreases the income reserve by a certain amount. Requires that there is enough balance in the income reserve to decrease it by the specified amount. Emits an event indicating the decreased amount and the new total income reserve.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object of the pool.
currencyAmountuint256The amount to be decreased from the income reserve.

claimCashRemain

function claimCashRemain(struct DataTypes.Storage _poolStorage, address recipientWallet) external

This function allows the owner of the pool to transfer any remaining funds from the pot to another address after the pool have been closed.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object for the securitization pool.
recipientWalletaddressThe address that will receive the transferred funds.

withdraw

function withdraw(struct DataTypes.Storage _poolStorage, address to, uint256 amount) public

Function to withdraw funds from the capital reserve of a securitization pool. Requires that there are sufficient funds in the capital reserve. Emits an event indicating the amount withdrawn and remaining balance.

Parameters

NameTypeDescription
_poolStoragestruct DataTypes.StorageThe storage object for this securitization pool.
toaddressThe address to send the withdrawal to.
amountuint256The amount of underlying currency to withdraw.