From 67b23fade36565b0497af9555b4499f5a6d9f8a5 Mon Sep 17 00:00:00 2001 From: Liam Aharon <liam.aharon@hotmail.com> Date: Mon, 15 Apr 2024 10:04:31 +0400 Subject: [PATCH] finish merging location refactor --- .../runtimes/assets/asset-hub-rococo/src/lib.rs | 5 ++--- .../assets/asset-hub-rococo/src/xcm_config.rs | 2 ++ .../runtimes/assets/asset-hub-westend/src/lib.rs | 5 ++--- .../assets/asset-hub-westend/src/xcm_config.rs | 2 ++ cumulus/parachains/runtimes/assets/common/src/lib.rs | 11 ++--------- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 942f8cf8639..8df40f677f6 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -31,8 +31,7 @@ use assets_common::{ foreign_creators::ForeignCreators, local_and_foreign_assets::{LocalFromLeft, TargetFromLeft}, matching::{FromNetwork, FromSiblingParachain}, - AssetIdForPoolAssets, AssetIdForPoolAssetsConvertV3Location, - AssetIdForTrustBackedAssetsConvert, + AssetIdForPoolAssets, AssetIdForPoolAssetsConvert, AssetIdForTrustBackedAssetsConvert, }; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; use cumulus_primitives_core::AggregateMessageOrigin; @@ -346,7 +345,7 @@ pub type NativeAndAllAssets = fungibles::UnionOf< PoolAssets, NativeAndNonPoolAssets, LocalFromLeft< - AssetIdForPoolAssetsConvertV3Location<PoolAssetsPalletLocationV3>, + AssetIdForPoolAssetsConvert<PoolAssetsPalletLocationV3, xcm::v3::Location>, AssetIdForPoolAssets, xcm::v3::Location, >, diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index c464fec4edd..4e525261931 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -76,6 +76,8 @@ parameter_types! { pub TrustBackedAssetsPalletIndex: u8 = <Assets as PalletInfoAccess>::index() as u8; pub TrustBackedAssetsPalletLocationV3: xcm::v3::Location = xcm::v3::Junction::PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into(); + pub PoolAssetsPalletLocationV3: xcm::v3::Location = + xcm::v3::Junction::PalletInstance(<PoolAssets as PalletInfoAccess>::index() as u8).into(); pub ForeignAssetsPalletLocation: Location = PalletInstance(<ForeignAssets as PalletInfoAccess>::index() as u8).into(); pub PoolAssetsPalletLocation: Location = diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 35b73d89dcd..b6b4f7eab3d 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -29,8 +29,7 @@ pub mod xcm_config; use assets_common::{ local_and_foreign_assets::{LocalFromLeft, TargetFromLeft}, - AssetIdForPoolAssets, AssetIdForPoolAssetsConvertV3Location, - AssetIdForTrustBackedAssetsConvert, + AssetIdForPoolAssets, AssetIdForPoolAssetsConvert, AssetIdForTrustBackedAssetsConvert, }; use codec::{Decode, Encode, MaxEncodedLen}; use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; @@ -326,7 +325,7 @@ pub type NativeAndAllAssets = fungibles::UnionOf< PoolAssets, NativeAndNonPoolAssets, LocalFromLeft< - AssetIdForPoolAssetsConvertV3Location<PoolAssetsPalletLocationV3>, + AssetIdForPoolAssetsConvert<PoolAssetsPalletLocationV3, xcm::v3::Location>, AssetIdForPoolAssets, xcm::v3::Location, >, diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index 9ba07ccdc03..7105925fc9f 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -73,6 +73,8 @@ parameter_types! { pub TrustBackedAssetsPalletIndex: u8 = <Assets as PalletInfoAccess>::index() as u8; pub TrustBackedAssetsPalletLocationV3: xcm::v3::Location = xcm::v3::Junction::PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into(); + pub PoolAssetsPalletLocationV3: xcm::v3::Location = + xcm::v3::Junction::PalletInstance(<PoolAssets as PalletInfoAccess>::index() as u8).into(); pub ForeignAssetsPalletLocation: Location = PalletInstance(<ForeignAssets as PalletInfoAccess>::index() as u8).into(); pub PoolAssetsPalletLocation: Location = diff --git a/cumulus/parachains/runtimes/assets/common/src/lib.rs b/cumulus/parachains/runtimes/assets/common/src/lib.rs index 1b99549619a..24c9a863981 100644 --- a/cumulus/parachains/runtimes/assets/common/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/common/src/lib.rs @@ -119,17 +119,10 @@ pub type ForeignAssetsConvertedConcreteId< >; pub type AssetIdForPoolAssets = u32; -/// `Location` vs `AssetIdForPoolAssets` converter for `PoolAssets` with explicit `v3 Location`. -pub type AssetIdForPoolAssetsConvertV3Location<PoolAssetsPalletLocation> = AsPrefixedGeneralIndex< - PoolAssetsPalletLocation, - AssetIdForPoolAssets, - JustTry, - xcm::v3::Location, ->; /// `Location` vs `AssetIdForPoolAssets` converter for `PoolAssets`. -pub type AssetIdForPoolAssetsConvert<PoolAssetsPalletLocation> = - AsPrefixedGeneralIndex<PoolAssetsPalletLocation, AssetIdForPoolAssets, TryConvertInto>; +pub type AssetIdForPoolAssetsConvert<PoolAssetsPalletLocation, L = Location> = + AsPrefixedGeneralIndex<PoolAssetsPalletLocation, AssetIdForPoolAssets, TryConvertInto, L>; /// [`MatchedConvertedConcreteId`] converter dedicated for `PoolAssets` pub type PoolAssetsConvertedConcreteId<PoolAssetsPalletLocation, Balance> = MatchedConvertedConcreteId< -- GitLab