Vesting ERC20 Contract
Custom ERC20 contract for automatic vesting
The VestingERC20 contract allows new tokens to be deployed with some simple vesting terms to reduce the impact of new supply entering the market after graduation or allow for projects to use the platform for ICOs.
When a token is created from the Launchpad it is non-transferrable. Whenever new tokens are bought they are minted and burned when they are sold. Once the token supply hits 800 million the token is considered graduated and liquidity can be released to Uniswap. Once liquidity is released tokens are unlocked according to the vesting schedule they were created with.
The contract takes two arguments for vesting when instantiated:
cliffPercent: the percent of tokens that are available immediately upon liquidity release.
vestingDuration: the number of seconds over which the remaining tokens will become available, unlocking linearly.
No claims are required, all tokens are in your wallet and the contract automatically checks how many tokens you have available and will simply revert if you try to send a transaction with more than the available amount.
The full source for the first deployed Vesting ERC20 is verified on BaseScan here.
Contract Reference
constructor
: takes the args used to set the vesting terms and Launchpad address - used to trigger vesting start.
getAvailableBalance
: returns all tokens that can be transferred. This is equal to all non-vested tokens plus the tokens that have finished vesting. This check is used in transfer
and transferFrom
functions to ensure that a transfer for more tokens than are available will revert.
Last updated