202304222057
Status: #doc
Tags: #neutron #tge
https://github.com/neutron-org/neutron-tge-contracts
https://github.com/neutron-org/neutron-integration-tests
### Contracts
1. Credits
2. Airdrop
3. Auction
4. Lockdrop
5. Vesting
### Credits contract
On genesis it's initialized and called `mint` to issue cNTRN tokens which is used for Airdrop. Reason we have them – we don't want users have NTRN right after the Airdrop.
Config:
```rust
pub struct Config {
/// DAO contract address
pub dao_address: Addr,
/// Airdrop contract address
pub airdrop_address: Option<Addr>,
/// Lockdrop contract address
pub lockdrop_address: Option<Addr>,
/// When can start withdrawing untrn tokens
pub when_withdrawable: Option<u64>,
}
```
#### Airdrop contract
Initialized on genesis. On a claim it sets a new Vesting on Credits contract for a user
Config:
```rust
pub struct InstantiateMsg {
// credits contract address
pub credits_address: String,
/// Address to send unclaimed tokens
pub reserve_address: String,
/// MerkleRoot is hex-encoded merkle root.
pub merkle_root: String,
/// A point in time from which it is possible to claim airdrops
pub airdrop_start: u64,
/// A point in time from which a vesting is configured for cNTRNs. At this point, it is still
/// possible for users to claim their airdrops.
pub vesting_start: u64,
/// Total duration of vesting. At `vesting_start.seconds() + vesting_duration_seconds`
/// point of time it is no longer possible to claim airdrops. At the very same point of time,
/// it is possible to withdraw all remaining cNTRNs, exchange them for NTRNs and send to
/// reserve, using `[ExecuteMsg::WithdrawAll]` message
pub vesting_duration_seconds: u64,
pub total_amount: Option<Uint128>,
/// hrp is the bech32 parameter required for building external network address
/// from signature message during claim action. example "cosmos", "terra", "juno"
pub hrp: Option<String>,
}
```
#### Auction contract
Initialized on genesis. Some of config values (denoms, pool_info) are set by `token_info_manager`.
It has following stages:
1. Waiting for start
2. User can deposit/withdraw ATOM/USDC tokens
3. User can withdraw up to 50% (50%->0% till the phase) of each token once
4. By calling `set_pool_size` it is set LP size of pools
5. Users can lock/unlock their LP positions in lockdrop contract (through the auction contract)
6. Users can unlock up to 50% (50%->0% till the phase of their LP positions
7. Call `init_pool`:
1. Liqidity provided to pools (USDT/NTRN ATOM/NTRN)
2. 50% of LPs transfered to `treasury`
3. Locked LPs transfered to Lockdrop (`LockDropCw20HookMsg::InitializePool`)
8. Call `migrate_to_vesting` - migrates all unlocked liqudity per user to `VestingLP` contracts
```rust
pub struct Config {
/// Account who can update config
pub owner: Addr,
/// Account who can update denoms
pub token_info_manager: Addr,
/// Reserve Contract address
pub reserve_contract_address: Addr,
/// Vesting LP-USDC Contract address
pub vesting_usdc_contract_address: Addr,
/// Vesting LP-ATOM Contract address
pub vesting_atom_contract_address: Addr,
/// Lockdrop Contract address
pub lockdrop_contract_address: Option<Addr>,
/// Price feed contract address
pub price_feed_contract: Addr,
/// Pool info
pub pool_info: Option<PoolInfo>,
/// Timestamp since which USDC / ATOM deposits will be allowed
pub init_timestamp: u64,
/// Number of seconds post init_timestamp during which deposits / withdrawals will be allowed
pub deposit_window: u64,
/// Number of seconds post deposit_window completion during which only withdrawals are allowed
pub withdrawal_window: u64,
/// Lock window for LP tokens
pub lp_tokens_lock_window: u64,
/// Base denom
pub ntrn_denom: String,
/// USDC denom
pub usdc_denom: Option<String>,
/// ATOM denom
pub atom_denom: Option<String>,
/// Min NTRN amount to be distributed as pool liquidity
pub min_ntrn_amount: Uint128,
/// min exchange freshness rate (seconds)
pub max_exchange_rate_age: u64,
/// vesting migration users pack size
pub vesting_migration_pack_size: u16,
/// vesting for lp duration
pub vesting_lp_duration: u64,
}
```
#### Lockdrop contract
Initialized on genesis and provided configured amount of NTRN for incentives. Some of config values (denoms, pool_info) are set by `token_info_manager` . It is used to lock users LPs for one of specified amount of time. Then it uses astroport generator contract to handle NTRN rewards generation for users locked positions.
It has following stages:
1. Waiting for start
2. Lock/Unlock
3. Unlock once for each LP no more than (50% -> 0% till the phase)
4. InitializePool
1. Send LP tokens to generator with call `Deposit`
5. ClaimRewardsAndOptionallyUnlock
Instantiate msg:
```rust
pub struct InstantiateMsg {
/// Account which can update config
pub owner: Option<String>,
/// Account which can update token addresses and generator
pub token_info_manager: String,
/// Credits contract address
pub credits_contract: String,
/// Auction contract address
pub auction_contract: String,
/// Timestamp when Contract will start accepting LP Token deposits
pub init_timestamp: u64,
/// Number of seconds during which lockup deposits will be accepted
pub lock_window: u64,
/// Withdrawal Window Length :: Post the deposit window
pub withdrawal_window: u64,
/// Min. no. of weeks allowed for lockup
pub min_lock_duration: u64,
/// Max. no. of weeks allowed for lockup
pub max_lock_duration: u64,
/// Max lockup positions a user can have
pub max_positions_per_user: u32,
/// Describes rewards coefficients for each lockup duration
pub lockup_rewards_info: Vec<LockupRewardsInfo>,
}
```
#### Vesting LP contract
Initialized on genesis. It is used to vest not locked LP tokens
Instantiate msg:
```rust
pub struct InstantiateMsg {
/// Address allowed to change contract parameters
pub owner: String,
/// Initial list of whitelisted vesting managers
pub vesting_managers: Vec<String>,
/// Token info manager address, used to set vesting token
pub token_info_manager: String,
}
```
---
### References