From 71721ba165c6b2909d75e528562e68b197d7c541 Mon Sep 17 00:00:00 2001 From: Branislav Kontur <bkontur@gmail.com> Date: Thu, 25 Jan 2024 12:58:24 +0100 Subject: [PATCH] [asset_conversion] adapt https://github.com/paritytech/polkadot-sdk/pull/1677 --- .../asset-hubs/asset-hub-kusama/src/lib.rs | 14 +++++++------- .../asset-hubs/asset-hub-kusama/src/xcm_config.rs | 7 +++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 440b6c3600..cac1ff132b 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -334,7 +334,6 @@ impl pallet_asset_conversion::Config for Runtime { type Balance = Balance; type HigherPrecisionBalance = sp_core::U256; type Currency = Balances; - type AssetBalance = Balance; type AssetId = MultiLocation; type Assets = LocalAndForeignAssets< Assets, @@ -351,7 +350,7 @@ impl pallet_asset_conversion::Config for Runtime { type PalletId = AssetConversionPalletId; type AllowMultiAssetPools = AllowMultiAssetPools; type MaxSwapPathLength = ConstU32<4>; - type MultiAssetId = Box<MultiLocation>; + type MultiAssetId = MultiLocation; type MultiAssetIdConverter = MultiLocationConverter<KsmLocation, LocalAndForeignAssetsMultiLocationMatcher>; type MintMinLiquidity = ConstU128<100>; @@ -1118,17 +1117,18 @@ impl_runtime_apis! { impl pallet_asset_conversion::AssetConversionApi< Block, Balance, - u128, - Box<MultiLocation>, + MultiLocation, > for Runtime { - fn quote_price_exact_tokens_for_tokens(asset1: Box<MultiLocation>, asset2: Box<MultiLocation>, amount: u128, include_fee: bool) -> Option<Balance> { + fn quote_price_exact_tokens_for_tokens(asset1: MultiLocation, asset2: MultiLocation, amount: Balance, include_fee: bool) -> Option<Balance> { AssetConversion::quote_price_exact_tokens_for_tokens(asset1, asset2, amount, include_fee) } - fn quote_price_tokens_for_exact_tokens(asset1: Box<MultiLocation>, asset2: Box<MultiLocation>, amount: u128, include_fee: bool) -> Option<Balance> { + + fn quote_price_tokens_for_exact_tokens(asset1: MultiLocation, asset2: MultiLocation, amount: Balance, include_fee: bool) -> Option<Balance> { AssetConversion::quote_price_tokens_for_exact_tokens(asset1, asset2, amount, include_fee) } - fn get_reserves(asset1: Box<MultiLocation>, asset2: Box<MultiLocation>) -> Option<(Balance, Balance)> { + + fn get_reserves(asset1: MultiLocation, asset2: MultiLocation) -> Option<(Balance, Balance)> { AssetConversion::get_reserves(&asset1, &asset2).ok() } } diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs index 9217ce70f9..b398975b01 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/xcm_config.rs @@ -689,8 +689,7 @@ pub struct BenchmarkMultiLocationConverter<SelfParaId> { } #[cfg(feature = "runtime-benchmarks")] -impl<SelfParaId> - pallet_asset_conversion::BenchmarkHelper<MultiLocation, sp_std::boxed::Box<MultiLocation>> +impl<SelfParaId> pallet_asset_conversion::BenchmarkHelper<MultiLocation, MultiLocation> for BenchmarkMultiLocationConverter<SelfParaId> where SelfParaId: Get<ParaId>, @@ -705,8 +704,8 @@ where ), } } - fn multiasset_id(asset_id: u32) -> sp_std::boxed::Box<MultiLocation> { - sp_std::boxed::Box::new(Self::asset_id(asset_id)) + fn multiasset_id(asset_id: u32) -> MultiLocation { + Self::asset_id(asset_id) } }