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 d64300c commit 10c0bd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions contracts/liquidity_hub/pool-network/incentive/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn delete_weight_history_for_user(
pub fn get_flow_asset_amount_at_epoch(flow: &Flow, epoch: u64) -> Uint128 {
let mut asset_amount = flow.flow_asset.amount;

if let Some((_, &(change_amount, _))) = flow.asset_history.range(..=epoch).rev().next() {
if let Some((_, &(change_amount, _))) = flow.asset_history.range(..=epoch).next_back() {
asset_amount = change_amount;
}

Expand All @@ -85,7 +85,7 @@ pub fn get_flow_end_epoch(flow: &Flow) -> u64 {
pub fn get_flow_current_end_epoch(flow: &Flow, epoch: u64) -> u64 {
let mut end_epoch = flow.end_epoch;

if let Some((_, &(_, current_end_epoch))) = flow.asset_history.range(..=epoch).rev().next() {
if let Some((_, &(_, current_end_epoch))) = flow.asset_history.range(..=epoch).next_back() {
end_epoch = current_end_epoch;
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/liquidity_hub/whale_lair/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ pub(crate) fn query_unbonding(
.collect::<StdResult<Vec<Bond>>>()?;

// aggregate all the amounts in unbonding vec and return uint128
let unbonding_amount = unbonding.iter().fold(Ok(Uint128::zero()), |acc, bond| {
acc.and_then(|acc| acc.checked_add(bond.asset.amount))
let unbonding_amount = unbonding.iter().try_fold(Uint128::zero(), |acc, bond| {
acc.checked_add(bond.asset.amount)
})?;

Ok(UnbondingResponse {
Expand Down

0 comments on commit 10c0bd3

Please sign in to comment.