diff --git a/crates/solvers/src/boundary/legacy.rs b/crates/solvers/src/boundary/legacy.rs index 2b9c906ccb..024498f4b2 100644 --- a/crates/solvers/src/boundary/legacy.rs +++ b/crates/solvers/src/boundary/legacy.rs @@ -405,9 +405,12 @@ fn to_domain_solution( order::Side::Buy => execution.exec_buy_amount, order::Side::Sell => execution.exec_sell_amount, }, - match execution.exec_fee_amount { - Some(fee) => solution::Fee::Surplus(fee), - None => solution::Fee::Protocol, + match order.solver_determines_fee() { + true => execution + .exec_fee_amount + .map(solution::Fee::Surplus) + .context("no surplus fee")?, + false => solution::Fee::Protocol, }, ) .context("invalid trade execution")?, diff --git a/crates/solvers/src/tests/legacy/market_order.rs b/crates/solvers/src/tests/legacy/market_order.rs index 68988df844..52f7ed3722 100644 --- a/crates/solvers/src/tests/legacy/market_order.rs +++ b/crates/solvers/src/tests/legacy/market_order.rs @@ -91,6 +91,7 @@ async fn quote() { "0": { "exec_sell_amount": "133700000000000000", "exec_buy_amount": "6000000000000000000000", + "exec_fee_amount": "6900000000000000" } }, "prices": { @@ -295,6 +296,7 @@ async fn solve() { "0": { "exec_sell_amount": "133700000000000000", "exec_buy_amount": "6000000000000000000000", + "exec_fee_amount": "6900000000000000", } }, "prices": {