Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTRN-205 vesting lp migration 2.0: XYK -> CL #75

Merged
merged 30 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9ba7e63
add copy of lockdrop contract as lockdrop_pcl for comparison
sotnikov-s Jan 16, 2024
44542c8
recommit migration mechanism w proper base branch
quasisamurai Jan 29, 2024
183c903
fixes, fmft, ref
quasisamurai Feb 1, 2024
06df7cc
rm unused, commit updated sttuff, fmt
quasisamurai Feb 1, 2024
18cbcce
fix int-tests
quasisamurai Feb 1, 2024
0fe360e
satisfy clippy
quasisamurai Feb 1, 2024
fbe0792
move xyk lp addr out of config
quasisamurai Feb 7, 2024
8714134
massive refactor
quasisamurai Feb 13, 2024
aedd1bd
fix schema
quasisamurai Feb 13, 2024
7b67a1d
fmt
quasisamurai Feb 14, 2024
221bbe3
some minor fixes
quasisamurai Feb 15, 2024
a5b500e
satisfy clippy
quasisamurai Feb 15, 2024
d701c70
rewrite to from trait
quasisamurai Feb 15, 2024
ebe9df6
sync deps
quasisamurai Feb 15, 2024
b4309ba
add missing migrate entry point for vesting lp
sotnikov-s Feb 15, 2024
c75163b
refactor pcl vesting
quasisamurai Feb 15, 2024
06bc70b
return dust threshold
quasisamurai Feb 19, 2024
efb80c1
cover fully payed acc migration
quasisamurai Feb 20, 2024
674dc26
optimize to save some gas
quasisamurai Feb 20, 2024
7af18fa
review cleaning
quasisamurai Feb 22, 2024
c9f907b
Update contracts/vesting-lp-pcl/src/contract.rs
quasisamurai Feb 23, 2024
f9a6f80
post-review fixes
quasisamurai Feb 26, 2024
c61cd52
rm max available amount
quasisamurai Feb 26, 2024
747dc52
simplfy addr pass
quasisamurai Feb 26, 2024
07adbf0
simplify addr pass
quasisamurai Feb 26, 2024
f9b7749
regen schema & fix readmes
quasisamurai Feb 26, 2024
222e651
simplify exit branch
quasisamurai Feb 26, 2024
4fe3bdc
decrease total granted instead of increasing total released
quasisamurai Feb 26, 2024
026f865
fmt
quasisamurai Feb 26, 2024
2747526
rm user autoreplace
quasisamurai Feb 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 44 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ members = [
"contracts/lockdrop",
"contracts/credits",
"contracts/vesting-lp",
"contracts/vesting-lp-pcl",
"contracts/vesting-lti",
"contracts/vesting-investors",
"contracts/cw20-merkle-airdrop",
"contracts/price-feed",
"contracts/astroport/*"
"contracts/astroport/*",
]

[profile.release]
Expand All @@ -33,6 +34,7 @@ cosmwasm-schema = { version = "1.4.1", default-features = false }
astroport = { path = "packages/astroport", default-features = false }
astroport-periphery = { path = "packages/astroport_periphery" }
vesting-base = { path = "packages/vesting-base" }
vesting-base-pcl = { path = "packages/vesting-base-pcl" }
# setting cw-multi-test to 0.17.0 enables cosmwasm_1_1, we don't want that
cw-multi-test = "0.16.5"
itertools = "0.11.0"
Expand Down
12 changes: 6 additions & 6 deletions contracts/auction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ The LP Bootstrap via auction contract facilitates cNTRN-NATIVE Neutron pool init
**Phase 1 :: Bootstrapping cNTRN and NATIVE Side of the LP Pool**

- Airdrop recipients and lockdrop participants can delegate part / all of their cNTRN rewards to the auction contract.
- Any user can deposit UST directly to the auction contract to participate in the LP bootstrap auction.
- Both UST deposited & cNTRN delegated (if any) balances are used to calculate user's LP token shares and additional cNTRN incentives that he will receive for participating in the auction.
- Any _user can deposit UST directly to the auction contract to participate in the LP bootstrap auction.
sotnikov-s marked this conversation as resolved.
Show resolved Hide resolved
- Both UST deposited & cNTRN delegated (if any) balances are used to calculate _user's LP token shares and additional cNTRN incentives that he will receive for participating in the auction.

**Phase 2 :: Post cNTRN-NATIVE Pool initialization**

