diff --git a/libs/mocks/src/token_swaps.rs b/libs/mocks/src/token_swaps.rs index cd6eef7aee..831dd1b60a 100644 --- a/libs/mocks/src/token_swaps.rs +++ b/libs/mocks/src/token_swaps.rs @@ -33,18 +33,16 @@ pub mod pallet { T::CurrencyId, T::Balance, T::SellRatio, - T::Balance, ) -> Result + 'static, ) { - register_call!(move |(a, b, c, d, e, g)| f(a, b, c, d, e, g)); + register_call!(move |(a, b, c, d, e)| f(a, b, c, d, e)); } pub fn mock_update_order( - f: impl Fn(T::AccountId, T::OrderId, T::Balance, T::SellRatio, T::Balance) -> DispatchResult - + 'static, + f: impl Fn(T::AccountId, T::OrderId, T::Balance, T::SellRatio) -> DispatchResult + 'static, ) { - register_call!(move |(a, b, c, d, e)| f(a, b, c, d, e)); + register_call!(move |(a, b, c, d)| f(a, b, c, d)); } pub fn mock_cancel_order(f: impl Fn(T::OrderId) -> DispatchResult + 'static) { @@ -79,9 +77,8 @@ pub mod pallet { c: Self::CurrencyId, d: Self::Balance, e: Self::SellRatio, - f: Self::Balance, ) -> Result { - execute_call!((a, b, c, d, e, f)) + execute_call!((a, b, c, d, e)) } fn update_order( @@ -89,9 +86,8 @@ pub mod pallet { b: Self::OrderId, c: Self::Balance, d: Self::SellRatio, - e: Self::Balance, ) -> DispatchResult { - execute_call!((a, b, c, d, e)) + execute_call!((a, b, c, d)) } fn cancel_order(a: Self::OrderId) -> DispatchResult { diff --git a/pallets/foreign-investments/src/tests.rs b/pallets/foreign-investments/src/tests.rs index 81f3a0fafc..2d5ca939d8 100644 --- a/pallets/foreign-investments/src/tests.rs +++ b/pallets/foreign-investments/src/tests.rs @@ -22,7 +22,7 @@ mod util { MockInvestment::mock_investment_requires_collect(|_, _| false); MockInvestment::mock_investment(|_, _| Ok(0)); MockInvestment::mock_update_investment(|_, _, _| Ok(())); - MockTokenSwaps::mock_place_order(move |_, _, _, _, _, _| Ok(order_id)); + MockTokenSwaps::mock_place_order(move |_, _, _, _, _| Ok(order_id)); MockCurrencyConversion::mock_stable_to_stable(move |_, _, _| Ok(amount) /* 1:1 */); ForeignInvestment::increase_foreign_investment( @@ -37,7 +37,7 @@ mod util { MockInvestment::mock_investment_requires_collect(|_, _| unimplemented!("no mock")); MockInvestment::mock_investment(|_, _| unimplemented!("no mock")); MockInvestment::mock_update_investment(|_, _, _| unimplemented!("no mock")); - MockTokenSwaps::mock_place_order(|_, _, _, _, _, _| unimplemented!("no mock")); + MockTokenSwaps::mock_place_order(|_, _, _, _, _| unimplemented!("no mock")); MockCurrencyConversion::mock_stable_to_stable(|_, _, _| unimplemented!("no mock")); } @@ -92,17 +92,14 @@ mod increase_investment { assert_eq!(amount, 0); // We still do not have the swap done. Ok(()) }); - MockTokenSwaps::mock_place_order( - |account_id, curr_in, curr_out, amount, limit, min| { - assert_eq!(account_id, USER); - assert_eq!(curr_in, POOL_CURR); - assert_eq!(curr_out, USER_CURR); - assert_eq!(amount, AMOUNT); - assert_eq!(limit, DefaultTokenSellRatio::get()); - assert_eq!(min, AMOUNT); - Ok(ORDER_ID) - }, - ); + MockTokenSwaps::mock_place_order(|account_id, curr_in, curr_out, amount, limit| { + assert_eq!(account_id, USER); + assert_eq!(curr_in, POOL_CURR); + assert_eq!(curr_out, USER_CURR); + assert_eq!(amount, AMOUNT); + assert_eq!(limit, DefaultTokenSellRatio::get()); + Ok(ORDER_ID) + }); MockCurrencyConversion::mock_stable_to_stable(|curr_in, curr_out, amount_out| { assert_eq!(curr_in, POOL_CURR); assert_eq!(curr_out, USER_CURR); @@ -173,12 +170,11 @@ mod increase_investment { amount: INITIAL_AMOUNT, }) }); - MockTokenSwaps::mock_update_order(|account_id, order_id, amount, limit, min| { + MockTokenSwaps::mock_update_order(|account_id, order_id, amount, limit| { assert_eq!(account_id, USER); assert_eq!(order_id, ORDER_ID); assert_eq!(amount, INITIAL_AMOUNT + INCREASE_AMOUNT); assert_eq!(limit, DefaultTokenSellRatio::get()); - assert_eq!(min, INITIAL_AMOUNT + INCREASE_AMOUNT); Ok(()) }); MockCurrencyConversion::mock_stable_to_stable(|curr_in, curr_out, amount_out| { @@ -224,17 +220,14 @@ mod increase_investment { assert_eq!(order_id, ORDER_ID); false }); - MockTokenSwaps::mock_place_order( - |account_id, curr_in, curr_out, amount, limit, min| { - assert_eq!(account_id, USER); - assert_eq!(curr_in, POOL_CURR); - assert_eq!(curr_out, USER_CURR); - assert_eq!(amount, INCREASE_AMOUNT); - assert_eq!(limit, DefaultTokenSellRatio::get()); - assert_eq!(min, INCREASE_AMOUNT); - Ok(ORDER_ID) - }, - ); + MockTokenSwaps::mock_place_order(|account_id, curr_in, curr_out, amount, limit| { + assert_eq!(account_id, USER); + assert_eq!(curr_in, POOL_CURR); + assert_eq!(curr_out, USER_CURR); + assert_eq!(amount, INCREASE_AMOUNT); + assert_eq!(limit, DefaultTokenSellRatio::get()); + Ok(ORDER_ID) + }); MockInvestment::mock_update_investment(|_, _, amount| { assert_eq!(amount, 0); Ok(())