Skip to content

Commit

Permalink
feat(smart-contracts): add remove swap routes in pool router & clean-…
Browse files Browse the repository at this point in the history
…up clippy warnings
  • Loading branch information
nseguias committed Feb 5, 2024
1 parent 619927a commit d64300c
Show file tree
Hide file tree
Showing 12 changed files with 550 additions and 143 deletions.
70 changes: 35 additions & 35 deletions contracts/liquidity_hub/fee_collector/src/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ fn collect_all_factories_cw20_fees_successfully() {
fee_distributor_id,
creator.clone().sender,
&white_whale_std::fee_distributor::InstantiateMsg {
bonding_contract_addr: "whale_lair".clone().to_string(),
bonding_contract_addr: "whale_lair".to_string(),
fee_collector_addr: fee_collector_address.clone().to_string(),
grace_period: Uint64::new(1),
epoch_config: EpochConfig {
Expand Down Expand Up @@ -1399,7 +1399,7 @@ fn collect_pools_native_fees_successfully() {
fee_distributor_id,
creator.clone().sender,
&white_whale_std::fee_distributor::InstantiateMsg {
bonding_contract_addr: "whale_lair".clone().to_string(),
bonding_contract_addr: "whale_lair".to_string(),
fee_collector_addr: fee_collector_address.clone().to_string(),
grace_period: Uint64::new(1),
epoch_config: EpochConfig {
Expand Down Expand Up @@ -2352,7 +2352,7 @@ fn aggregate_fees_for_vault() {
fee_distributor_id,
creator.clone().sender,
&white_whale_std::fee_distributor::InstantiateMsg {
bonding_contract_addr: "whale_lair".clone().to_string(),
bonding_contract_addr: "whale_lair".to_string(),
fee_collector_addr: fee_collector_address.clone().to_string(),
grace_period: Uint64::new(1),
epoch_config: EpochConfig {
Expand Down Expand Up @@ -3225,7 +3225,7 @@ fn collect_and_distribute_fees_successfully() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -3275,7 +3275,7 @@ fn collect_and_distribute_fees_successfully() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -3289,7 +3289,7 @@ fn collect_and_distribute_fees_successfully() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -3328,7 +3328,7 @@ fn collect_and_distribute_fees_successfully() {
&pool_network::pair::ExecuteMsg::Swap {
offer_asset: Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(200_000u128),
},
Expand All @@ -3337,7 +3337,7 @@ fn collect_and_distribute_fees_successfully() {
to: None,
},
&[Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(200_000u128),
}],
)
Expand Down Expand Up @@ -3642,7 +3642,7 @@ fn collect_and_dist_fees_where_one_bonder_is_increasing_weight_no_claims_until_e
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -3692,7 +3692,7 @@ fn collect_and_dist_fees_where_one_bonder_is_increasing_weight_no_claims_until_e
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -3706,7 +3706,7 @@ fn collect_and_dist_fees_where_one_bonder_is_increasing_weight_no_claims_until_e
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -4608,7 +4608,7 @@ fn collect_and_distribute_fees_with_expiring_epoch_successfully() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -4658,7 +4658,7 @@ fn collect_and_distribute_fees_with_expiring_epoch_successfully() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -4672,7 +4672,7 @@ fn collect_and_distribute_fees_with_expiring_epoch_successfully() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -5169,7 +5169,7 @@ fn create_epoch_unsuccessfully() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -5219,7 +5219,7 @@ fn create_epoch_unsuccessfully() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -5233,7 +5233,7 @@ fn create_epoch_unsuccessfully() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -5674,7 +5674,7 @@ fn decrease_grace_period_fee_distributor() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -5724,7 +5724,7 @@ fn decrease_grace_period_fee_distributor() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -5738,7 +5738,7 @@ fn decrease_grace_period_fee_distributor() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -6109,7 +6109,7 @@ fn users_cannot_claim_rewards_from_past_epochs() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -6159,7 +6159,7 @@ fn users_cannot_claim_rewards_from_past_epochs() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -6173,7 +6173,7 @@ fn users_cannot_claim_rewards_from_past_epochs() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -6676,7 +6676,7 @@ fn user_can_claim_even_when_his_weight_increases_for_past_epochs() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -6726,7 +6726,7 @@ fn user_can_claim_even_when_his_weight_increases_for_past_epochs() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -6740,7 +6740,7 @@ fn user_can_claim_even_when_his_weight_increases_for_past_epochs() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -7335,7 +7335,7 @@ fn user_weight_accounts_for_unbondings() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -7385,7 +7385,7 @@ fn user_weight_accounts_for_unbondings() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -7399,7 +7399,7 @@ fn user_weight_accounts_for_unbondings() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -8191,7 +8191,7 @@ fn users_can_claim_even_when_global_index_was_taken_after_epoch_was_created() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -8241,7 +8241,7 @@ fn users_can_claim_even_when_global_index_was_taken_after_epoch_was_created() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -8255,7 +8255,7 @@ fn users_can_claim_even_when_global_index_was_taken_after_epoch_was_created() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down Expand Up @@ -8714,7 +8714,7 @@ fn collect_distribute_with_unbonders() {
denom: "uwhale".to_string(),
},
AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
],
pool_fees: PoolFee {
Expand Down Expand Up @@ -8764,7 +8764,7 @@ fn collect_distribute_with_unbonders() {
},
Asset {
info: AssetInfo::NativeToken {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
},
amount: Uint128::new(500_000u128),
},
Expand All @@ -8778,7 +8778,7 @@ fn collect_distribute_with_unbonders() {
amount: Uint128::new(500_000u128),
},
Coin {
denom: native_token.clone().to_string(),
denom: native_token.to_string(),
amount: Uint128::new(500_000u128),
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,15 @@ pub fn deposit_pair(deps: DepsMut, env: Env, msg: Reply) -> Result<Response, Con
},
)?;
let has_existing_position = positions.positions.into_iter().any(|position| {
let QueryPosition::OpenPosition { unbonding_duration: position_unbonding_duration, .. } = position else {
return false;
};
let QueryPosition::OpenPosition {
unbonding_duration: position_unbonding_duration,
..
} = position
else {
return false;
};

unbonding_duration == position_unbonding_duration
unbonding_duration == position_unbonding_duration
});

Ok(Response::default()
Expand Down
Loading

0 comments on commit d64300c

Please sign in to comment.