Skip to content

Commit

Permalink
Capped surplus partially fillable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
squadgazzz committed Mar 13, 2024
1 parent 9c9bf73 commit 2f844ef
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion crates/driver/src/tests/cases/protocol_fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ async fn surplus_protocol_fee_buy_order_capped() {
},
},
};

protocol_fee_test_case(test_case).await;
}

Expand Down Expand Up @@ -299,6 +298,66 @@ async fn surplus_protocol_fee_sell_order_capped() {
protocol_fee_test_case(test_case).await;
}

#[tokio::test]
#[ignore]
async fn surplus_protocol_fee_partial_buy_order_capped() {
let fee_policy = Policy::Surplus {
factor: 0.5,
// low enough so we get capped by volume fee
max_volume_factor: 0.2,
};
let test_case = TestCase {
fee_policy,
order: Order {
sell_amount: 50.ether().into_wei(),
buy_amount: 40.ether().into_wei(),
side: order::Side::Buy,
},
execution: Execution {
// Fee is capped at 20% of solver proposed sell volume
solver: Amounts {
sell: 25.ether().into_wei(),
buy: 28.ether().into_wei(),
},
driver: Amounts {
sell: 30.ether().into_wei(),
buy: 28.ether().into_wei(),
},
},
};
protocol_fee_test_case(test_case).await;
}

#[tokio::test]
#[ignore]
async fn surplus_protocol_fee_partial_sell_order_capped() {
let fee_policy = Policy::Surplus {
factor: 0.5,
// log enough so we get capped by volume fee
max_volume_factor: 0.1,
};
let test_case = TestCase {
fee_policy,
order: Order {
sell_amount: 50.ether().into_wei(),
buy_amount: 40.ether().into_wei(),
side: order::Side::Sell,
},
execution: Execution {
// Fee is capped at 10% of solver proposed buy volume
solver: Amounts {
sell: 25.ether().into_wei(),
buy: 26.ether().into_wei(),
},
driver: Amounts {
sell: 25.ether().into_wei(),
buy: "23.4".ether().into_wei(),
},
},
};
protocol_fee_test_case(test_case).await;
}

#[tokio::test]
#[ignore]
async fn volume_protocol_fee_buy_order() {
Expand Down

0 comments on commit 2f844ef

Please sign in to comment.