From 895d49be8a069c827867b6fdf067a1d91ef3e01a Mon Sep 17 00:00:00 2001 From: marcellorigotti Date: Fri, 8 Nov 2024 14:53:13 +0100 Subject: [PATCH 1/7] support cf_pool_swap_rate_v3 with old runtime --- state-chain/custom-rpc/src/lib.rs | 145 ++++++++++++++---------- state-chain/runtime/src/lib.rs | 6 +- state-chain/runtime/src/runtime_apis.rs | 24 +++- 3 files changed, 108 insertions(+), 67 deletions(-) diff --git a/state-chain/custom-rpc/src/lib.rs b/state-chain/custom-rpc/src/lib.rs index a8bc0cb48c..30c9d47e35 100644 --- a/state-chain/custom-rpc/src/lib.rs +++ b/state-chain/custom-rpc/src/lib.rs @@ -36,7 +36,7 @@ use pallet_cf_pools::{ use pallet_cf_swapping::SwapLegInfo; use sc_client_api::{BlockchainEvents, HeaderBackend}; use serde::{Deserialize, Serialize}; -use sp_api::{ApiError, CallApiAt}; +use sp_api::{ApiError, ApiExt, CallApiAt}; use sp_core::U256; use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT, UniqueSaturatedInto}, @@ -55,10 +55,11 @@ use state_chain_runtime::{ AuctionState, BoostPoolDepth, BoostPoolDetails, BrokerInfo, ChainAccounts, CustomRuntimeApi, DispatchErrorWithMessage, ElectoralRuntimeApi, FailingWitnessValidators, LiquidityProviderBoostPoolInfo, LiquidityProviderInfo, RuntimeApiPenalty, + SimulatedSwapInformationV2, TaintedTransactionEvents, ValidatorInfo, VaultSwapDetails, }, safe_mode::RuntimeSafeMode, - Hash, NetworkFee, SolanaInstance, + Block, Hash, NetworkFee, SolanaInstance, }; use std::{ collections::{BTreeMap, HashMap}, @@ -422,6 +423,29 @@ pub struct RpcSwapOutputV2 { pub egress_fee: RpcFee, pub broker_commission: RpcFee, } +fn into_rpc_swap_output( + simulated_swap_info_v2: SimulatedSwapInformationV2, + from_asset: Asset, + to_asset: Asset, +) -> RpcSwapOutputV2 { + RpcSwapOutputV2 { + intermediary: simulated_swap_info_v2.intermediary.map(Into::into), + output: simulated_swap_info_v2.output.into(), + network_fee: RpcFee { + asset: cf_primitives::STABLE_ASSET, + amount: simulated_swap_info_v2.network_fee.into(), + }, + ingress_fee: RpcFee { + asset: from_asset, + amount: simulated_swap_info_v2.ingress_fee.into(), + }, + egress_fee: RpcFee { asset: to_asset, amount: simulated_swap_info_v2.egress_fee.into() }, + broker_commission: RpcFee { + asset: cf_primitives::STABLE_ASSET, + amount: simulated_swap_info_v2.broker_fee.into(), + }, + } +} #[derive(Serialize, Deserialize, Clone)] pub enum SwapRateV2AdditionalOrder { @@ -1424,71 +1448,66 @@ where additional_orders: Option>, at: Option, ) -> RpcResult { + let amount = amount + .try_into() + .map_err(|_| "Swap input amount too large.") + .and_then(|amount: u128| { + if amount == 0 { + Err("Swap input amount cannot be zero.") + } else { + Ok(amount) + } + }) + .map_err(|s| ErrorObject::owned(ErrorCode::InvalidParams.code(), s, None::<()>))?; + let additional_orders = additional_orders.map(|additional_orders| { + additional_orders + .into_iter() + .map(|additional_order| match additional_order { + SwapRateV2AdditionalOrder::LimitOrder { + base_asset, + quote_asset, + side, + tick, + sell_amount, + } => + state_chain_runtime::runtime_apis::SimulateSwapAdditionalOrder::LimitOrder { + base_asset, + quote_asset, + side, + tick, + sell_amount: sell_amount.unique_saturated_into(), + }, + }) + .collect() + }); self.with_runtime_api(at, |api, hash| { - Ok::<_, CfApiError>( - api.cf_pool_simulate_swap( + if api.api_version::>(hash).unwrap().unwrap() < 2 { + let old_result = api.cf_pool_simulate_swap_before_version_2( hash, from_asset, to_asset, - amount - .try_into() - .map_err(|_| "Swap input amount too large.") - .and_then(|amount: u128| { - if amount == 0 { - Err("Swap input amount cannot be zero.") - } else { - Ok(amount) - } - }) - .map_err(|s| { - ErrorObject::owned(ErrorCode::InvalidParams.code(), s, None::<()>) - })?, - broker_commission, - dca_parameters, - additional_orders.map(|additional_orders| { - additional_orders - .into_iter() - .map(|additional_order| { - match additional_order { - SwapRateV2AdditionalOrder::LimitOrder { - base_asset, - quote_asset, - side, - tick, - sell_amount, - } => state_chain_runtime::runtime_apis::SimulateSwapAdditionalOrder::LimitOrder { - base_asset, - quote_asset, - side, - tick, - sell_amount: sell_amount.unique_saturated_into(), - } - } - }) - .collect() - }), - )? - .map(|simulated_swap_info_v2| RpcSwapOutputV2 { - intermediary: simulated_swap_info_v2.intermediary.map(Into::into), - output: simulated_swap_info_v2.output.into(), - network_fee: RpcFee { - asset: cf_primitives::STABLE_ASSET, - amount: simulated_swap_info_v2.network_fee.into(), - }, - ingress_fee: RpcFee { - asset: from_asset, - amount: simulated_swap_info_v2.ingress_fee.into(), - }, - egress_fee: RpcFee { - asset: to_asset, - amount: simulated_swap_info_v2.egress_fee.into(), - }, - broker_commission: RpcFee { - asset: cf_primitives::STABLE_ASSET, - amount: simulated_swap_info_v2.broker_fee.into(), - }, - })?, - ) + amount, + additional_orders, + )?; + Ok(old_result.map(|old_version| { + into_rpc_swap_output(old_version.into(), from_asset, to_asset) + })?) + } else { + Ok::<_, CfApiError>( + api.cf_pool_simulate_swap( + hash, + from_asset, + to_asset, + amount, + broker_commission, + dca_parameters, + additional_orders, + )? + .map(|simulated_swap_info_v2| { + into_rpc_swap_output(simulated_swap_info_v2, from_asset, to_asset) + })?, + ) + } }) } diff --git a/state-chain/runtime/src/lib.rs b/state-chain/runtime/src/lib.rs index b2ef836e1b..de8685e1e6 100644 --- a/state-chain/runtime/src/lib.rs +++ b/state-chain/runtime/src/lib.rs @@ -27,7 +27,7 @@ use crate::{ runtime_decl_for_custom_runtime_api::CustomRuntimeApi, AuctionState, BoostPoolDepth, BoostPoolDetails, BrokerInfo, DispatchErrorWithMessage, FailingWitnessValidators, LiquidityProviderBoostPoolInfo, LiquidityProviderInfo, RuntimeApiPenalty, - SimulateSwapAdditionalOrder, SimulatedSwapInformation, TaintedTransactionEvents, + SimulateSwapAdditionalOrder, SimulatedSwapInformationV2, TaintedTransactionEvents, ValidatorInfo, VaultSwapDetails, }, }; @@ -1510,7 +1510,7 @@ impl_runtime_apis! { broker_commission: BasisPoints, dca_parameters: Option, additional_orders: Option>, - ) -> Result { + ) -> Result { if let Some(additional_orders) = additional_orders { for (index, additional_order) in additional_orders.into_iter().enumerate() { match additional_order { @@ -1633,7 +1633,7 @@ impl_runtime_apis! { let (output, egress_fee) = remove_fees(IngressOrEgress::Egress, to, output); - Ok(SimulatedSwapInformation { + Ok(SimulatedSwapInformationV2 { intermediary, output, network_fee, diff --git a/state-chain/runtime/src/runtime_apis.rs b/state-chain/runtime/src/runtime_apis.rs index b92a4638e1..d6ec9c0b12 100644 --- a/state-chain/runtime/src/runtime_apis.rs +++ b/state-chain/runtime/src/runtime_apis.rs @@ -170,6 +170,28 @@ pub struct SimulatedSwapInformation { pub network_fee: AssetAmount, pub ingress_fee: AssetAmount, pub egress_fee: AssetAmount, +} + +impl From for SimulatedSwapInformationV2 { + fn from(value: SimulatedSwapInformation) -> Self { + SimulatedSwapInformationV2 { + intermediary: value.intermediary, + output: value.output, + network_fee: value.network_fee, + ingress_fee: value.ingress_fee, + egress_fee: value.egress_fee, + broker_fee: Default::default(), + } + } +} +/// Struct that represents the estimated output of a Swap. +#[derive(Encode, Decode, TypeInfo)] +pub struct SimulatedSwapInformationV2 { + pub intermediary: Option, + pub output: AssetAmount, + pub network_fee: AssetAmount, + pub ingress_fee: AssetAmount, + pub egress_fee: AssetAmount, pub broker_fee: AssetAmount, } @@ -307,7 +329,7 @@ decl_runtime_apis!( broker_commission: BasisPoints, dca_parameters: Option, additional_limit_orders: Option>, - ) -> Result; + ) -> Result; fn cf_pool_info( base_asset: Asset, quote_asset: Asset, From f1d5d7fc7f8893275e319f38b428568f55130b4f Mon Sep 17 00:00:00 2001 From: marcellorigotti Date: Thu, 14 Nov 2024 15:43:08 +0100 Subject: [PATCH 2/7] support cf_pool_swap_rate_v3 with old runtime --- Cargo.lock | 22 ++++++++++++++++++++++ Cargo.toml | 1 + state-chain/custom-rpc/src/lib.rs | 5 ++--- state-chain/runtime/Cargo.toml | 1 + state-chain/runtime/src/lib.rs | 6 +++--- state-chain/runtime/src/runtime_apis.rs | 25 ++++++++++--------------- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 441af10269..5f6049a272 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7456,6 +7456,27 @@ dependencies = [ "syn 2.0.79", ] +[[package]] +name = "obake" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c016d34f5be5713bfcaa23668b736865921606c2ddff17e158f0815e4cde091b" +dependencies = [ + "obake_macros", +] + +[[package]] +name = "obake_macros" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47056b8eb01b867a9fdc29f69c05799b9eafb50f73e440cafe624949e27cc7dc" +dependencies = [ + "proc-macro2", + "quote", + "semver 1.0.23", + "syn 1.0.109", +] + [[package]] name = "object" version = "0.30.4" @@ -13063,6 +13084,7 @@ dependencies = [ "hex-literal", "log", "nanorand", + "obake", "pallet-aura", "pallet-authorship", "pallet-cf-account-roles", diff --git a/Cargo.toml b/Cargo.toml index 0a765a32a5..1a6797d065 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,6 +162,7 @@ web3 = { version = "0.19" } x25519-dalek = { version = "2.0" } zeroize = { version = "1.7.0" } zmq = { git = "https://github.com/chainflip-io/rust-zmq.git", tag = "chainflip-v0.9.2+1" } +obake = { version = "1.0.5" } # PolkadotSdk Pallets pallet-aura = { git = "https://github.com/chainflip-io/polkadot-sdk.git", tag = "chainflip-substrate-1.15.2+2", default-features = false } diff --git a/state-chain/custom-rpc/src/lib.rs b/state-chain/custom-rpc/src/lib.rs index 30c9d47e35..af20ab9f78 100644 --- a/state-chain/custom-rpc/src/lib.rs +++ b/state-chain/custom-rpc/src/lib.rs @@ -55,8 +55,7 @@ use state_chain_runtime::{ AuctionState, BoostPoolDepth, BoostPoolDetails, BrokerInfo, ChainAccounts, CustomRuntimeApi, DispatchErrorWithMessage, ElectoralRuntimeApi, FailingWitnessValidators, LiquidityProviderBoostPoolInfo, LiquidityProviderInfo, RuntimeApiPenalty, - SimulatedSwapInformationV2, - TaintedTransactionEvents, ValidatorInfo, VaultSwapDetails, + SimulatedSwapInformation, TaintedTransactionEvents, ValidatorInfo, VaultSwapDetails, }, safe_mode::RuntimeSafeMode, Block, Hash, NetworkFee, SolanaInstance, @@ -424,7 +423,7 @@ pub struct RpcSwapOutputV2 { pub broker_commission: RpcFee, } fn into_rpc_swap_output( - simulated_swap_info_v2: SimulatedSwapInformationV2, + simulated_swap_info_v2: SimulatedSwapInformation, from_asset: Asset, to_asset: Asset, ) -> RpcSwapOutputV2 { diff --git a/state-chain/runtime/Cargo.toml b/state-chain/runtime/Cargo.toml index b70460b1a6..c6d04c315a 100644 --- a/state-chain/runtime/Cargo.toml +++ b/state-chain/runtime/Cargo.toml @@ -24,6 +24,7 @@ nanorand = { workspace = true, features = ["wyrand"] } serde = { workspace = true, features = ["derive", "alloc"] } ethabi = { workspace = true } bitvec = { workspace = true } +obake = { workspace = true } # Chainflip local dependencies cf-amm = { workspace = true } diff --git a/state-chain/runtime/src/lib.rs b/state-chain/runtime/src/lib.rs index de8685e1e6..b2ef836e1b 100644 --- a/state-chain/runtime/src/lib.rs +++ b/state-chain/runtime/src/lib.rs @@ -27,7 +27,7 @@ use crate::{ runtime_decl_for_custom_runtime_api::CustomRuntimeApi, AuctionState, BoostPoolDepth, BoostPoolDetails, BrokerInfo, DispatchErrorWithMessage, FailingWitnessValidators, LiquidityProviderBoostPoolInfo, LiquidityProviderInfo, RuntimeApiPenalty, - SimulateSwapAdditionalOrder, SimulatedSwapInformationV2, TaintedTransactionEvents, + SimulateSwapAdditionalOrder, SimulatedSwapInformation, TaintedTransactionEvents, ValidatorInfo, VaultSwapDetails, }, }; @@ -1510,7 +1510,7 @@ impl_runtime_apis! { broker_commission: BasisPoints, dca_parameters: Option, additional_orders: Option>, - ) -> Result { + ) -> Result { if let Some(additional_orders) = additional_orders { for (index, additional_order) in additional_orders.into_iter().enumerate() { match additional_order { @@ -1633,7 +1633,7 @@ impl_runtime_apis! { let (output, egress_fee) = remove_fees(IngressOrEgress::Egress, to, output); - Ok(SimulatedSwapInformationV2 { + Ok(SimulatedSwapInformation { intermediary, output, network_fee, diff --git a/state-chain/runtime/src/runtime_apis.rs b/state-chain/runtime/src/runtime_apis.rs index d6ec9c0b12..03be93b51e 100644 --- a/state-chain/runtime/src/runtime_apis.rs +++ b/state-chain/runtime/src/runtime_apis.rs @@ -163,6 +163,9 @@ pub struct BrokerInfo { } /// Struct that represents the estimated output of a Swap. +#[obake::versioned] +#[obake(version("0.1.0"))] +#[obake(version("0.2.0"))] #[derive(Encode, Decode, TypeInfo)] pub struct SimulatedSwapInformation { pub intermediary: Option, @@ -170,11 +173,13 @@ pub struct SimulatedSwapInformation { pub network_fee: AssetAmount, pub ingress_fee: AssetAmount, pub egress_fee: AssetAmount, + #[obake(cfg(">=0.2"))] + pub broker_fee: AssetAmount, } -impl From for SimulatedSwapInformationV2 { - fn from(value: SimulatedSwapInformation) -> Self { - SimulatedSwapInformationV2 { +impl From for SimulatedSwapInformation { + fn from(value: SimulatedSwapInformation!("0.1.0")) -> Self { + Self { intermediary: value.intermediary, output: value.output, network_fee: value.network_fee, @@ -184,16 +189,6 @@ impl From for SimulatedSwapInformationV2 { } } } -/// Struct that represents the estimated output of a Swap. -#[derive(Encode, Decode, TypeInfo)] -pub struct SimulatedSwapInformationV2 { - pub intermediary: Option, - pub output: AssetAmount, - pub network_fee: AssetAmount, - pub ingress_fee: AssetAmount, - pub egress_fee: AssetAmount, - pub broker_fee: AssetAmount, -} #[derive(Debug, Decode, Encode, TypeInfo)] pub enum DispatchErrorWithMessage { @@ -321,7 +316,7 @@ decl_runtime_apis!( to: Asset, amount: AssetAmount, additional_limit_orders: Option>, - ) -> Result; + ) -> Result; fn cf_pool_simulate_swap( from: Asset, to: Asset, @@ -329,7 +324,7 @@ decl_runtime_apis!( broker_commission: BasisPoints, dca_parameters: Option, additional_limit_orders: Option>, - ) -> Result; + ) -> Result; fn cf_pool_info( base_asset: Asset, quote_asset: Asset, From 29d2c9a6dd285dd128be4308351027b955908c90 Mon Sep 17 00:00:00 2001 From: marcellorigotti Date: Thu, 14 Nov 2024 15:56:33 +0100 Subject: [PATCH 3/7] rename --- state-chain/custom-rpc/src/lib.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/state-chain/custom-rpc/src/lib.rs b/state-chain/custom-rpc/src/lib.rs index af20ab9f78..2562335e0f 100644 --- a/state-chain/custom-rpc/src/lib.rs +++ b/state-chain/custom-rpc/src/lib.rs @@ -423,25 +423,22 @@ pub struct RpcSwapOutputV2 { pub broker_commission: RpcFee, } fn into_rpc_swap_output( - simulated_swap_info_v2: SimulatedSwapInformation, + simulated_swap_info: SimulatedSwapInformation, from_asset: Asset, to_asset: Asset, ) -> RpcSwapOutputV2 { RpcSwapOutputV2 { - intermediary: simulated_swap_info_v2.intermediary.map(Into::into), - output: simulated_swap_info_v2.output.into(), + intermediary: simulated_swap_info.intermediary.map(Into::into), + output: simulated_swap_info.output.into(), network_fee: RpcFee { asset: cf_primitives::STABLE_ASSET, - amount: simulated_swap_info_v2.network_fee.into(), + amount: simulated_swap_info.network_fee.into(), }, - ingress_fee: RpcFee { - asset: from_asset, - amount: simulated_swap_info_v2.ingress_fee.into(), - }, - egress_fee: RpcFee { asset: to_asset, amount: simulated_swap_info_v2.egress_fee.into() }, + ingress_fee: RpcFee { asset: from_asset, amount: simulated_swap_info.ingress_fee.into() }, + egress_fee: RpcFee { asset: to_asset, amount: simulated_swap_info.egress_fee.into() }, broker_commission: RpcFee { asset: cf_primitives::STABLE_ASSET, - amount: simulated_swap_info_v2.broker_fee.into(), + amount: simulated_swap_info.broker_fee.into(), }, } } From 442d7aa46473e1d5e9da6c5a32dec8e0627fff07 Mon Sep 17 00:00:00 2001 From: dandanlen <3168260+dandanlen@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:44:22 +0100 Subject: [PATCH 4/7] Update state-chain/runtime/src/runtime_apis.rs --- state-chain/runtime/src/runtime_apis.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-chain/runtime/src/runtime_apis.rs b/state-chain/runtime/src/runtime_apis.rs index 03be93b51e..5a2e9ccc1e 100644 --- a/state-chain/runtime/src/runtime_apis.rs +++ b/state-chain/runtime/src/runtime_apis.rs @@ -178,7 +178,7 @@ pub struct SimulatedSwapInformation { } impl From for SimulatedSwapInformation { - fn from(value: SimulatedSwapInformation!("0.1.0")) -> Self { + fn from(value: SimulatedSwapInformation!["0.1.0"]) -> Self { Self { intermediary: value.intermediary, output: value.output, From b4d709bb2355c8e311b698df98da6952a5807cf8 Mon Sep 17 00:00:00 2001 From: marcellorigotti Date: Tue, 19 Nov 2024 14:42:45 +0100 Subject: [PATCH 5/7] use release versions --- state-chain/runtime/src/runtime_apis.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/state-chain/runtime/src/runtime_apis.rs b/state-chain/runtime/src/runtime_apis.rs index 5a2e9ccc1e..7bead7bf1e 100644 --- a/state-chain/runtime/src/runtime_apis.rs +++ b/state-chain/runtime/src/runtime_apis.rs @@ -164,8 +164,8 @@ pub struct BrokerInfo { /// Struct that represents the estimated output of a Swap. #[obake::versioned] -#[obake(version("0.1.0"))] -#[obake(version("0.2.0"))] +#[obake(version("1.6.0"))] +#[obake(version("1.7.0"))] #[derive(Encode, Decode, TypeInfo)] pub struct SimulatedSwapInformation { pub intermediary: Option, @@ -173,12 +173,12 @@ pub struct SimulatedSwapInformation { pub network_fee: AssetAmount, pub ingress_fee: AssetAmount, pub egress_fee: AssetAmount, - #[obake(cfg(">=0.2"))] + #[obake(cfg(">=1.7"))] pub broker_fee: AssetAmount, } -impl From for SimulatedSwapInformation { - fn from(value: SimulatedSwapInformation!["0.1.0"]) -> Self { +impl From for SimulatedSwapInformation { + fn from(value: SimulatedSwapInformation!("1.6.0")) -> Self { Self { intermediary: value.intermediary, output: value.output, @@ -316,7 +316,7 @@ decl_runtime_apis!( to: Asset, amount: AssetAmount, additional_limit_orders: Option>, - ) -> Result; + ) -> Result; fn cf_pool_simulate_swap( from: Asset, to: Asset, From 4e10810efb2a2dede07c6d5aa6541425d968bdb6 Mon Sep 17 00:00:00 2001 From: marcellorigotti Date: Tue, 19 Nov 2024 14:45:01 +0100 Subject: [PATCH 6/7] () -> [] --- state-chain/runtime/src/runtime_apis.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-chain/runtime/src/runtime_apis.rs b/state-chain/runtime/src/runtime_apis.rs index 7bead7bf1e..abf12568c4 100644 --- a/state-chain/runtime/src/runtime_apis.rs +++ b/state-chain/runtime/src/runtime_apis.rs @@ -178,7 +178,7 @@ pub struct SimulatedSwapInformation { } impl From for SimulatedSwapInformation { - fn from(value: SimulatedSwapInformation!("1.6.0")) -> Self { + fn from(value: SimulatedSwapInformation!["1.6.0"]) -> Self { Self { intermediary: value.intermediary, output: value.output, From d46eeb8c267068099a7eeb78de66425fe8406f77 Mon Sep 17 00:00:00 2001 From: marcellorigotti Date: Tue, 19 Nov 2024 15:12:08 +0100 Subject: [PATCH 7/7] use 1.0.0 and 2.0.0 instead --- state-chain/runtime/src/runtime_apis.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/state-chain/runtime/src/runtime_apis.rs b/state-chain/runtime/src/runtime_apis.rs index abf12568c4..fab669a164 100644 --- a/state-chain/runtime/src/runtime_apis.rs +++ b/state-chain/runtime/src/runtime_apis.rs @@ -164,8 +164,8 @@ pub struct BrokerInfo { /// Struct that represents the estimated output of a Swap. #[obake::versioned] -#[obake(version("1.6.0"))] -#[obake(version("1.7.0"))] +#[obake(version("1.0.0"))] +#[obake(version("2.0.0"))] #[derive(Encode, Decode, TypeInfo)] pub struct SimulatedSwapInformation { pub intermediary: Option, @@ -173,12 +173,12 @@ pub struct SimulatedSwapInformation { pub network_fee: AssetAmount, pub ingress_fee: AssetAmount, pub egress_fee: AssetAmount, - #[obake(cfg(">=1.7"))] + #[obake(cfg(">=2.0"))] pub broker_fee: AssetAmount, } -impl From for SimulatedSwapInformation { - fn from(value: SimulatedSwapInformation!["1.6.0"]) -> Self { +impl From for SimulatedSwapInformation { + fn from(value: SimulatedSwapInformation!["1.0.0"]) -> Self { Self { intermediary: value.intermediary, output: value.output, @@ -316,7 +316,7 @@ decl_runtime_apis!( to: Asset, amount: AssetAmount, additional_limit_orders: Option>, - ) -> Result; + ) -> Result; fn cf_pool_simulate_swap( from: Asset, to: Asset,