diff --git a/crates/driver/src/tests/cases/protocol_fees.rs b/crates/driver/src/tests/cases/protocol_fees.rs index 57d6187e54..b6a91a1c38 100644 --- a/crates/driver/src/tests/cases/protocol_fees.rs +++ b/crates/driver/src/tests/cases/protocol_fees.rs @@ -192,8 +192,8 @@ async fn volume_protocol_fee_sell_order() { #[tokio::test] #[ignore] async fn price_improvement_fee_buy_out_market_order() { - let quote_sell_amount = 21000000000000000000u128; - let quote_buy_amount = 18000000000000000000u128; + let quote_sell_amount = 50000000000000000000u128; + let quote_buy_amount = 45000000000000000000u128; let fee_policy = FeePolicy::PriceImprovement { factor: 0.5, // high enough so we don't get capped by volume fee @@ -204,18 +204,18 @@ async fn price_improvement_fee_buy_out_market_order() { fee: 1000000000000000000u128.into(), }, }; - let executed_buy = 17143028023069342830u128; let test_case = TestCase { order_side: order::Side::Buy, fee_policy, - order_sell_amount: 20000000000000000000u128.into(), + order_sell_amount: 50000000000000000000u128.into(), solver_fee: Some(10000000000000000000u128.into()), quote_sell_amount: quote_sell_amount.into(), quote_buy_amount: quote_buy_amount.into(), - executed: executed_buy.into(), - executed_sell_amount: 20476294902986820618u128.into(), - // executed buy amount should match order buy amount - executed_buy_amount: executed_buy.into(), + executed: quote_buy_amount.into(), + // sell amount + quote fee * factor + executed_sell_amount: 50500000000000000000u128.into(), + // executed buy amount should match quote buy amount + executed_buy_amount: quote_buy_amount.into(), }; protocol_fee_test_case(test_case).await; @@ -224,8 +224,8 @@ async fn price_improvement_fee_buy_out_market_order() { #[tokio::test] #[ignore] async fn price_improvement_fee_sell_out_market_order() { - let quote_sell_amount = 21000000000000000000u128; - let quote_buy_amount = 18000000000000000000u128; + let quote_sell_amount = 50000000000000000000u128; + let quote_buy_amount = 45000000000000000000u128; let fee_policy = FeePolicy::PriceImprovement { factor: 0.5, // high enough so we don't get capped by volume fee @@ -236,7 +236,7 @@ async fn price_improvement_fee_sell_out_market_order() { fee: 1000000000000000000u128.into(), }, }; - let order_sell_amount = 20000000000000000000u128; + let order_sell_amount = 50000000000000000000u128; let test_case = TestCase { order_side: order::Side::Sell, fee_policy, @@ -244,10 +244,10 @@ async fn price_improvement_fee_sell_out_market_order() { solver_fee: Some(10000000000000000000u128.into()), quote_sell_amount: quote_sell_amount.into(), quote_buy_amount: quote_buy_amount.into(), - executed: 10000000000000000000u128.into(), + executed: 40000000000000000000u128.into(), // executed sell amount should match order sell amount executed_sell_amount: order_sell_amount.into(), - executed_buy_amount: 16753332193352853234u128.into(), + executed_buy_amount: 44558823529411764706u128.into(), }; protocol_fee_test_case(test_case).await; @@ -256,8 +256,8 @@ async fn price_improvement_fee_sell_out_market_order() { #[tokio::test] #[ignore] async fn price_improvement_fee_buy_in_market_order() { - let quote_sell_amount = 17000000000000000000u128; - let quote_buy_amount = 10000000000000000000u128; + let quote_sell_amount = 50000000000000000000u128; + let quote_buy_amount = 45000000000000000000u128; let fee_policy = FeePolicy::PriceImprovement { factor: 0.5, // high enough so we don't get capped by volume fee @@ -265,21 +265,20 @@ async fn price_improvement_fee_buy_in_market_order() { quote: PriceImprovementQuote { sell_amount: quote_sell_amount.into(), buy_amount: quote_buy_amount.into(), - fee: 1000000000000000000u128.into(), + fee: 20000000000000000000u128.into(), }, }; - let executed_buy_amount = 11764354070151352996u128; let test_case = TestCase { order_side: order::Side::Buy, fee_policy, - order_sell_amount: 20000000000000000000u128.into(), + order_sell_amount: 50000000000000000000u128.into(), solver_fee: Some(10000000000000000000u128.into()), quote_sell_amount: quote_sell_amount.into(), quote_buy_amount: quote_buy_amount.into(), - executed: executed_buy_amount.into(), - executed_sell_amount: 20587918663136217696u128.into(), + executed: quote_buy_amount.into(), + executed_sell_amount: 60000000000000000000u128.into(), // executed buy amount should match order buy amount - executed_buy_amount: executed_buy_amount.into(), + executed_buy_amount: quote_buy_amount.into(), }; protocol_fee_test_case(test_case).await; @@ -288,8 +287,8 @@ async fn price_improvement_fee_buy_in_market_order() { #[tokio::test] #[ignore] async fn price_improvement_fee_sell_in_market_order() { - let quote_sell_amount = 9000000000000000000u128; - let quote_buy_amount = 25000000000000000000u128; + let quote_sell_amount = 50000000000000000000u128; + let quote_buy_amount = 45000000000000000000u128; let fee_policy = FeePolicy::PriceImprovement { factor: 0.5, // high enough so we don't get capped by volume fee @@ -297,21 +296,21 @@ async fn price_improvement_fee_sell_in_market_order() { quote: PriceImprovementQuote { sell_amount: quote_sell_amount.into(), buy_amount: quote_buy_amount.into(), - fee: 1000000000000000000u128.into(), + fee: 20000000000000000000u128.into(), }, }; - let order_sell_amount = 10000000000000000000u128; + let order_sell_amount = 50000000000000000000u128; let test_case = TestCase { order_side: order::Side::Sell, fee_policy, order_sell_amount: order_sell_amount.into(), - solver_fee: Some(5000000000000000000u128.into()), + solver_fee: Some(10000000000000000000u128.into()), quote_sell_amount: quote_sell_amount.into(), quote_buy_amount: quote_buy_amount.into(), - executed: 5000000000000000000u128.into(), + executed: 40000000000000000000u128.into(), // executed sell amount should match order sell amount executed_sell_amount: order_sell_amount.into(), - executed_buy_amount: 26388750430470970935u128.into(), + executed_buy_amount: 38571428571428571429u128.into(), }; protocol_fee_test_case(test_case).await;