From b7664d0c74e85fd7b9ca4ed80b7a5b4134b40b8d Mon Sep 17 00:00:00 2001 From: Lars Lubkoll <11710767+lubkoll@users.noreply.github.com> Date: Wed, 7 Aug 2024 16:00:03 +0200 Subject: [PATCH] Replace checked_multiply_ratio with checked_mul_floor --- .../osmosis/contracts/cl-vault/src/vault/range.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/smart-contracts/osmosis/contracts/cl-vault/src/vault/range.rs b/smart-contracts/osmosis/contracts/cl-vault/src/vault/range.rs index 0a31b3c04..3b63c82ee 100644 --- a/smart-contracts/osmosis/contracts/cl-vault/src/vault/range.rs +++ b/smart-contracts/osmosis/contracts/cl-vault/src/vault/range.rs @@ -252,14 +252,12 @@ pub fn do_swap_deposit_merge( } let (balance0, balance1) = ( - tokens_provided.0.checked_multiply_ratio( - ratio_of_swappable_funds_to_use.numerator(), - ratio_of_swappable_funds_to_use.denominator(), - )?, - tokens_provided.1.checked_multiply_ratio( - ratio_of_swappable_funds_to_use.numerator(), - ratio_of_swappable_funds_to_use.denominator(), - )?, + tokens_provided + .0 + .checked_mul_floor(ratio_of_swappable_funds_to_use)?, + tokens_provided + .1 + .checked_mul_floor(ratio_of_swappable_funds_to_use)?, ); let mut target_range_position_ids = vec![];