diff --git a/programs/uxd/src/instructions/redeem.rs b/programs/uxd/src/instructions/redeem.rs index 78b6b4a4a..479cc1478 100644 --- a/programs/uxd/src/instructions/redeem.rs +++ b/programs/uxd/src/instructions/redeem.rs @@ -177,7 +177,7 @@ pub(crate) fn handler(ctx: Context, redeemable_amount: u64) -> Result<() let new_epoch_outflow_amount = { // How long ago was the last outflow let last_outflow_elapsed_slots = std::cmp::min( - checked_as_u64(checked_sub(current_slot, controller.last_outflow_slot)?)?, + checked_sub(current_slot, controller.last_outflow_slot)?, controller.slots_per_epoch, ); // How much was unlocked by waiting since last redeem diff --git a/programs/uxd/src/utils/calculate_depositories_redeemable_amount.rs b/programs/uxd/src/utils/calculate_depositories_redeemable_amount.rs index 5aeef4a2e..a7dab3cf5 100644 --- a/programs/uxd/src/utils/calculate_depositories_redeemable_amount.rs +++ b/programs/uxd/src/utils/calculate_depositories_redeemable_amount.rs @@ -4,7 +4,6 @@ use anchor_lang::require; use crate::error::UxdError; use crate::utils::calculate_depositories_sum_value; use crate::utils::checked_add; -use crate::utils::checked_as_u64; use crate::utils::checked_sub; use crate::ROUTER_DEPOSITORIES_COUNT; @@ -167,7 +166,7 @@ pub fn calculate_depositories_redeemable_amount( continue; } let depository_remaining_after_redeem = checked_sub( - checked_as_u64(depository.redeemable_amount_under_management)?, + depository.redeemable_amount_under_management, depositories_redeemable_amount[i], )?; let depository_rounding_correction = diff --git a/programs/uxd/src/utils/calculate_depositories_target_redeemable_amount.rs b/programs/uxd/src/utils/calculate_depositories_target_redeemable_amount.rs index 868ef49ef..1fb887126 100644 --- a/programs/uxd/src/utils/calculate_depositories_target_redeemable_amount.rs +++ b/programs/uxd/src/utils/calculate_depositories_target_redeemable_amount.rs @@ -4,7 +4,6 @@ use anchor_lang::require; use crate::error::UxdError; use crate::utils::calculate_depositories_sum_value; use crate::utils::checked_add; -use crate::utils::checked_as_u64; use crate::utils::checked_sub; use crate::BPS_POWER; use crate::ROUTER_DEPOSITORIES_COUNT; @@ -26,8 +25,6 @@ pub fn calculate_depositories_target_redeemable_amount( UxdError::InvalidDepositoriesVector ); - let redeemable_circulating_supply = checked_as_u64(redeemable_circulating_supply)?; - // Double check that the weights adds up to 100% let depositories_weights_bps = depositories_info .iter() @@ -66,8 +63,8 @@ pub fn calculate_depositories_target_redeemable_amount( // Read the minting caps of each depository let depositories_hard_cap_amount = depositories_info .iter() - .map(|depository| checked_as_u64(depository.redeemable_amount_under_management_cap)) - .collect::>>()?; + .map(|depository| depository.redeemable_amount_under_management_cap) + .collect::>(); // Compute the depository_overflow amount of raw target that doesn't fit within the cap of each depository let depositories_overflow_amount = std::iter::zip(