Expand All @@ -24,26 +24,26 @@ The LP Bootstrap via auction contract facilitates cNTRN-NATIVE Neutron pool init
| `ExecuteMsg::Receive` | ReceiveCW20 Hook which facilitates cNTRN tokens delegation by lockdrop participants / airdrop recipients |
| `ExecuteMsg::UpdateConfig` | Admin function to update any of the configuration parameters. |
| `ExecuteMsg::DepositUst` | Facilitates UST deposits by users |
| `ExecuteMsg::WithdrawUst` | Facilitates UST withdrawals by users. 100% amount can be withdrawn during deposit window, which is then limited to 50% during 1st half of deposit window which then decreases linearly during 2nd half of deposit window. Only 1 withdrawal can be made by a user during the withdrawal window |
| `ExecuteMsg::WithdrawUst` | Facilitates UST withdrawals by users. 100% amount can be withdrawn during deposit window, which is then limited to 50% during 1st half of deposit window which then decreases linearly during 2nd half of deposit window. Only 1 withdrawal can be made by a _user during the withdrawal window |
| `ExecuteMsg::InitPool` | Admin function which facilitates Liquidity addtion to the Astroport cNTRN-UST Pool. Uses CallbackMsg to update state post liquidity addition to the pool |
| `ExecuteMsg::StakeLpTokens` | Admin function to stake cNTRN-UST LP tokens with the generator contract |
| `ExecuteMsg::ClaimRewards` | Facilitates cNTRN rewards claim (staking incentives from generator) for users and the withdrawal of LP shares which have been unlocked for the user. |
| `ExecuteMsg::ClaimRewards` | Facilitates cNTRN rewards claim (staking incentives from generator) for users and the withdrawal of LP shares which have been unlocked for the _user. |

### Handle Messages :: Callback

| Message | Description |
| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `CallbackMsg::UpdateStateOnLiquidityAdditionToPool` | Callback function to update state after liquidity is added to the cNTRN-UST Pool |
| `CallbackMsg::UpdateStateOnRewardClaim` | Callback function to update state after cNTRN rewards are claimed from the generator |
| `CallbackMsg::WithdrawUserRewardsCallback` | Callback function to facilitate cNTRN reward claiming and unlocked LP tokens withdrawal for the user |
| `CallbackMsg::WithdrawUserRewardsCallback` | Callback function to facilitate cNTRN reward claiming and unlocked LP tokens withdrawal for the _user |

### Query Messages

| Message | Description |
| -------------------- | ----------------------------- |
| `QueryMsg::Config` | Returns the config info |
| `QueryMsg::State` | Returns state of the contract |
| `QueryMsg::UserInfo` | Returns user position details |
| `QueryMsg::UserInfo` | Returns _user position details |

## Build schema and run unit-tests

Expand Down
12 changes: 6 additions & 6 deletions contracts/lockdrop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Note - Users can open muliple lockup positions with different lockup duration fo
| `ExecuteMsg::EnableClaims` | Executed by the Bootstrap auction contract when liquidity is added to the ASTRO-UST pool. Enables ASTRO withdrawals by the lockdrop recipients. |
| `ExecuteMsg::InitializePool` | Admin function. Facilitates addition of new Pool (Terraswap Pools) whose LP tokens can then be locked in the lockdrop contract |
| `ExecuteMsg::UpdatePool` | Admin function to update any configuraton parameter for a terraswap pool whose LP tokens are currently accepted for the lockdrop |
| `ExecuteMsg::IncreaseLockup` | Facilitates opening a new user position or adding to an existing position |
| `ExecuteMsg::IncreaseLockup` | Facilitates opening a new _user position or adding to an existing position |
| `ExecuteMsg::IncreaseAstroIncentives` | Admin function to increase the ASTRO incentives that are to be distributed |
| `ExecuteMsg::WithdrawFromLockup` | Facilitates LP token withdrawals from lockup positions by users. 100% amount can be withdrawn during deposit window, which is then limited to 50% during 1st half of deposit window which then decreases linearly during 2nd half of deposit window. Only 1 withdrawal can be made by a user during the withdrawal windows |
| `ExecuteMsg::WithdrawFromLockup` | Facilitates LP token withdrawals from lockup positions by users. 100% amount can be withdrawn during deposit window, which is then limited to 50% during 1st half of deposit window which then decreases linearly during 2nd half of deposit window. Only 1 withdrawal can be made by a _user during the withdrawal windows |
| `ExecuteMsg::MigrateLiquidity` | Admin function. Facilitates migration of liquidity (locked terraswap LP tokens) from Terraswap to Astroport (Astroport LP tokens) |
| `ExecuteMsg::StakeLpTokens` | Admin function. Facilitates staking of Astroport LP tokens for a particular LP pool with the generator contract |
| `ExecuteMsg::DelegateAstroToAuction` | This function facilitates ASTRO tokens delegation to the Bootstrap auction contract during the bootstrap auction phase. Delegated ASTRO tokens are added to the user's position in the bootstrap auction contract |
| `ExecuteMsg::DelegateAstroToAuction` | This function facilitates ASTRO tokens delegation to the Bootstrap auction contract during the bootstrap auction phase. Delegated ASTRO tokens are added to the _user's position in the bootstrap auction contract |
| `ExecuteMsg::ClaimRewardsAndOptionallyUnlock` | Facilitates rewards claim by users for a particular lockup position along with unlock when possible |
| `ExecuteMsg::ClaimAssetReward` | Collects assets reward from LP and distribute reward to user if all requirements are met |
| `ExecuteMsg::ClaimAssetReward` | Collects assets reward from LP and distribute reward to _user if all requirements are met |
| `ExecuteMsg::TogglePoolRewards` | Admin function. Enables assets reward for specified LP |
| `ExecuteMsg::ProposeNewOwner` | Admin function. Creates an offer to change the contract ownership. The validity period of the offer is set in the `expires_in` variable. After `expires_in` seconds pass, the proposal expires and cannot be accepted anymore. |
| `ExecuteMsg::DropOwnershipProposal` | Admin function. Removes an existing offer to change the contract owner. |
Expand All @@ -34,7 +34,7 @@ Note - Users can open muliple lockup positions with different lockup duration fo
| Message | Description |
|-------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `CallbackMsg::UpdatePoolOnDualRewardsClaim` | Callback function to update contract state after pending dual staking rewards are claimed from the generator contract |
| `CallbackMsg::WithdrawUserLockupRewardsCallback` | Callback function to withdraw user rewards for a particular lockcup position along with optional LP tokens withdrawal (upon lockup duration expiration) |
| `CallbackMsg::WithdrawUserLockupRewardsCallback` | Callback function to withdraw _user rewards for a particular lockcup position along with optional LP tokens withdrawal (upon lockup duration expiration) |
| `CallbackMsg::WithdrawLiquidityFromTerraswapCallback` | Callback function used during liquidity migration to update state after liquidity is removed from terraswap |
| `CallbackMsg::DistributeAssetReward` | Callback function used for assets reward distribution after rewards claiming from LP |

