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. This page will show how to use the precompile to reference the deployed contract so users can directly interact with it. Works with the peaq or agung networks.

Prerequisites

  • Basic understanding of blockchain, EVM, and vesting concepts.
  • Using the Remix IDE with MetaMask configured to interact with a peaq network.
  • You have token funds available in the wallet connected to the a peaq network.

Instructions

1. Setup Remix IDE

  • Open the Remix website.
  • Create a new blank workspace for the precompiles.

2. Create a New File

  • In your Remix workspace, create a new file named vesting.sol.
  • Copy the content of the vesting precompile file from the peaq network node precompile page and paste it into the vesting.sol file. The precompile is found at the peaq node source code.

3. Compile the Contract

  • Compile the vesting.sol file by clicking on the Solidity Compiler tab and selecting the appropriate compiler version.
  • Ensure the compilation is successful and generates the ABI file needed for interacting with the smart contract.

4. Deploy and Interact with the Contract

  1. Under the Deploy and Run Transactions tab, select Injected Provider - MetaMask as the environment.
  2. Ensure your chain ID matches the selected network (peaq/agung).
  3. Choose the account with sufficient token funds.
  4. Set the contract address to 0x0000000000000000000000000000000000000808 (found at the top of the copied file).
  5. Click At Address to load the deployed contract into the interface.

5. Interact with the Functions

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()

  • 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()

  • Allows someone to vest the funds of another account. -0 It enables a user to trigger the release of tokens for a specified beneficiary (target).