Voucher
Function definitions, parameter descriptions, and use cases of the APIs of IcToken smart contract.
mint
Function Definition
Input Parameters
Parameter | Type | Note |
term | uint64 | Release term: One-time release type: fixed at 0; Linear and Staged release type: duration in seconds from start to end of release |
amount | uint256 | Amount of assets (ERC20) to be locked up |
maturities | uint64[] | Timestamp of each release time node |
percentages | uint32[] | Release percentage of each release time node |
originalInvestor | string | Note indicating the original invester |
Note:
Lengths of maturities and percentages must be equal;
The precision of the release percentage is 0.01% (i.e., a value of 10000 means 100%). Thus, the sum of all elements of percentages must be equal to 10000;
For Staged release type, the value of term must be equal to the time difference between the first and the last release time node;
The corresponding ERC20 token should be approved to the IcToken contract before mint.
Output Parameters
Parameter | Type | Note |
slot | uint256 | Slot of the minted Voucher |
tokenId | uint256 | Id of the minted Voucher |
Use Cases
Use Cases in Solidity
Linear Release Type
One-time Release Type
Staged Release Type
Use Cases with ethers.js
Linear Release Type
One-time Release Type
Staged Release Type
claim
Function Definition
Claim specified amount of assets of target Voucher.
Input Parameters
Parameter | Type | Note |
tokenId | uint256 | Id of the Voucher to claim |
amount | uint256 | Amount of assets (ERC20) to claim |
Use Cases
Use Cases in Solidity
Use Cases with ethers.js
claimAll
Claim All underlying assets of target Voucher.
Function Definition
Input Parameters
Parameter | Type | Note |
tokenId | uint256 | Id of the Voucher to claim |
Use Cases
Use Cases in Solidity
Use Cases with ethers.js
claimableAmount
Function Definition
Query the released amount of the underlying assets.
Input Parameters
Parameter | Type | Note |
tokenId | uint256 | Id of the Voucher to query |
Output Parameters
Parameter | Type | Note |
claimableAmount | uint256 | Released amount of the underlying assets |
Use Cases
Use Cases in Solidity
Use Cases with ethers.js
transferFrom (transfer all)
Function Definition
Input Parameters
Parameter | Type | Note |
from | address | Address of the Voucher sender |
to | address | Address of the Voucher recipient |
tokenId | uint256 | Id of the Voucher to transfer |
Use Cases
Use Cases in Solidity
Use Cases with ethers.js
transferFrom (partial transfer)
Function Definition
Input Parameters
Parameter | Type | Note |
from | address | Address of the Voucher sender |
to | address | Address of the Voucher recipient |
tokenId | uint256 | Id of the Voucher to transfer |
transferUnits | uint256 | Amount of units to transfer |
Output Parameters
Parameter | Type | Note |
newTokenId | uint256 | Id of the Voucher created after transfer |
Use Cases
Use Cases in Solidity
Use Cases with ethers.js
setApprovalForAll
Function Definition
Input Parameters
Parameter | Type | Note |
operator | address | Address to be authorized |
approved | bool | Whether to approve all Vouchers to operator |
Use Cases
Use Cases in Solidity
Use Cases with ethers.js
Last updated