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

feat: lockdrop refactor #6

Merged
merged 22 commits into from
Mar 21, 2023
Merged

feat: lockdrop refactor #6

merged 22 commits into from
Mar 21, 2023

Conversation

swelf19
Copy link
Contributor

@swelf19 swelf19 commented Feb 9, 2023

Lockdrop contract, based on astroports one. https://www.notion.so/TGE-Contracts-Technical-Design-f1ebdeeac58240dcb004e93887caf046?pvs=4#e4208b9f0cf444849334fc91d0291fa7

  • implement query_user_lockup_total_at_height query
  • implement query_lockup_total_at_height query
  • implement instant withdraw of airdroppped tokens in amount of 2.5*reward_size during handle_claim_rewards_and_unlock_for_lockup call

@pr0n00gler pr0n00gler changed the base branch from feat/lockdrop-init to main February 28, 2023 14:46
@pr0n00gler pr0n00gler marked this pull request as ready for review March 3, 2023 14:35
@@ -25,10 +25,10 @@
{
"type": "object",
"required": [
"increase_astro_incentives"
"increase_n_t_r_n_incentives"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks weird, maybe we can use some serde annotations to fix it?

"description": "Bootstrap Auction contract address",
"anyOf": [
"credit_contract": {
"description": "Credit contract address",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Credits

auction_contract: None,
generator: None,
init_timestamp: msg.init_timestamp,
lock_window: msg.deposit_window,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have this naming inconsistency?

@@ -126,49 +152,21 @@ pub fn instantiate(
///
/// ## Execute messages
///
/// * **ExecuteMsg::Receive(msg)** Parse incoming messages from the ASTRO token.
/// * **ExecuteMsg::Receive(msg)** Parse incoming messages from the cNTRN token.
///
/// * **ExecuteMsg::UpdateConfig { new_config }** Admin function to update configuration parameters.
///
/// * **ExecuteMsg::InitializePool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think i see InitializePool handler here


LockupInfoV2 {
lp_units_locked: amount,
astroport_lp_transferred: None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something's not right here

return Err(StdError::generic_err("Unauthorized"));
}

// CHECK :: Is lockdrop deposit window closed
if env.block.time.seconds() >= config.init_timestamp + config.deposit_window {
if env.block.time.seconds() >= config.init_timestamp + config.lock_window {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also looks weird

auction_contract: None,
generator: None,
init_timestamp: msg.init_timestamp,
lock_window: msg.deposit_window,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe originally i just renamed deposit -> lock window. So we need only one config param.

>= config.init_timestamp + config.deposit_window + config.withdrawal_window
{
return Err(StdError::generic_err("ASTRO is already being distributed"));
if env.block.time.seconds() >= config.init_timestamp + config.lock_window {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.init_timestamp + config.lock_window + config.withdraw_window i think, as it was in original contract

return Err(StdError::generic_err("Unauthorized"));
}

// CHECK :: Is lockdrop deposit window closed
if env.block.time.seconds() >= config.init_timestamp + config.deposit_window {
if env.block.time.seconds() >= config.init_timestamp + config.lock_window {
return Err(StdError::generic_err(
"Pools cannot be added post deposit window closure",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have added pools during initialize message, at thei point we transfer all the LP tokens from auction to the lockdrop and stake them into the generator. So i think we need to rephrase the error msg to something like "Pools cannot be staked post deposit window closure"

}

/// Admin function to update LP Pool Configuration. Returns a default object of type [`Response`].
/// Hook function to increase Lockup position size when any of the supported LP Tokens are sent to the contract by the user. Returns a default object of type [`Response`].
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not send any LP at this point, only create lock position(or updates the existing one) on behalf of user

///
/// * **incentives_share** is an object of type [`u64`]. Parameter defining share of total ASTRO incentives are allocated for this pool
pub fn handle_update_pool(
/// * **duration** is an object of type [`u64`]. Number of seconds the LP token is locked for (lockup period begins post the withdrawal window closure).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why seconds? Isn't it easier to operate some kind of months? At least from user perpective.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't, otherwise integration tests will be screwed

.is_some()
{
return Err(StdError::generic_err("Already supported"));
if info.sender != pool_info.pool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the naming here is a bit misleading; it's not the pool, it's the cw20 lp staking contract

Comment on lines 70 to 72
pub atom_token: String,
/// Address of USDC/NTRN token
pub usdc_token: String,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb?

Suggested change
pub atom_token: String,
/// Address of USDC/NTRN token
pub usdc_token: String,
pub atom_ntrn_token: String,
/// Address of USDC/NTRN token
pub usdc_ntrn_token: String,

pr0n00gler and others added 3 commits March 21, 2023 12:40
* wip: first try

* legal: replace license

* feat: wip

* feat: wip

* fix: clippy

* feat: update deps

* fix: remove incentives

* feat: remove token-sale contract

* wip

* feat: indexed users and vesting

* fix: update

* feat: withdraw lp

* fix: minor

* feat: integration with lockdrop

* feat: add price-feed contract

* feat: hermes config

* chore: minor

* fix: price feed schema

* feat: remove airdrop address

* del: remove airdrop contract

* chore: add MINIMUM_LIQUIDITY_AMOUNT

* feat: send locked tokens to lockdrop contract

* fix: update user info on withdraw

* fix: clippy

* refactor: move msgs

* fix: usize -> u16

* feat: refactor integration issues

* fix: attribute name

* chore: rename withdraw fields

* fix: old names

* fix: withdraw condition

* feat: check price feed data length

* chore: add some minor attrs

* chore: add price-feed into build

* chore: sort price-feed symbols

* fix: calc fixes

* fix: pool info must be set in update msg

* chore: add locked tokens into user info query response
@zavgorodnii zavgorodnii merged commit a4a3830 into main Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants