diff --git a/smart-contracts/contracts/cl-vault/src/vault/range.rs b/smart-contracts/contracts/cl-vault/src/vault/range.rs index 82d5a829c..f3f9f3e09 100644 --- a/smart-contracts/contracts/cl-vault/src/vault/range.rs +++ b/smart-contracts/contracts/cl-vault/src/vault/range.rs @@ -22,7 +22,7 @@ use crate::{ reply::Replies, state::{ ModifyRangeState, Position, SwapDepositMergeState, MODIFY_RANGE_STATE, POOL_CONFIG, - POSITION, RANGE_ADMIN, SWAP_DEPOSIT_MERGE_STATE, VAULT_CONFIG, + POSITION, RANGE_ADMIN, SWAP_DEPOSIT_MERGE_STATE, }, vault::concentrated_liquidity::get_position, vault::merge::MergeResponse, @@ -256,7 +256,6 @@ pub fn do_swap_deposit_merge( let (balance0, balance1) = refunded_amounts; let pool_config = POOL_CONFIG.load(deps.storage)?; - let vault_config = VAULT_CONFIG.load(deps.storage)?; let pool_details = get_cl_pool_info(&deps.querier, pool_config.pool_id)?; let mut target_range_position_ids = vec![]; @@ -341,10 +340,9 @@ pub fn do_swap_deposit_merge( CURRENT_SWAP.save(deps.storage, &(swap_direction, left_over_amount))?; - let token_out_min_amount = token_out_ideal_amount?.checked_multiply_ratio( - vault_config.swap_max_slippage.numerator(), - vault_config.swap_max_slippage.denominator(), - )?; + let mrs = MODIFY_RANGE_STATE.load(deps.storage)?.unwrap(); + let token_out_min_amount = token_out_ideal_amount? + .checked_multiply_ratio(mrs.max_slippage.numerator(), mrs.max_slippage.denominator())?; let swap_msg = swap( deps,