Skip to main content

NoteTokenVault

NoteTokenVault

NoteToken redemption

registry

contract Registry registry

poolRedeemDisabled

mapping(address => bool) poolRedeemDisabled

Pool redeem disabled value

poolTotalSOTRedeem

mapping(address => uint256) poolTotalSOTRedeem

Pool total SOT redeem

poolTotalJOTRedeem

mapping(address => uint256) poolTotalJOTRedeem

Pool total JOT redeem

poolUserRedeems

mapping(address => mapping(address => struct INoteTokenVault.UserOrder)) poolUserRedeems

Pool user redeem order

nonces

mapping(address => uint256) nonces

We include a nonce in every hashed message, and increment the nonce as part of a state-changing operation, so as to prevent replay attacks, i.e. the reuse of a signature.

epochBatchs

mapping(address => mapping(uint256 => mapping(uint256 => bool))) epochBatchs

epochPreDistributed

mapping(address => mapping(uint256 => bool)) epochPreDistributed

orderAllowed

modifier orderAllowed(address pool)

Checks if redeeming is allowed for a given pool.

Parameters

NameTypeDescription
pooladdressThe address of the pool to check.

_incrementNonce

function _incrementNonce(address account) internal

initialize

function initialize(contract Registry _registry) public

hasAllowedUID

function hasAllowedUID(address sender) public view returns (bool)

This function checks if the sender has an allowed UID.

Parameters

NameTypeDescription
senderaddressThe address of the user who is trying to access this functionality.

Return Values

NameTypeDescription
[0]boolbool Returns true if the sender has an allowed UID, false otherwise.

_validateRedeemParam

function _validateRedeemParam(struct INoteTokenVault.RedeemOrderParam redeemParam, bytes signature) internal view

Validates redeem parameters. The function checks if the user who called the function is authorized by verifying the signature against the hash of the parameters. It also ensures that the chain id matches with the current blockchain's chain id.

Parameters

NameTypeDescription
redeemParamstruct INoteTokenVault.RedeemOrderParamStructure containing information about the redeem order.
signaturebytesSignature provided by the user to confirm their identity.

redeemOrder

function redeemOrder(struct INoteTokenVault.RedeemOrderParam redeemParam, bytes signature) public

Redeems note tokens for JOT or SOT in a securitization pool

The caller must have allowed UID to redeem note tokens

Parameters

NameTypeDescription
redeemParamstruct INoteTokenVault.RedeemOrderParamStruct containing details about the redeem order
signaturebytesSignature of the redeem order by the user

preDistribute

function preDistribute(struct INoteTokenVault.EpochParam epochParam, address poolAddress, uint256 incomeAmount, uint256 capitalAmount, address[] noteTokenAddresses, uint256[] totalRedeemedNoteAmounts) public

This function is used to distribute income and capital from a pool.

The function requires that the caller has the BACKEND_ADMIN_ROLE role, that the epoch hasn't been pre-distributed yet for this pool, and that it doesn't cause MinFirstLoss to be exceeded.

Parameters

NameTypeDescription
epochParamstruct INoteTokenVault.EpochParamThe parameters of the epoch.
poolAddressaddressThe address of the pool.
incomeAmountuint256The amount of income to distribute.
capitalAmountuint256The amount of capital to distribute.
noteTokenAddressesaddress[]An array of addresses of the note tokens involved.
totalRedeemedNoteAmountsuint256[]An array of amounts of redeemed note tokens.

disburseAll

function disburseAll(struct INoteTokenVault.EpochParam epochParam, address noteTokenAddress, address[] toAddresses, uint256[] currencyAmounts, uint256[] redeemedNoteAmounts) public

This function allows backend admin to disburse tokens from vault. It requires that batchId does not exist in epochBatchs mapping, and noteTokenAddress must be either jot or sot token of the pool. If it's a jot token, update totalJOTRedeem for the pool and call onRedeem function from MintedNormalTGE contract. If it's a sot token, update totalSOTRedeem for the pool and call onRedeem function from MintedNormalTGE contract. After disbursement, subtract redeemed note amounts from user's redeem amount in poolUserRedeems mapping. Emits a DisburseOrder event with all relevant information.

Parameters

