Token vesting refers to a process where tokens are locked and released slowly over a period of time. If the tokens are locked, they cannot be transferred or used until they are released. This is to mitigate attempts to introduce a large supply of tokens to the market at any point in time.
Create an vesting application which involves using smart contracts to lock the tokens for a specified duration. The tokens can be retrieved progressively via your application within the vesting period.
The tokens distribution table are as follows. The vesting period is the duration which the allocated percentage of tokens will be progressively released. Cliff refers to the initial duration within the vesting period which the tokens are locked. Upon the end of the cliff, the stakeholder is able to receive a portion of the allocated stake from the subsequent month onwards.
Stakeholder | Percentage | Vesting Period (months) | Cliff (months) |
---|---|---|---|
Public | 25 | NA | NA |
Advisors | 10 | 24 | 12 |
Private Investors | 20 | 24 | 12 |
Company Reserves | 30 | NA | NA |
Team | 15 | 24 | 12 |
For example, if the advisors are allocated 1200 tokens over a vesting period of 24 months and a cliff of 12 months, the distribution will look like this,
- Months 1 to 12 --- Advisors get 0 tokens
- Month 13 --- Advisors get 12 * (1200 / 24) = 600 tokens
- Month 14 --- Advisors (1200 / 24) = 50 tokens
- Month 15 --- Advisors (1200 / 24) = 50 tokens
- Month 16 --- Advisors (1200 / 24) = 50 tokens
- ... etc etc
In order to speed up the evaluation process, we will use 1 minute to represent 1 month. Thus, the cliff period will be 12 minutes and the vesting period will be 24 minutes instead.
Create the fungible token with the following details.
- Token name: VACoin
- Unit name: VAC
- Total supply: 100 million
- Decimals: 0
Initialize the vesting contract with the following details.
- Team address
- Advisors address
- Private investor address
- Asset ID
- Remaining amount of tokens that can be distributed per stakeholder
Once the vesting contract is deployed, proceed to transfer all the tokens (less the public allocation) to the vesting contract. This means that you should perform an asset opt in transaction before sending 75% of the token supply to it for lockup and distribution.
Only the advisors, private investors, company reserves and team accounts can withdraw from the vesting contract.
This is an application call to withdraw the vested tokens from the contract. This function will need to verify the sender's address, the vesting and cliff period and decide the available tokens to distribute.
As always, accounts need to be opted in before making a application calls.
Create an application frontend with the following,
- Implement wallet connectors to allow stakeholders to connect to their wallet accounts. The Dapp needs to allow user to switch between accounts for the purposes of this assignment.
- Display the total allocated tokens when the stakeholder account is connected.
- Display maximum number of withdrawable tokens for the stakeholder at that point in time. Your contract will also need to verify this number as well.
- Only allow authorized stakeholder accounts to withdraw from the application.
- Include a form to allow stakeholders to withdraw any amount they wish, subjected to the maximum number of withdrawable tokens at that point in time.
Write test cases to demostrate the successful flow of the auction and negative tests to demostrate if the necesssary checks are in place.
yarn install
Update credentials in .env
file.
# Run all deployment scripts
yarn run algob deploy
# Run one deployment script
yarn run algob deploy scripts/<filename>
# Run non deployment scripts
yarn run algob run scripts/path/to/filename
# Clear cache
yarn run algob clean
# Run tests
yarn run algob test
# Run dapp on localhost
yarn serve
https://docs.google.com/document/d/1IMHy5xnl0y8vADZF40sZLTzjgVdWKNz8sXF6McBEBSU/edit?usp=sharing