From a6465aad3e6209a3385f3b15c97eba2726f8e58a Mon Sep 17 00:00:00 2001 From: Ilja Khabarov Date: Fri, 19 Aug 2022 12:20:17 +0000 Subject: [PATCH] Add a few missing types. --- --- a/runtime/common/config/xcm.rs +++ b/runtime/common/config/xcm.rs @@ -35,7 +35,6 @@ Fungibility::Fungible as XcmFungible, MultiAsset, Error as XcmError, }; -use xcm_executor::traits::{Convert as ConvertXcm, MatchesFungible, WeightTrader}; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, LocationInverter, NativeAsset, ParentAsSuperuser, RelayChainAsNative, @@ -43,6 +42,7 @@ SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, ParentIsPreset, }; use xcm_executor::{Config, XcmExecutor, Assets}; +use xcm_executor::traits::{Convert as ConvertXcm, MatchesFungible, WeightTrader, FilterAssetLocation}; use pallet_foreing_assets::{ AssetIds, AssetIdMapping, XcmForeignAssetIdMapping, CurrencyId, NativeCurrency, UsingAnyCurrencyComponents, TryAsForeing, ForeignAssetId, @@ -356,6 +356,34 @@ #[cfg(not(feature = "foreign-assets"))] pub type AssetTransactors = LocalAssetTransactor; +#[cfg(feature = "foreign-assets")] +pub struct AllAsset; +#[cfg(feature = "foreign-assets")] +impl FilterAssetLocation for AllAsset { + fn filter_asset_location(asset: &MultiAsset, origin: &MultiLocation) -> bool { + true + } +} + +#[cfg(feature = "foreign-assets")] +pub type IsReserve = AllAsset; +#[cfg(not(feature = "foreign-assets"))] +pub type IsReserve = NativeAsset; + +#[cfg(feature = "foreign-assets")] +type Trader = + UsingAnyCurrencyComponents< + pallet_configuration::WeightToFee, + RelayLocation, AccountId, Balances, ()>; +#[cfg(not(feature = "foreign-assets"))] +type Trader = UsingOnlySelfCurrencyComponents< + pallet_configuration::WeightToFee, + RelayLocation, + AccountId, + Balances, + (), +>; + pub struct XcmConfig(PhantomData); impl Config for XcmConfig where @@ -366,18 +394,12 @@ // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; type OriginConverter = XcmOriginToTransactDispatchOrigin; - type IsReserve = NativeAsset; + type IsReserve = IsReserve; type IsTeleporter = (); // Teleportation is disabled type LocationInverter = LocationInverter; type Barrier = Barrier; type Weigher = FixedWeightBounds; - type Trader = UsingOnlySelfCurrencyComponents< - pallet_configuration::WeightToFee, - RelayLocation, - AccountId, - Balances, - (), - >; + type Trader = Trader; type ResponseHandler = (); // Don't handle responses for now. type SubscriptionService = PolkadotXcm; -- gitstuff