Clone this repository:
git clone https://github.com/daomaker/tokens-vesting-contract.git
Install dependencies:
tokens-vesting-contract && npm install
The project uses HardHat, so all additional methods and plugins can bee found on their documentation.
For UNIT tests run:
npx hardhat test
Before running deployment you need to write out setup variables. Run cp .env.prod .env
and write down all params of .env
file. Then go to ./scripts/deploy.js
and write down token, beneficiary, start, cliff, release period, releases count variables.
token
: Address of token, which beneficiary should receivebeneficiary
: Address of beneficiary, who should receive vested tokensstart
: Time when vesting start (should be UNIX timestamp of the certain date)cliff
: Additional time in seconds which will added tostart
. During the cliff releases is not available (can be setted as 0 if no cliff)releasePeriod
: Time in seconds for releases (e.g. 3 months should be as 7776000)releaseCount
: Total amount of upcoming releases
All popular networks are supported, for deploy run:
npx hardhat run scripts/deploy.js --network [NETWORK]
For Etherscan verification after deployment run this commands:
npx hardhat verify --network [NETWORK_NAME] [FACTORY_CONTRACT] "BENEFICIARY" "START" "CLIFF" "RELEASE_PERIOD" "RELEASE_COUNT"
After deploying the Vesting contract, it should receive tokens for future vesting logic. Owner can simply transfer required amount of tokens to the contract address. There are multiply releases with the same delay. When time will be reached release tokens will be available for claiming.
vesting.release()
: Beneficiary receives releasable tokensvesting.getAvailableTokens()
: Get tokens amount, which beneficiary can receive at that moment