-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
@@ -25,10 +25,10 @@ | |||
{ | |||
"type": "object", | |||
"required": [ | |||
"increase_astro_incentives" | |||
"increase_n_t_r_n_incentives" |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Credits
contracts/lockdrop/src/contract.rs
Outdated
auction_contract: None, | ||
generator: None, | ||
init_timestamp: msg.init_timestamp, | ||
lock_window: msg.deposit_window, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also looks weird
contracts/lockdrop/src/contract.rs
Outdated
auction_contract: None, | ||
generator: None, | ||
init_timestamp: msg.init_timestamp, | ||
lock_window: msg.deposit_window, |
There was a problem hiding this comment.
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.
contracts/lockdrop/src/contract.rs
Outdated
>= 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 { |
There was a problem hiding this comment.
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
contracts/lockdrop/src/contract.rs
Outdated
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", |
There was a problem hiding this comment.
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`]. |
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
contracts/lockdrop/src/contract.rs
Outdated
.is_some() | ||
{ | ||
return Err(StdError::generic_err("Already supported")); | ||
if info.sender != pool_info.pool { |
There was a problem hiding this comment.
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
pub atom_token: String, | ||
/// Address of USDC/NTRN token | ||
pub usdc_token: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mb?
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, |
* 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
Lockdrop contract, based on astroports one. https://www.notion.so/TGE-Contracts-Technical-Design-f1ebdeeac58240dcb004e93887caf046?pvs=4#e4208b9f0cf444849334fc91d0291fa7
query_user_lockup_total_at_height
queryquery_lockup_total_at_height
queryhandle_claim_rewards_and_unlock_for_lockup
call