@@ -3,7 +3,7 @@ use crate as orml_xtokens;
3
3
4
4
use frame_support:: {
5
5
construct_runtime, derive_impl, parameter_types,
6
- traits:: { ConstU128 , ConstU32 , Contains , Everything , Get , Nothing } ,
6
+ traits:: { ConstU128 , ConstU32 , Contains , ContainsPair , Everything , Get , Nothing } ,
7
7
} ;
8
8
use frame_system:: EnsureRoot ;
9
9
use pallet_xcm:: XcmPassthrough ;
@@ -12,6 +12,7 @@ use sp_runtime::{
12
12
traits:: { Convert , IdentityLookup } ,
13
13
AccountId32 , BoundedVec ,
14
14
} ;
15
+ use sp_std:: marker:: PhantomData ;
15
16
use xcm:: v4:: { prelude:: * , Weight } ;
16
17
use xcm_builder:: {
17
18
AccountId32Aliases , AllowTopLevelPaidExecutionFrom , EnsureXcmOrigin , FixedWeightBounds , ParentIsPreset ,
@@ -22,10 +23,10 @@ use xcm_executor::{Config, XcmExecutor};
22
23
23
24
use crate :: mock:: AllTokensAreCreatedEqualToWeight ;
24
25
use orml_traits:: {
25
- location:: { AbsoluteReserveProvider , RelativeReserveProvider } ,
26
+ location:: { AbsoluteReserveProvider , RelativeReserveProvider , Reservegit } ,
26
27
parameter_type_with_key,
27
28
} ;
28
- use orml_xcm_support:: { IsNativeConcrete , MultiCurrencyAdapter , MultiNativeAsset } ;
29
+ use orml_xcm_support:: { IsNativeConcrete , MultiCurrencyAdapter } ;
29
30
30
31
pub type AccountId = AccountId32 ;
31
32
@@ -115,6 +116,25 @@ parameter_types! {
115
116
pub const MaxAssetsIntoHolding : u32 = 64 ;
116
117
}
117
118
119
+ pub struct MultiNativeAsset < ReserveProvider > ( PhantomData < ReserveProvider > ) ;
120
+ impl < ReserveProvider > ContainsPair < Asset , Location > for MultiNativeAsset < ReserveProvider >
121
+ where
122
+ ReserveProvider : Reserve ,
123
+ {
124
+ fn contains ( asset : & Asset , origin : & Location ) -> bool {
125
+ if let Some ( ref reserve) = ReserveProvider :: reserve ( asset) {
126
+ if reserve == origin {
127
+ return true ;
128
+ }
129
+ }
130
+ // allow parachain to be reserved of relay to bypass https://github.com/paritytech/polkadot-sdk/pull/5660
131
+ if asset. id . 0 == Location :: parent ( ) {
132
+ return true ;
133
+ }
134
+ false
135
+ }
136
+ }
137
+
118
138
pub struct XcmConfig ;
119
139
impl Config for XcmConfig {
120
140
type RuntimeCall = RuntimeCall ;
0 commit comments