@@ -6,7 +6,7 @@ use crate as orml_xtokens;
66
77use frame_support:: {
88 construct_runtime, derive_impl, ensure, parameter_types,
9- traits:: { ConstU128 , ConstU32 , Contains , Everything , Get , Nothing } ,
9+ traits:: { ConstU128 , ConstU32 , Contains , ContainsPair , Everything , Get , Nothing } ,
1010} ;
1111use frame_system:: EnsureRoot ;
1212use pallet_xcm:: XcmPassthrough ;
@@ -16,7 +16,7 @@ use sp_runtime::{
1616 traits:: { Convert , IdentityLookup } ,
1717 AccountId32 ,
1818} ;
19- use sp_std:: cell:: RefCell ;
19+ use sp_std:: { cell:: RefCell , marker :: PhantomData } ;
2020use xcm:: v4:: { prelude:: * , Weight } ;
2121use xcm_builder:: {
2222 AccountId32Aliases , EnsureXcmOrigin , FixedWeightBounds , NativeAsset , ParentIsPreset , RelayChainAsNative ,
@@ -26,8 +26,11 @@ use xcm_builder::{
2626use xcm_executor:: { Config , XcmExecutor } ;
2727
2828use crate :: mock:: AllTokensAreCreatedEqualToWeight ;
29- use orml_traits:: { location:: AbsoluteReserveProvider , parameter_type_with_key, RateLimiterError } ;
30- use orml_xcm_support:: { IsNativeConcrete , MultiCurrencyAdapter , MultiNativeAsset } ;
29+ use orml_traits:: {
30+ location:: { AbsoluteReserveProvider , Reserve } ,
31+ parameter_type_with_key, RateLimiterError ,
32+ } ;
33+ use orml_xcm_support:: { IsNativeConcrete , MultiCurrencyAdapter } ;
3134
3235pub type AccountId = AccountId32 ;
3336
@@ -117,6 +120,25 @@ parameter_types! {
117120 pub const MaxAssetsIntoHolding : u32 = 64 ;
118121}
119122
123+ pub struct MultiNativeAsset < ReserveProvider > ( PhantomData < ReserveProvider > ) ;
124+ impl < ReserveProvider > ContainsPair < Asset , Location > for MultiNativeAsset < ReserveProvider >
125+ where
126+ ReserveProvider : Reserve ,
127+ {
128+ fn contains ( asset : & Asset , origin : & Location ) -> bool {
129+ if let Some ( ref reserve) = ReserveProvider :: reserve ( asset) {
130+ if reserve == origin {
131+ return true ;
132+ }
133+ }
134+ // allow parachain to be reserved of relay to bypass https://github.com/paritytech/polkadot-sdk/pull/5660
135+ if asset. id . 0 == Location :: parent ( ) {
136+ return true ;
137+ }
138+ false
139+ }
140+ }
141+
120142pub struct XcmConfig ;
121143impl Config for XcmConfig {
122144 type RuntimeCall = RuntimeCall ;
0 commit comments