diff --git a/contracts/vesting-lp/src/contract.rs b/contracts/vesting-lp/src/contract.rs index 18f0135..ba5e0dc 100644 --- a/contracts/vesting-lp/src/contract.rs +++ b/contracts/vesting-lp/src/contract.rs @@ -1,6 +1,7 @@ use crate::msg::{CallbackMsg, ExecuteMsg, InstantiateMsg, MigrateMsg}; use crate::state::{XykToClMigrationConfig, XYK_TO_CL_MIGRATION_CONFIG}; -use astroport::asset::{native_asset, PairInfo}; +use astroport::asset::{native_asset, Asset, PairInfo}; +use astroport::pair::QueryMsg::Share; use astroport::pair::{ Cw20HookMsg as PairCw20HookMsg, ExecuteMsg as PairExecuteMsg, QueryMsg as PairQueryMsg, }; @@ -81,7 +82,6 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result = deps.querier.query_wasm_smart( + migration_config.xyk_pair.clone(), + &Share { amount: user_share }, + )?; // if there is nothing to migrate just update vi and quit. - // if there is only dust, than send it back to user, update vi and quit - if user_share < migration_config.dust_threshold { + // if there is only dust, then send it back to user, update vi and quit + if user_share_assets.iter().any(|a| a.amount.is_zero()) { if !user_share.is_zero() { resp = resp.add_message(CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: pair_info.liquidity_token.to_string(), diff --git a/contracts/vesting-lp/src/msg.rs b/contracts/vesting-lp/src/msg.rs index 21018e6..0936bc3 100644 --- a/contracts/vesting-lp/src/msg.rs +++ b/contracts/vesting-lp/src/msg.rs @@ -117,7 +117,6 @@ pub struct MigrateMsg { pub cl_pair: String, pub new_lp_token: String, pub pcl_vesting: String, - pub dust_threshold: Uint128, } impl From for BaseExecute { diff --git a/contracts/vesting-lp/src/state.rs b/contracts/vesting-lp/src/state.rs index 4036cd9..9cf45b8 100644 --- a/contracts/vesting-lp/src/state.rs +++ b/contracts/vesting-lp/src/state.rs @@ -1,5 +1,5 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Addr, Decimal, Uint128}; +use cosmwasm_std::{Addr, Decimal}; use cw_storage_plus::Item; /// Config for xyk->CL liquidity migration. @@ -13,7 +13,6 @@ pub struct XykToClMigrationConfig { pub cl_pair: Addr, pub new_lp_token: Addr, pub pcl_vesting: Addr, - pub dust_threshold: Uint128, } pub const XYK_TO_CL_MIGRATION_CONFIG: Item =