NameTypeDescription
epochParamstruct INoteTokenVault.EpochParamContains the pool address and epoch/batch id.
noteTokenAddressaddressAddress of the token to be disbursed.
toAddressesaddress[]Array of addresses where tokens will be sent.
currencyAmountsuint256[]Array of amounts in same order as toAddresses, representing how much each address receives.
redeemedNoteAmountsuint256[]Array of note amounts that were redeemed by users.

_validateCancelParam

function _validateCancelParam(struct INoteTokenVault.CancelOrderParam cancelParam, bytes signature) internal view

Validates cancel order parameters. Requires that the current block timestamp is less than or equal to the maxTimestamp in the cancelParam struct. Also checks if the signature matches the expected signer for this message.

Parameters

NameTypeDescription
cancelParamstruct INoteTokenVault.CancelOrderParamThe cancel order parameter containing information about the pool, note token address and maximum timestamp.
signaturebytesThe ECDSA signature of the user confirming their intent to cancel the order.

cancelOrder

function cancelOrder(struct INoteTokenVault.CancelOrderParam cancelParam, bytes signature) public

Cancels a note token redeem order for a user

The caller must have approved this contract to transfer their tokens

Parameters

NameTypeDescription
cancelParamstruct INoteTokenVault.CancelOrderParamParameters required for the cancellation of a note token redeem order
signaturebytesSignature proving that the caller is authorized to perform this action

setRedeemDisabled

function setRedeemDisabled(address pool, bool _redeemDisabled) public

Set whether a pool allows redeeming tokens

This function can only be called by backend admins

Parameters

NameTypeDescription
pooladdressThe address of the token pool
_redeemDisabledboolWhether to disable redemption for the pool

redeemDisabled

function redeemDisabled(address pool) public view returns (bool)

This function is used to check if the redemption of tokens in a specific pool is disabled.

Parameters

NameTypeDescription
pooladdressThe address of the token pool.

Return Values

NameTypeDescription
[0]boolbool Returns true if redemption is disabled, false otherwise.

totalJOTRedeem

function totalJOTRedeem(address pool) public view returns (uint256)

Returns the total amount of JOT tokens redeemed by a specific pool.

This information is stored in poolTotalJOTRedeem mapping.

Parameters

NameTypeDescription
pooladdressThe address of the pool to check for.

Return Values

NameTypeDescription
[0]uint256uint256 Total number of JOT tokens redeemed by the specified pool.

totalSOTRedeem

function totalSOTRedeem(address pool) public view returns (uint256)

Returns the total amount of SOT tokens redeemed from a specific pool.

Parameters

NameTypeDescription
pooladdressThe address of the token pool.

Return Values

NameTypeDescription
[0]uint256Total amount of SOT tokens redeemed from the specified pool.

userRedeemJOTOrder

function userRedeemJOTOrder(address pool, address usr) public view returns (uint256)

Returns the amount of JOT tokens that have been redeemed by a user from a specific pool.

Parameters

NameTypeDescription
pooladdressThe address of the pool where the user has made a redemption order.
usraddressThe address of the user who made the redemption order.

Return Values

NameTypeDescription
[0]uint256uint256 The amount of JOT tokens that have been redeemed by the user from the specific pool.

userRedeemSOTOrder

function userRedeemSOTOrder(address pool, address usr) public view returns (uint256)

Returns the amount of SOT tokens that have been redeemed by a user from a specific pool.

Parameters

NameTypeDescription
pooladdressThe address of the pool from which the user has redeemed their SOTs.
usraddressThe address of the user who has redeemed their SOTs.

Return Values

NameTypeDescription
[0]uint256uint256 Returns the amount of SOT tokens that have been redeemed by a user from a specific pool.

_isJotToken

function _isJotToken(address noteToken, address jotToken) internal pure returns (bool)

Checks if the given note token is equal to the given JOT token.

Parameters

NameTypeDescription
noteTokenaddressThe address of the note token.
jotTokenaddressThe address of the JOT token.

Return Values

NameTypeDescription
[0]boolbool Returns true if both tokens are identical, false otherwise.

_isSotToken

function _isSotToken(address noteToken, address sotToken) internal pure returns (bool)

Checks if the given note token and SOT (Sweepable Over-the-Counter) token are identical.

Parameters

NameTypeDescription
noteTokenaddressThe address of the note token to check.
sotTokenaddressThe address of the SOT token to check against.

Return Values

NameTypeDescription
[0]boolbool True if they're identical, otherwise false.