Expand All @@ -45,7 +45,7 @@ Note - Users can open muliple lockup positions with different lockup duration fo
| `QueryMsg::Config` | Returns the config info |
| `QueryMsg::State` | Returns the contract's global state |
| `QueryMsg::Pool` | Returns info regarding a certain supported LP token pool |
| `QueryMsg::UserInfo` | Returns info regarding a user (total ASTRO rewards, list of lockup positions) |
| `QueryMsg::UserInfo` | Returns info regarding a _user (total ASTRO rewards, list of lockup positions) |
| `QueryMsg::LockUpInfo` | Returns info regarding a particular lockup position with a given duration and identifer for the LP tokens locked |
| `QueryMsg::PendingAssetReward` | Returns the amount of pending asset rewards for the specified recipient and for a specific lockup position |

Expand Down
2 changes: 1 addition & 1 deletion contracts/vesting-investors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "vesting-investors"
version = "1.1.1"
authors = ["Neutron"]
edition = "2021"
description = "Vesting contract which provides queries to get the amount of tokens that are being held by user at certain height and allows to remove vesting accounts to the contract's owner."
description = "Vesting contract which provides queries to get the amount of tokens that are being held by _user at certain height and allows to remove vesting accounts to the contract's owner."

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
6 changes: 6 additions & 0 deletions contracts/vesting-lp-pcl/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
integration-test = "test --test integration"
schema = "run --example vesting-lp_schema"
29 changes: 29 additions & 0 deletions contracts/vesting-lp-pcl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "vesting-lp-pcl"
version = "1.1.0"
authors = ["Neutron"]
edition = "2021"
description = "Vesting contract with a voting capabilities. Provides queries to get the amount of tokens are being held by _user at certain height."

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all init/handle/query exports
library = []

[dependencies]
cw2 = { workspace = true }
cw20 = { version = "0.15" }
astroport = { path= "../../packages/astroport"}
vesting-base = {path = "../../packages/vesting-base"}
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-storage-plus = "0.15"

[dev-dependencies]
cw-multi-test = { workspace = true }
astroport-token = {git = "https://github.com/astroport-fi/astroport-core.git", rev = "65ce7d1879cc5d95b09fa14202f0423bba52ae0e" }
cw-utils = "0.15"
12 changes: 12 additions & 0 deletions contracts/vesting-lp-pcl/examples/vesting-lp_schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use cosmwasm_schema::write_api;
use vesting_base::msg::{MigrateMsg, QueryMsg};
use vesting_lp_pcl::msg::{ExecuteMsg, InstantiateMsg};

fn main() {
quasisamurai marked this conversation as resolved.
Show resolved Hide resolved
write_api! {
instantiate: InstantiateMsg,
query: QueryMsg,
execute: ExecuteMsg,
migrate: MigrateMsg
}
}
Loading
Loading