diff --git a/crates/driver/openapi.yml b/crates/driver/openapi.yml index b40dc64c42..9ebd19a778 100644 --- a/crates/driver/openapi.yml +++ b/crates/driver/openapi.yml @@ -533,6 +533,8 @@ components: $ref: "#/components/schemas/TokenAmount" buyAmount: $ref: "#/components/schemas/TokenAmount" + executedAmount: + $ref: "#/components/schemas/TokenAmount" receiver: $ref: "#/components/schemas/Address" validTo: diff --git a/crates/driver/src/domain/quote.rs b/crates/driver/src/domain/quote.rs index e2af74289e..b21ee0481b 100644 --- a/crates/driver/src/domain/quote.rs +++ b/crates/driver/src/domain/quote.rs @@ -33,7 +33,7 @@ pub struct Quote { pub gas: Option, /// Which `tx.origin` is required to make the quote simulation pass. pub tx_origin: Option, - pub jit_orders: Vec, + pub jit_orders: Vec, } impl Quote { @@ -77,7 +77,7 @@ impl Quote { .trades() .iter() .filter_map(|trade| match trade { - solution::Trade::Jit(jit) => Some(jit.order().clone()), + solution::Trade::Jit(jit) => Some(jit.clone()), _ => None, }) .collect(), diff --git a/crates/driver/src/infra/api/routes/quote/dto/quote.rs b/crates/driver/src/infra/api/routes/quote/dto/quote.rs index 8fa891bec7..8c44608ec9 100644 --- a/crates/driver/src/infra/api/routes/quote/dto/quote.rs +++ b/crates/driver/src/infra/api/routes/quote/dto/quote.rs @@ -78,6 +78,8 @@ struct JitOrder { sell_amount: eth::U256, #[serde_as(as = "serialize::U256")] buy_amount: eth::U256, + #[serde_as(as = "serialize::U256")] + executed_amount: eth::U256, receiver: eth::H160, valid_to: u32, #[serde_as(as = "serialize::Hex")] @@ -90,21 +92,22 @@ struct JitOrder { signing_scheme: SigningScheme, } -impl From for JitOrder { - fn from(jit: domain::competition::order::Jit) -> Self { +impl From for JitOrder { + fn from(jit: domain::competition::solution::trade::Jit) -> Self { Self { - sell_token: jit.sell.token.into(), - buy_token: jit.buy.token.into(), - sell_amount: jit.sell.amount.into(), - buy_amount: jit.buy.amount.into(), - receiver: jit.receiver.into(), - valid_to: jit.valid_to.into(), - app_data: jit.app_data.into(), - side: jit.side.into(), - sell_token_source: jit.sell_token_balance.into(), - buy_token_destination: jit.buy_token_balance.into(), - signature: jit.signature.data.into(), - signing_scheme: jit.signature.scheme.to_boundary_scheme(), + sell_token: jit.order().sell.token.into(), + buy_token: jit.order().buy.token.into(), + sell_amount: jit.order().sell.amount.into(), + buy_amount: jit.order().buy.amount.into(), + executed_amount: jit.executed().into(), + receiver: jit.order().receiver.into(), + valid_to: jit.order().valid_to.into(), + app_data: jit.order().app_data.into(), + side: jit.order().side.into(), + sell_token_source: jit.order().sell_token_balance.into(), + buy_token_destination: jit.order().buy_token_balance.into(), + signature: jit.order().signature.data.clone().into(), + signing_scheme: jit.order().signature.scheme.to_boundary_scheme(), } } } diff --git a/crates/shared/src/trade_finding/external.rs b/crates/shared/src/trade_finding/external.rs index 4fbe42accf..649d506119 100644 --- a/crates/shared/src/trade_finding/external.rs +++ b/crates/shared/src/trade_finding/external.rs @@ -228,6 +228,8 @@ mod dto { pub sell_amount: U256, #[serde_as(as = "HexOrDecimalU256")] pub buy_amount: U256, + #[serde_as(as = "HexOrDecimalU256")] + pub executed_amount: U256, pub receiver: H160, pub valid_to: u32, #[serde_as(as = "BytesHex")]