From d94f119a4efdaa67b526fcc4a684ff6be0324302 Mon Sep 17 00:00:00 2001 From: Martin Beckmann Date: Wed, 27 Mar 2024 17:18:13 +0100 Subject: [PATCH] Expect feePolicies --- src/api/routes/solve/dto/auction.rs | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/api/routes/solve/dto/auction.rs b/src/api/routes/solve/dto/auction.rs index 70115ec..83888b3 100644 --- a/src/api/routes/solve/dto/auction.rs +++ b/src/api/routes/solve/dto/auction.rs @@ -114,8 +114,38 @@ struct Order { kind: Kind, partially_fillable: bool, class: Class, + fee_policies: Option>, } +#[serde_as] +#[derive(Clone, Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum FeePolicy { + #[serde(rename_all = "camelCase")] + Surplus { factor: f64, max_volume_factor: f64 }, + #[serde(rename_all = "camelCase")] + PriceImprovement { + factor: f64, + max_volume_factor: f64, + quote: Quote, + }, + #[serde(rename_all = "camelCase")] + Volume { factor: f64 }, +} + +#[serde_as] +#[derive(Clone, Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Quote { + #[serde_as(as = "serialize::U256")] + pub sell_amount: eth::U256, + #[serde_as(as = "serialize::U256")] + pub buy_amount: eth::U256, + #[serde_as(as = "serialize::U256")] + pub fee: eth::U256, +} + + #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] enum Kind {