From d4aebfbd6675d38b3dd54bf77725f325cdaecf3f Mon Sep 17 00:00:00 2001 From: Vincent Brunet Date: Sat, 6 Jan 2024 12:12:04 +0100 Subject: [PATCH] up --- ...nce_create_withdraw_request_from_credix_lp_depository.rs | 2 +- ...nce_redeem_withdraw_request_from_credix_lp_depository.rs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/programs/uxd/src/instructions/credix_lp/rebalance_create_withdraw_request_from_credix_lp_depository.rs b/programs/uxd/src/instructions/credix_lp/rebalance_create_withdraw_request_from_credix_lp_depository.rs index 4f37aa8ac..f46b31dac 100644 --- a/programs/uxd/src/instructions/credix_lp/rebalance_create_withdraw_request_from_credix_lp_depository.rs +++ b/programs/uxd/src/instructions/credix_lp/rebalance_create_withdraw_request_from_credix_lp_depository.rs @@ -183,7 +183,7 @@ pub(crate) fn handler( total_shares_supply, total_shares_value, )?; - checked_sub(owned_shares_value, redeemable_amount_under_management)? + owned_shares_value.saturating_sub(redeemable_amount_under_management) }; let overflow_value = { diff --git a/programs/uxd/src/instructions/credix_lp/rebalance_redeem_withdraw_request_from_credix_lp_depository.rs b/programs/uxd/src/instructions/credix_lp/rebalance_redeem_withdraw_request_from_credix_lp_depository.rs index 95f0acfc2..cfc22e9b1 100644 --- a/programs/uxd/src/instructions/credix_lp/rebalance_redeem_withdraw_request_from_credix_lp_depository.rs +++ b/programs/uxd/src/instructions/credix_lp/rebalance_redeem_withdraw_request_from_credix_lp_depository.rs @@ -269,10 +269,8 @@ pub(crate) fn handler( .redeemable_amount_under_management, )?; - let profits_collateral_amount = checked_sub( - owned_shares_value_before, - redeemable_amount_under_management, - )?; + let profits_collateral_amount = + owned_shares_value_before.saturating_sub(redeemable_amount_under_management); msg!( "[rebalance_redeem_withdraw_request_from_credix_lp_depository:profits_collateral_amount:{}]", profits_collateral_amount