Vesting
The vesting interface is designed to manage the vesting of tokens. Vesting is a mechanism used to lock tokens for a certain period of time, or until certain conditions are met. This allows for the gradual release of tokens to beneficiaries. Again, this page will show how to use the precompile to reference the deployed contract so users can directly interact with it.
Compatible Networks: agung & peaq
1. Setup Remix IDE
Get the proper setup in the Remix IDE website. Please visit the link:
Create a new blank workspace for the Vesting precompile.
2. Create Vesting File
Create a new filed named vesting.sol. Paste the precompile code into that newly created file.
3. Compile the Contract
Compile the contract by going to the Solidity Compiler sidebar and click on the blue button Compile vesting.sol to create the abi.
4. Get Contract
After compiling we will need to get the instance of the deployed vesting contract. To do so go to the Deploy & Run transactions sidebar, select Injected Provider - MetaMask, pick the account with funds, and select the vesting.sol contract as shown in the screenshot below.
- Set 0x0000000000000000000000000000000000000808 found on top of the file in the address and click At Address. Doing so will allow you to interact with the agung Vesting contract. Doing so will create a new deployed contract instance on the bottom of the sidebar that you are able to interact with.
5. Interact with the Functions
A new deployed contract will appear as shown in the screenshot below. Now you are able to interact with the Vesting contract.
Vesting the Caller’s Funds:
vest()
Allows the caller to vest their own vested funds.
The caller can trigger the release of their locked tokens according to the vesting schedule.
vestedTransfer(address target, uint256 locked, uint256 perBlock, uint32 startingBlock)
This function creates a new vesting schedule for a transfer.
It locks a specified amount of tokens (locked) for a target address (target), specifying the number of tokens to be released per block (perBlock) starting from a specified block (startingBlock).
vestOther(address target)
This function allows someone to vest the funds of another account.
It enables a user to trigger the release of tokens for a specified beneficiary (target).