Used as a CW20 like token for distributing (vesting) airdropped NTRN tokens.
Main alterations from cw20-base contract:
Mintmints to the airdrop address only and requires untrn tokens sent along;
Withdrawnot only burn tokens, but also transfer untrn tokens to addresses in 1:1 proportion to burned cNTRN tokens;
Withdrawis permissionless and can be called directly by the user;
Withdrawhas a vesting mechanism attached (tokens are linearly vested for a given amount of time);
Transferonly accessible for airdrop contract address.
The contract is owned by the Neutron DAO and needs to know airdrop and lockdrop contract addresses on initialization for permission purposes.
Mint() with untrn sent along to mint cNTRN funds in 1:1 proportion and assigns newly minted cNTRN funds to the airdrop address.
Vesting algorithm is linear with no cliff.
Users can use query
WithdrawableAmount to find out how many tokens they can
Main usage scenarios
Initialization and Mint
- DAO initializes contract, specifies token info with minter, airdrop and lockdrop contract addresses.
- DAO executes
Mint()with untrn sent along, that mints cNTRN in 1:1 proportion and assigns them to airdrop contract balance.
- Airdrop calculates the amount of airdrops for users and uses
Transfer(recipient, amount)together with
AddVesting(address, amount, start_time, duration)to transfer funds and set vesting schedule (Always a linear vesting with 0 CLIFF time).
- There are two ways of burning cNTRN and sending untrn to user:
- users can execute
Withdraw()to burn cNTRN and get untrn according to the vesting schedule. They can look into how much they can withdraw now using
Withdraw()can be called only after
config.when_withdrawablepassed (Should be set to lockdrop phase 2 end).
- lockdrop can execute
BurnFrom(owner, amount)to send
amountof untrn to
owner(This action skips vesting as a reward for lockdrop participation).
BurnFromdoes not affect vested amounts. So for example if user can get 200 untrn from
Withdraw(), he will get exactly 200 untrn even if
BurnFromis called just prior to this.
Withdraw()method also has additional check to ensure that no more than user balance will be withdrawn.
- At the end of airdrop stage (3 months after event add), airdrop executes
Burn(amount)to burn unclaimed cNTRN.