git.delta.rocks / unique-network / refs/commits / 568279d1cd8f

difftreelog

refactor move common xcm parts to common

Daniel Shiposha2022-09-06parent: #25b276d.patch.diff
in: master

7 files changed

modifiedruntime/common/config/orml.rsdiffbeforeafterboth
--- a/runtime/common/config/orml.rs
+++ b/runtime/common/config/orml.rs
@@ -14,19 +14,87 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-use frame_support::parameter_types;
+use frame_support::{
+	parameter_types,
+	traits::{Contains, Everything},
+	weights::Weight,
+};
 use frame_system::EnsureSigned;
-use crate::{Runtime, Event, RelayChainBlockNumberProvider};
+use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};
+use sp_runtime::traits::Convert;
+use xcm::v1::{Junction::*, Junctions::*, MultiLocation, NetworkId};
+use xcm_builder::LocationInverter;
+use xcm_executor::XcmExecutor;
+use sp_std::{vec, vec::Vec};
+use pallet_foreing_assets::{CurrencyId, NativeCurrency};
+use crate::{
+	Runtime, Event, RelayChainBlockNumberProvider,
+	runtime_common::config::{
+		xcm::{
+			SelfLocation, Weigher, XcmConfig, Ancestry,
+			xcm_assets::{CurrencyIdConvert},
+		},
+		pallets::TreasuryAccountId,
+		substrate::{MaxLocks, MaxReserves},
+	},
+};
+
 use up_common::{
 	types::{AccountId, Balance},
 	constants::*,
 };
 
+// Signed version of balance
+pub type Amount = i128;
+
 parameter_types! {
 	pub const MinVestedTransfer: Balance = 10 * UNIQUE;
 	pub const MaxVestingSchedules: u32 = 28;
+
+	pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this
+	pub const MaxAssetsForTransfer: usize = 2;
+}
+
+parameter_type_with_key! {
+	pub ParachainMinFee: |_location: MultiLocation| -> Option<u128> {
+		Some(100_000_000_000)
+	};
+}
+
+parameter_type_with_key! {
+	pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {
+		match currency_id {
+			CurrencyId::NativeAssetId(symbol) => match symbol {
+				NativeCurrency::Here => 0,
+				NativeCurrency::Parent=> 0,
+			},
+			_ => 100_000
+		}
+	};
+}
+
+pub fn get_all_module_accounts() -> Vec<AccountId> {
+	vec![TreasuryAccountId::get()]
 }
 
+pub struct DustRemovalWhitelist;
+impl Contains<AccountId> for DustRemovalWhitelist {
+	fn contains(a: &AccountId) -> bool {
+		get_all_module_accounts().contains(a)
+	}
+}
+
+pub struct AccountIdToMultiLocation;
+impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {
+	fn convert(account: AccountId) -> MultiLocation {
+		X1(AccountId32 {
+			network: NetworkId::Any,
+			id: account.into(),
+		})
+		.into()
+	}
+}
+
 impl orml_vesting::Config for Runtime {
 	type Event = Event;
 	type Currency = pallet_balances::Pallet<Runtime>;
@@ -36,3 +104,38 @@
 	type MaxVestingSchedules = MaxVestingSchedules;
 	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
 }
+
+impl orml_tokens::Config for Runtime {
+	type Event = Event;
+	type Balance = Balance;
+	type Amount = Amount;
+	type CurrencyId = CurrencyId;
+	type WeightInfo = ();
+	type ExistentialDeposits = ExistentialDeposits;
+	type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccountId>;
+	type MaxLocks = MaxLocks;
+	type MaxReserves = MaxReserves;
+	// TODO: Add all module accounts
+	type DustRemovalWhitelist = DustRemovalWhitelist;
+	/// The id type for named reserves.
+	type ReserveIdentifier = ();
+	type OnNewTokenAccount = ();
+	type OnKilledTokenAccount = ();
+}
+
+impl orml_xtokens::Config for Runtime {
+	type Event = Event;
+	type Balance = Balance;
+	type CurrencyId = CurrencyId;
+	type CurrencyIdConvert = CurrencyIdConvert;
+	type AccountIdToMultiLocation = AccountIdToMultiLocation;
+	type SelfLocation = SelfLocation;
+	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
+	type Weigher = Weigher;
+	type BaseXcmWeight = BaseXcmWeight;
+	type LocationInverter = LocationInverter<Ancestry>;
+	type MaxAssetsForTransfer = MaxAssetsForTransfer;
+	type MinXcmFee = ParachainMinFee;
+	type MultiLocationsFilter = Everything;
+	type ReserveProvider = AbsoluteReserveProvider;
+}
modifiedruntime/common/config/xcm/foreignassets.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -18,14 +18,14 @@
 	traits::{Contains, Get, fungibles},
 	parameter_types,
 };
-use sp_runtime::traits::Zero;
+use sp_runtime::traits::{Zero, Convert};
 use xcm::v1::{Junction::*, MultiLocation, Junctions::*};
 use xcm::latest::MultiAsset;
 use xcm_builder::{FungiblesAdapter, ConvertedConcreteAssetId};
 use xcm_executor::traits::{Convert as ConvertXcm, JustTry, FilterAssetLocation};
 use pallet_foreing_assets::{
 	AssetIds, AssetIdMapping, XcmForeignAssetIdMapping, NativeCurrency, FreeForAll, TryAsForeing,
-	ForeignAssetId,
+	ForeignAssetId, CurrencyId,
 };
 use sp_std::{borrow::Borrow, marker::PhantomData};
 use crate::{Runtime, Balances, ParachainInfo, PolkadotXcm, ForeingAssets};
@@ -158,3 +158,41 @@
 	Balances,
 	(),
 >;
+
+pub struct CurrencyIdConvert;
+impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
+	fn convert(id: AssetIds) -> Option<MultiLocation> {
+		match id {
+			AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(
+				1,
+				X1(Parachain(ParachainInfo::get().into())),
+			)),
+			AssetIds::NativeAssetId(NativeCurrency::Parent) => Some(MultiLocation::parent()),
+			AssetIds::ForeignAssetId(foreign_asset_id) => {
+				XcmForeignAssetIdMapping::<Runtime>::get_multi_location(foreign_asset_id)
+			}
+		}
+	}
+}
+
+impl Convert<MultiLocation, Option<CurrencyId>> for CurrencyIdConvert {
+	fn convert(location: MultiLocation) -> Option<CurrencyId> {
+		if location == MultiLocation::here()
+			|| location == MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())))
+		{
+			return Some(AssetIds::NativeAssetId(NativeCurrency::Here));
+		}
+
+		if location == MultiLocation::parent() {
+			return Some(AssetIds::NativeAssetId(NativeCurrency::Parent));
+		}
+
+		if let Some(currency_id) =
+			XcmForeignAssetIdMapping::<Runtime>::get_currency_id(location.clone())
+		{
+			return Some(currency_id);
+		}
+
+		None
+	}
+}
modifiedruntime/common/config/xcm/mod.rsdiffbeforeafterboth
before · runtime/common/config/xcm/mod.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{traits::Everything, weights::Weight, parameter_types};18use frame_system::EnsureRoot;19use pallet_xcm::XcmPassthrough;20use polkadot_parachain::primitives::Sibling;21use xcm::v1::{Junction::*, MultiLocation, NetworkId};22use xcm::latest::{Instruction, Xcm};23use xcm_builder::{24	AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, ParentAsSuperuser,25	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,26	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, ParentIsPreset,27};28use xcm_executor::{Config, XcmExecutor, traits::ShouldExecute};29use sp_std::marker::PhantomData;30use crate::{31	Runtime, Call, Event, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,32	xcm_config::Barrier,33};3435use up_common::types::AccountId;3637#[cfg(feature = "foreign-assets")]38mod foreignassets;3940#[cfg(not(feature = "foreign-assets"))]41mod nativeassets;4243#[cfg(feature = "foreign-assets")]44use foreignassets as xcm_assets;4546#[cfg(not(feature = "foreign-assets"))]47use nativeassets as xcm_assets;4849use xcm_assets::{AssetTransactors, IsReserve, Trader};5051parameter_types! {52	pub const RelayLocation: MultiLocation = MultiLocation::parent();53	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;54	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();55	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();56}5758/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used59/// when determining ownership of accounts for asset transacting and when attempting to use XCM60/// `Transact` in order to determine the dispatch Origin.61pub type LocationToAccountId = (62	// The parent (Relay-chain) origin converts to the default `AccountId`.63	ParentIsPreset<AccountId>,64	// Sibling parachain origins convert to AccountId via the `ParaId::into`.65	SiblingParachainConvertsVia<Sibling, AccountId>,66	// Straight up local `AccountId32` origins just alias directly to `AccountId`.67	AccountId32Aliases<RelayNetwork, AccountId>,68);6970/// No local origins on this chain are allowed to dispatch XCM sends/executions.71pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);7273/// The means for routing XCM messages which are not for local execution into the right message74/// queues.75pub type XcmRouter = (76	// Two routers - use UMP to communicate with the relay chain:77	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,78	// ..and XCMP to communicate with the sibling chains.79	XcmpQueue,80);8182/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,83/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can84/// biases the kind of local `Origin` it will become.85pub type XcmOriginToTransactDispatchOrigin = (86	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location87	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for88	// foreign chains who want to have a local sovereign account on this chain which they control.89	SovereignSignedViaLocation<LocationToAccountId, Origin>,90	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when91	// recognised.92	RelayChainAsNative<RelayOrigin, Origin>,93	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when94	// recognised.95	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,96	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a97	// transaction from the Root origin.98	ParentAsSuperuser<Origin>,99	// Native signed account converter; this just converts an `AccountId32` origin into a normal100	// `Origin::Signed` origin of the same 32-byte value.101	SignedAccountId32AsNative<RelayNetwork, Origin>,102	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.103	XcmPassthrough<Origin>,104);105106parameter_types! {107	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.108	pub UnitWeightCost: Weight = 1_000_000;109	pub const MaxInstructions: u32 = 100;110}111112pub trait TryPass {113	fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()>;114}115116#[impl_trait_for_tuples::impl_for_tuples(30)]117impl TryPass for Tuple {118	fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {119		for_tuples!( #(120			Tuple::try_pass(origin, message)?;121		)* );122123		Ok(())124	}125}126127pub struct DenyTransact;128impl TryPass for DenyTransact {129	fn try_pass<Call>(_origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {130		let transact_inst = message131			.0132			.iter()133			.find(|inst| matches![inst, Instruction::Transact { .. }]);134135		match transact_inst {136			Some(_) => {137				log::warn!(138					target: "xcm::barrier",139					"transact XCM rejected"140				);141142				Err(())143			}144			None => Ok(()),145		}146	}147}148149/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.150/// If it passes the Deny, and matches one of the Allow cases then it is let through.151pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)152where153	Deny: TryPass,154	Allow: ShouldExecute;155156impl<Deny, Allow> ShouldExecute for DenyThenTry<Deny, Allow>157where158	Deny: TryPass,159	Allow: ShouldExecute,160{161	fn should_execute<Call>(162		origin: &MultiLocation,163		message: &mut Xcm<Call>,164		max_weight: Weight,165		weight_credit: &mut Weight,166	) -> Result<(), ()> {167		Deny::try_pass(origin, message)?;168		Allow::should_execute(origin, message, max_weight, weight_credit)169	}170}171172pub struct XcmConfig<T>(PhantomData<T>);173impl<T> Config for XcmConfig<T>174where175	T: pallet_configuration::Config,176{177	type Call = Call;178	type XcmSender = XcmRouter;179	// How to withdraw and deposit an asset.180	type AssetTransactor = AssetTransactors;181	type OriginConverter = XcmOriginToTransactDispatchOrigin;182	type IsReserve = IsReserve;183	type IsTeleporter = (); // Teleportation is disabled184	type LocationInverter = LocationInverter<Ancestry>;185	type Barrier = Barrier;186	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;187	type Trader = Trader<T>;188	type ResponseHandler = (); // Don't handle responses for now.189	type SubscriptionService = PolkadotXcm;190191	type AssetTrap = PolkadotXcm;192	type AssetClaims = PolkadotXcm;193}194195impl pallet_xcm::Config for Runtime {196	type Event = Event;197	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;198	type XcmRouter = XcmRouter;199	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;200	type XcmExecuteFilter = Everything;201	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;202	type XcmTeleportFilter = Everything;203	type XcmReserveTransferFilter = Everything;204	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;205	type LocationInverter = LocationInverter<Ancestry>;206	type Origin = Origin;207	type Call = Call;208	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;209	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;210}211212impl cumulus_pallet_xcm::Config for Runtime {213	type Event = Event;214	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;215}216217impl cumulus_pallet_xcmp_queue::Config for Runtime {218	type WeightInfo = ();219	type Event = Event;220	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;221	type ChannelInfo = ParachainSystem;222	type VersionWrapper = ();223	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;224	type ControllerOrigin = EnsureRoot<AccountId>;225	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;226}227228impl cumulus_pallet_dmp_queue::Config for Runtime {229	type Event = Event;230	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;231	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;232}
after · runtime/common/config/xcm/mod.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{18	traits::{Everything, Get},19	weights::Weight,20	parameter_types,21};22use frame_system::EnsureRoot;23use pallet_xcm::XcmPassthrough;24use polkadot_parachain::primitives::Sibling;25use xcm::v1::{Junction::*, MultiLocation, NetworkId};26use xcm::latest::prelude::*;27use xcm_builder::{28	AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, ParentAsSuperuser,29	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,30	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, ParentIsPreset,31};32use xcm_executor::{Config, XcmExecutor, traits::ShouldExecute};33use sp_std::{marker::PhantomData, vec::Vec};34use crate::{35	Runtime, Call, Event, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,36	xcm_config::Barrier,37};3839use up_common::types::AccountId;4041#[cfg(feature = "foreign-assets")]42pub mod foreignassets;4344#[cfg(not(feature = "foreign-assets"))]45pub mod nativeassets;4647#[cfg(feature = "foreign-assets")]48pub use foreignassets as xcm_assets;4950#[cfg(not(feature = "foreign-assets"))]51pub use nativeassets as xcm_assets;5253use xcm_assets::{AssetTransactors, IsReserve, Trader};5455parameter_types! {56	pub const RelayLocation: MultiLocation = MultiLocation::parent();57	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;58	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();59	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();60	pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));6162	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.63	pub UnitWeightCost: Weight = 1_000_000;64	pub const MaxInstructions: u32 = 100;65}6667/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used68/// when determining ownership of accounts for asset transacting and when attempting to use XCM69/// `Transact` in order to determine the dispatch Origin.70pub type LocationToAccountId = (71	// The parent (Relay-chain) origin converts to the default `AccountId`.72	ParentIsPreset<AccountId>,73	// Sibling parachain origins convert to AccountId via the `ParaId::into`.74	SiblingParachainConvertsVia<Sibling, AccountId>,75	// Straight up local `AccountId32` origins just alias directly to `AccountId`.76	AccountId32Aliases<RelayNetwork, AccountId>,77);7879/// No local origins on this chain are allowed to dispatch XCM sends/executions.80pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);8182/// The means for routing XCM messages which are not for local execution into the right message83/// queues.84pub type XcmRouter = (85	// Two routers - use UMP to communicate with the relay chain:86	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,87	// ..and XCMP to communicate with the sibling chains.88	XcmpQueue,89);9091/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,92/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can93/// biases the kind of local `Origin` it will become.94pub type XcmOriginToTransactDispatchOrigin = (95	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location96	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for97	// foreign chains who want to have a local sovereign account on this chain which they control.98	SovereignSignedViaLocation<LocationToAccountId, Origin>,99	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when100	// recognised.101	RelayChainAsNative<RelayOrigin, Origin>,102	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when103	// recognised.104	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,105	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a106	// transaction from the Root origin.107	ParentAsSuperuser<Origin>,108	// Native signed account converter; this just converts an `AccountId32` origin into a normal109	// `Origin::Signed` origin of the same 32-byte value.110	SignedAccountId32AsNative<RelayNetwork, Origin>,111	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.112	XcmPassthrough<Origin>,113);114115pub trait TryPass {116	fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()>;117}118119#[impl_trait_for_tuples::impl_for_tuples(30)]120impl TryPass for Tuple {121	fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {122		for_tuples!( #(123			Tuple::try_pass(origin, message)?;124		)* );125126		Ok(())127	}128}129130pub struct DenyTransact;131impl TryPass for DenyTransact {132	fn try_pass<Call>(_origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {133		let transact_inst = message134			.0135			.iter()136			.find(|inst| matches![inst, Instruction::Transact { .. }]);137138		match transact_inst {139			Some(_) => {140				log::warn!(141					target: "xcm::barrier",142					"transact XCM rejected"143				);144145				Err(())146			}147			None => Ok(()),148		}149	}150}151152/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.153/// If it passes the Deny, and matches one of the Allow cases then it is let through.154pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)155where156	Deny: TryPass,157	Allow: ShouldExecute;158159impl<Deny, Allow> ShouldExecute for DenyThenTry<Deny, Allow>160where161	Deny: TryPass,162	Allow: ShouldExecute,163{164	fn should_execute<Call>(165		origin: &MultiLocation,166		message: &mut Xcm<Call>,167		max_weight: Weight,168		weight_credit: &mut Weight,169	) -> Result<(), ()> {170		Deny::try_pass(origin, message)?;171		Allow::should_execute(origin, message, max_weight, weight_credit)172	}173}174175// Allow xcm exchange only with locations in list176pub struct DenyExchangeWithUnknownLocation<T>(PhantomData<T>);177impl<T: Get<Vec<MultiLocation>>> TryPass for DenyExchangeWithUnknownLocation<T> {178	fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {179		let allowed_locations = T::get();180181		// Check if deposit or transfer belongs to allowed parachains182		let mut allowed = allowed_locations.contains(origin);183184		message.0.iter().for_each(|inst| match inst {185			DepositReserveAsset { dest: dst, .. } => {186				allowed |= allowed_locations.contains(dst);187			}188			TransferReserveAsset { dest: dst, .. } => {189				allowed |= allowed_locations.contains(dst);190			}191			_ => {}192		});193194		if allowed {195			return Ok(());196		}197198		log::warn!(199			target: "xcm::barrier",200			"Unexpected deposit or transfer location"201		);202		// Deny203		Err(())204	}205}206207pub type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;208209pub struct XcmConfig<T>(PhantomData<T>);210impl<T> Config for XcmConfig<T>211where212	T: pallet_configuration::Config,213{214	type Call = Call;215	type XcmSender = XcmRouter;216	// How to withdraw and deposit an asset.217	type AssetTransactor = AssetTransactors;218	type OriginConverter = XcmOriginToTransactDispatchOrigin;219	type IsReserve = IsReserve;220	type IsTeleporter = (); // Teleportation is disabled221	type LocationInverter = LocationInverter<Ancestry>;222	type Barrier = Barrier;223	type Weigher = Weigher;224	type Trader = Trader<T>;225	type ResponseHandler = (); // Don't handle responses for now.226	type SubscriptionService = PolkadotXcm;227228	type AssetTrap = PolkadotXcm;229	type AssetClaims = PolkadotXcm;230}231232impl pallet_xcm::Config for Runtime {233	type Event = Event;234	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;235	type XcmRouter = XcmRouter;236	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;237	type XcmExecuteFilter = Everything;238	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;239	type XcmTeleportFilter = Everything;240	type XcmReserveTransferFilter = Everything;241	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;242	type LocationInverter = LocationInverter<Ancestry>;243	type Origin = Origin;244	type Call = Call;245	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;246	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;247}248249impl cumulus_pallet_xcm::Config for Runtime {250	type Event = Event;251	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;252}253254impl cumulus_pallet_xcmp_queue::Config for Runtime {255	type WeightInfo = ();256	type Event = Event;257	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;258	type ChannelInfo = ParachainSystem;259	type VersionWrapper = ();260	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;261	type ControllerOrigin = EnsureRoot<AccountId>;262	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;263}264265impl cumulus_pallet_dmp_queue::Config for Runtime {266	type Event = Event;267	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;268	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;269}
modifiedruntime/common/config/xcm/nativeassets.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm/nativeassets.rs
+++ b/runtime/common/config/xcm/nativeassets.rs
@@ -18,7 +18,7 @@
 	traits::{tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Get},
 	weights::{Weight, WeightToFeePolynomial},
 };
-use sp_runtime::traits::{CheckedConversion, Zero};
+use sp_runtime::traits::{CheckedConversion, Zero, Convert};
 use xcm::v1::{Junction::*, MultiLocation, Junctions::*};
 use xcm::latest::{
 	AssetId::{Concrete},
@@ -30,6 +30,7 @@
 	Assets,
 	traits::{MatchesFungible, WeightTrader},
 };
+use pallet_foreing_assets::{AssetIds, NativeCurrency};
 use sp_std::marker::PhantomData;
 use crate::{Balances, ParachainInfo};
 use super::{LocationToAccountId, RelayLocation};
@@ -127,3 +128,16 @@
 	Balances,
 	(),
 >;
+
+pub struct CurrencyIdConvert;
+impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
+	fn convert(id: AssetIds) -> Option<MultiLocation> {
+		match id {
+			AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(
+				1,
+				X1(Parachain(ParachainInfo::get().into())),
+			)),
+			_ => None,
+		}
+	}
+}
modifiedruntime/opal/src/xcm_config.rsdiffbeforeafterboth
--- a/runtime/opal/src/xcm_config.rs
+++ b/runtime/opal/src/xcm_config.rs
@@ -15,39 +15,17 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{
-	{match_types, parameter_types, weights::Weight},
-	pallet_prelude::Get,
-	traits::{Contains, Everything},
+	{match_types, weights::Weight},
+	traits::Everything,
 };
-use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};
-use sp_runtime::traits::{AccountIdConversion, Convert};
-use sp_std::{vec, vec::Vec};
 use xcm::{
 	latest::Xcm,
-	v1::{BodyId, Junction::*, Junctions::*, MultiLocation, NetworkId},
-};
-use xcm_builder::{
-	AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, FixedWeightBounds, LocationInverter,
-	TakeWeightCredit,
-};
-use xcm_executor::{XcmExecutor, traits::ShouldExecute};
-
-use up_common::types::{AccountId, Balance};
-use crate::{
-	Call, Event, ParachainInfo, Runtime,
-	runtime_common::config::{
-		substrate::{TreasuryModuleId, MaxLocks, MaxReserves},
-		pallets::TreasuryAccountId,
-		xcm::*,
-	},
+	v1::{BodyId, Junction::*, Junctions::*, MultiLocation},
 };
-
-use pallet_foreing_assets::{
-	AssetIds, AssetIdMapping, XcmForeignAssetIdMapping, CurrencyId, NativeCurrency,
-};
+use xcm_builder::{AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, TakeWeightCredit};
+use xcm_executor::traits::ShouldExecute;
 
-// Signed version of balance
-pub type Amount = i128;
+use crate::runtime_common::config::xcm::{DenyThenTry, DenyTransact};
 
 match_types! {
 	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
@@ -83,123 +61,3 @@
 		AllowAllDebug,
 	),
 >;
-
-impl Convert<MultiLocation, Option<CurrencyId>> for CurrencyIdConvert {
-	fn convert(location: MultiLocation) -> Option<CurrencyId> {
-		if location == MultiLocation::here()
-			|| location == MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())))
-		{
-			return Some(AssetIds::NativeAssetId(NativeCurrency::Here));
-		}
-
-		if location == MultiLocation::parent() {
-			return Some(AssetIds::NativeAssetId(NativeCurrency::Parent));
-		}
-
-		if let Some(currency_id) =
-			XcmForeignAssetIdMapping::<Runtime>::get_currency_id(location.clone())
-		{
-			return Some(currency_id);
-		}
-
-		None
-	}
-}
-
-impl orml_tokens::Config for Runtime {
-	type Event = Event;
-	type Balance = Balance;
-	type Amount = Amount;
-	type CurrencyId = CurrencyId;
-	type WeightInfo = ();
-	type ExistentialDeposits = ExistentialDeposits;
-	type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccountId>;
-	type MaxLocks = MaxLocks;
-	type MaxReserves = MaxReserves;
-	// TODO: Add all module accounts
-	type DustRemovalWhitelist = DustRemovalWhitelist;
-	/// The id type for named reserves.
-	type ReserveIdentifier = ();
-	type OnNewTokenAccount = ();
-	type OnKilledTokenAccount = ();
-}
-
-impl orml_xtokens::Config for Runtime {
-	type Event = Event;
-	type Balance = Balance;
-	type CurrencyId = CurrencyId;
-	type CurrencyIdConvert = CurrencyIdConvert;
-	type AccountIdToMultiLocation = AccountIdToMultiLocation;
-	type SelfLocation = SelfLocation;
-	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
-	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
-	type BaseXcmWeight = BaseXcmWeight;
-	type LocationInverter = LocationInverter<Ancestry>;
-	type MaxAssetsForTransfer = MaxAssetsForTransfer;
-	type MinXcmFee = ParachainMinFee;
-	type MultiLocationsFilter = Everything;
-	type ReserveProvider = AbsoluteReserveProvider;
-}
-
-parameter_type_with_key! {
-	pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {
-		match currency_id {
-			CurrencyId::NativeAssetId(symbol) => match symbol {
-				NativeCurrency::Here => 0,
-				NativeCurrency::Parent=> 0,
-			},
-			_ => 100_000
-		}
-	};
-}
-
-pub struct DustRemovalWhitelist;
-impl Contains<AccountId> for DustRemovalWhitelist {
-	fn contains(a: &AccountId) -> bool {
-		get_all_module_accounts().contains(a)
-	}
-}
-
-pub struct CurrencyIdConvert;
-impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
-	fn convert(id: AssetIds) -> Option<MultiLocation> {
-		match id {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(
-				1,
-				X1(Parachain(ParachainInfo::get().into())),
-			)),
-			AssetIds::NativeAssetId(NativeCurrency::Parent) => Some(MultiLocation::parent()),
-			AssetIds::ForeignAssetId(foreign_asset_id) => {
-				XcmForeignAssetIdMapping::<Runtime>::get_multi_location(foreign_asset_id)
-			}
-		}
-	}
-}
-
-parameter_types! {
-	pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this
-	pub const MaxAssetsForTransfer: usize = 2;
-
-	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
-	pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));
-}
-
-parameter_type_with_key! {
-	pub ParachainMinFee: |_location: MultiLocation| -> Option<u128> {
-		Some(100_000_000_000)
-	};
-}
-
-pub fn get_all_module_accounts() -> Vec<AccountId> {
-	vec![TreasuryModuleId::get().into_account_truncating()]
-}
-pub struct AccountIdToMultiLocation;
-impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {
-	fn convert(account: AccountId) -> MultiLocation {
-		X1(AccountId32 {
-			network: NetworkId::Any,
-			id: account.into(),
-		})
-		.into()
-	}
-}
modifiedruntime/quartz/src/xcm_config.rsdiffbeforeafterboth
--- a/runtime/quartz/src/xcm_config.rs
+++ b/runtime/quartz/src/xcm_config.rs
@@ -15,33 +15,20 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{
-	{match_types, parameter_types, weights::Weight},
-	pallet_prelude::Get,
-	traits::{Contains, Everything},
+	match_types, parameter_types,
+	traits::{Everything, Get},
 };
-use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};
-use sp_runtime::traits::{AccountIdConversion, Convert};
 use sp_std::{vec, vec::Vec};
-use xcm::{
-	latest::Xcm,
-	v1::{BodyId, Junction::*, Junctions::*, MultiLocation, NetworkId},
-};
+use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};
 use xcm_builder::{
 	AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
-	AllowUnpaidExecutionFrom, FixedWeightBounds, LocationInverter, TakeWeightCredit,
+	AllowUnpaidExecutionFrom, TakeWeightCredit,
 };
-use xcm_executor::XcmExecutor;
 
-use up_common::types::{AccountId, Balance};
-use pallet_foreing_assets::{AssetIds, CurrencyId, NativeCurrency};
-use crate::{Call, Event, ParachainInfo, PolkadotXcm, Runtime};
-use crate::runtime_common::config::substrate::{TreasuryModuleId, MaxLocks, MaxReserves};
-use crate::runtime_common::config::pallets::TreasuryAccountId;
-use crate::runtime_common::config::xcm::*;
-use xcm::opaque::latest::prelude::{DepositReserveAsset, TransferReserveAsset};
-
-// Signed version of balance
-pub type Amount = i128;
+use crate::{
+	ParachainInfo, PolkadotXcm,
+	runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},
+};
 
 match_types! {
 	pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
@@ -54,22 +41,8 @@
 	};
 }
 
-pub type Barrier = DenyThenTry<
-	(DenyTransact, DenyExchangeWithUnknownLocation),
-	(
-		TakeWeightCredit,
-		AllowTopLevelPaidExecutionFrom<Everything>,
-		// Parent and its exec plurality get free execution
-		AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
-		// Expected responses are OK.
-		AllowKnownQueryResponses<PolkadotXcm>,
-		// Subscriptions for version tracking are OK.
-		AllowSubscriptionsFrom<ParentOrSiblings>,
-	),
->;
-
-pub fn get_allowed_locations() -> Vec<MultiLocation> {
-	vec![
+parameter_types! {
+	pub QuartzAllowedLocations: Vec<MultiLocation> = vec![
 		// Self location
 		MultiLocation {
 			parents: 0,
@@ -95,131 +68,22 @@
 			parents: 1,
 			interior: X1(Parachain(ParachainInfo::get().into())),
 		},
-	]
-}
-
-// Allow xcm exchange only with locations in list
-pub struct DenyExchangeWithUnknownLocation;
-impl TryPass for DenyExchangeWithUnknownLocation {
-	fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {
-		// Check if deposit or transfer belongs to allowed parachains
-		let mut allowed = get_allowed_locations().contains(origin);
-
-		message.0.iter().for_each(|inst| match inst {
-			DepositReserveAsset { dest: dst, .. } => {
-				allowed |= get_allowed_locations().contains(dst);
-			}
-			TransferReserveAsset { dest: dst, .. } => {
-				allowed |= get_allowed_locations().contains(dst);
-			}
-			_ => {}
-		});
-
-		if allowed {
-			return Ok(());
-		}
-
-		log::warn!(
-			target: "xcm::barrier",
-			"Unexpected deposit or transfer location"
-		);
-		// Deny
-		Err(())
-	}
+	];
 }
 
-impl orml_tokens::Config for Runtime {
-	type Event = Event;
-	type Balance = Balance;
-	type Amount = Amount;
-	type CurrencyId = CurrencyId;
-	type WeightInfo = ();
-	type ExistentialDeposits = ExistentialDeposits;
-	type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccountId>;
-	type MaxLocks = MaxLocks;
-	type MaxReserves = MaxReserves;
-	// TODO: Add all module accounts
-	type DustRemovalWhitelist = DustRemovalWhitelist;
-	/// The id type for named reserves.
-	type ReserveIdentifier = ();
-	type OnNewTokenAccount = ();
-	type OnKilledTokenAccount = ();
-}
-
-impl orml_xtokens::Config for Runtime {
-	type Event = Event;
-	type Balance = Balance;
-	type CurrencyId = CurrencyId;
-	type CurrencyIdConvert = CurrencyIdConvert;
-	type AccountIdToMultiLocation = AccountIdToMultiLocation;
-	type SelfLocation = SelfLocation;
-	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
-	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
-	type BaseXcmWeight = BaseXcmWeight;
-	type LocationInverter = LocationInverter<Ancestry>;
-	type MaxAssetsForTransfer = MaxAssetsForTransfer;
-	type MinXcmFee = ParachainMinFee;
-	type MultiLocationsFilter = Everything;
-	type ReserveProvider = AbsoluteReserveProvider;
-}
-
-parameter_type_with_key! {
-	pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {
-		match currency_id {
-			CurrencyId::NativeAssetId(symbol) => match symbol {
-				NativeCurrency::Here => 0,
-				NativeCurrency::Parent=> 0,
-			},
-			_ => 100_000
-		}
-	};
-}
-
-pub struct DustRemovalWhitelist;
-impl Contains<AccountId> for DustRemovalWhitelist {
-	fn contains(a: &AccountId) -> bool {
-		get_all_module_accounts().contains(a)
-	}
-}
-
-pub struct CurrencyIdConvert;
-impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
-	fn convert(id: AssetIds) -> Option<MultiLocation> {
-		match id {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(
-				1,
-				X1(Parachain(ParachainInfo::get().into())),
-			)),
-			_ => None,
-		}
-	}
-}
-
-parameter_types! {
-	pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this
-	pub const MaxAssetsForTransfer: usize = 2;
-
-	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
-	pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));
-}
-
-parameter_type_with_key! {
-	pub ParachainMinFee: |_location: MultiLocation| -> Option<u128> {
-		Some(100_000_000)
-	};
-}
-
-pub fn get_all_module_accounts() -> Vec<AccountId> {
-	vec![TreasuryModuleId::get().into_account_truncating()]
-}
-
-pub struct AccountIdToMultiLocation;
-impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {
-	fn convert(account: AccountId) -> MultiLocation {
-		X1(AccountId32 {
-			network: NetworkId::Any,
-			id: account.into(),
-		})
-		.into()
-	}
-}
+pub type Barrier = DenyThenTry<
+	(
+		DenyTransact,
+		DenyExchangeWithUnknownLocation<QuartzAllowedLocations>,
+	),
+	(
+		TakeWeightCredit,
+		AllowTopLevelPaidExecutionFrom<Everything>,
+		// Parent and its exec plurality get free execution
+		AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
+		// Expected responses are OK.
+		AllowKnownQueryResponses<PolkadotXcm>,
+		// Subscriptions for version tracking are OK.
+		AllowSubscriptionsFrom<ParentOrSiblings>,
+	),
+>;
modifiedruntime/unique/src/xcm_config.rsdiffbeforeafterboth
--- a/runtime/unique/src/xcm_config.rs
+++ b/runtime/unique/src/xcm_config.rs
@@ -15,33 +15,20 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{
-	{match_types, parameter_types, weights::Weight},
-	pallet_prelude::Get,
-	traits::{Contains, Everything},
+	match_types, parameter_types,
+	traits::{Everything, Get},
 };
-use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};
-use sp_runtime::traits::{AccountIdConversion, Convert};
 use sp_std::{vec, vec::Vec};
-use xcm::{
-	latest::Xcm,
-	v1::{BodyId, Junction::*, Junctions::*, MultiLocation, NetworkId},
-};
+use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};
 use xcm_builder::{
 	AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
-	AllowUnpaidExecutionFrom, FixedWeightBounds, LocationInverter, TakeWeightCredit,
+	AllowUnpaidExecutionFrom, TakeWeightCredit,
 };
-use xcm_executor::XcmExecutor;
 
-use up_common::types::{AccountId, Balance};
-use pallet_foreing_assets::{AssetIds, CurrencyId, NativeCurrency};
-use crate::{Call, Event, ParachainInfo, PolkadotXcm, Runtime};
-use crate::runtime_common::config::substrate::{TreasuryModuleId, MaxLocks, MaxReserves};
-use crate::runtime_common::config::pallets::TreasuryAccountId;
-use crate::runtime_common::config::xcm::*;
-use xcm::opaque::latest::prelude::{DepositReserveAsset, TransferReserveAsset};
-
-// Signed version of balance
-pub type Amount = i128;
+use crate::{
+	ParachainInfo, PolkadotXcm,
+	runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},
+};
 
 match_types! {
 	pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
@@ -54,22 +41,8 @@
 	};
 }
 
-pub type Barrier = DenyThenTry<
-	(DenyTransact, DenyExchangeWithUnknownLocation),
-	(
-		TakeWeightCredit,
-		AllowTopLevelPaidExecutionFrom<Everything>,
-		// Parent and its exec plurality get free execution
-		AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
-		// Expected responses are OK.
-		AllowKnownQueryResponses<PolkadotXcm>,
-		// Subscriptions for version tracking are OK.
-		AllowSubscriptionsFrom<ParentOrSiblings>,
-	),
->;
-
-pub fn get_allowed_locations() -> Vec<MultiLocation> {
-	vec![
+parameter_types! {
+	pub UniqueAllowedLocations: Vec<MultiLocation> = vec![
 		// Self location
 		MultiLocation {
 			parents: 0,
@@ -95,131 +68,22 @@
 			parents: 1,
 			interior: X1(Parachain(ParachainInfo::get().into())),
 		},
-	]
-}
-
-// Allow xcm exchange only with locations in list
-pub struct DenyExchangeWithUnknownLocation;
-impl TryPass for DenyExchangeWithUnknownLocation {
-	fn try_pass<Call>(origin: &MultiLocation, message: &mut Xcm<Call>) -> Result<(), ()> {
-		// Check if deposit or transfer belongs to allowed parachains
-		let mut allowed = get_allowed_locations().contains(origin);
-
-		message.0.iter().for_each(|inst| match inst {
-			DepositReserveAsset { dest: dst, .. } => {
-				allowed |= get_allowed_locations().contains(dst);
-			}
-			TransferReserveAsset { dest: dst, .. } => {
-				allowed |= get_allowed_locations().contains(dst);
-			}
-			_ => {}
-		});
-
-		if allowed {
-			return Ok(());
-		}
-
-		log::warn!(
-			target: "xcm::barrier",
-			"Unexpected deposit or transfer location"
-		);
-		// Deny
-		Err(())
-	}
+	];
 }
 
-impl orml_tokens::Config for Runtime {
-	type Event = Event;
-	type Balance = Balance;
-	type Amount = Amount;
-	type CurrencyId = CurrencyId;
-	type WeightInfo = ();
-	type ExistentialDeposits = ExistentialDeposits;
-	type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccountId>;
-	type MaxLocks = MaxLocks;
-	type MaxReserves = MaxReserves;
-	// TODO: Add all module accounts
-	type DustRemovalWhitelist = DustRemovalWhitelist;
-	/// The id type for named reserves.
-	type ReserveIdentifier = ();
-	type OnNewTokenAccount = ();
-	type OnKilledTokenAccount = ();
-}
-
-impl orml_xtokens::Config for Runtime {
-	type Event = Event;
-	type Balance = Balance;
-	type CurrencyId = CurrencyId;
-	type CurrencyIdConvert = CurrencyIdConvert;
-	type AccountIdToMultiLocation = AccountIdToMultiLocation;
-	type SelfLocation = SelfLocation;
-	type XcmExecutor = XcmExecutor<XcmConfig<Self>>;
-	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
-	type BaseXcmWeight = BaseXcmWeight;
-	type LocationInverter = LocationInverter<Ancestry>;
-	type MaxAssetsForTransfer = MaxAssetsForTransfer;
-	type MinXcmFee = ParachainMinFee;
-	type MultiLocationsFilter = Everything;
-	type ReserveProvider = AbsoluteReserveProvider;
-}
-
-parameter_type_with_key! {
-	pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {
-		match currency_id {
-			CurrencyId::NativeAssetId(symbol) => match symbol {
-				NativeCurrency::Here => 0,
-				NativeCurrency::Parent=> 0,
-			},
-			_ => 100_000
-		}
-	};
-}
-
-pub struct DustRemovalWhitelist;
-impl Contains<AccountId> for DustRemovalWhitelist {
-	fn contains(a: &AccountId) -> bool {
-		get_all_module_accounts().contains(a)
-	}
-}
-
-pub struct CurrencyIdConvert;
-impl Convert<AssetIds, Option<MultiLocation>> for CurrencyIdConvert {
-	fn convert(id: AssetIds) -> Option<MultiLocation> {
-		match id {
-			AssetIds::NativeAssetId(NativeCurrency::Here) => Some(MultiLocation::new(
-				1,
-				X1(Parachain(ParachainInfo::get().into())),
-			)),
-			_ => None,
-		}
-	}
-}
-
-parameter_types! {
-	pub const BaseXcmWeight: Weight = 100_000_000; // TODO: recheck this
-	pub const MaxAssetsForTransfer: usize = 2;
-
-	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
-	pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into())));
-}
-
-parameter_type_with_key! {
-	pub ParachainMinFee: |_location: MultiLocation| -> Option<u128> {
-		Some(100_000_000)
-	};
-}
-
-pub fn get_all_module_accounts() -> Vec<AccountId> {
-	vec![TreasuryModuleId::get().into_account_truncating()]
-}
-
-pub struct AccountIdToMultiLocation;
-impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {
-	fn convert(account: AccountId) -> MultiLocation {
-		X1(AccountId32 {
-			network: NetworkId::Any,
-			id: account.into(),
-		})
-		.into()
-	}
-}
+pub type Barrier = DenyThenTry<
+	(
+		DenyTransact,
+		DenyExchangeWithUnknownLocation<UniqueAllowedLocations>,
+	),
+	(
+		TakeWeightCredit,
+		AllowTopLevelPaidExecutionFrom<Everything>,
+		// Parent and its exec plurality get free execution
+		AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
+		// Expected responses are OK.
+		AllowKnownQueryResponses<PolkadotXcm>,
+		// Subscriptions for version tracking are OK.
+		AllowSubscriptionsFrom<ParentOrSiblings>,
+	),
+>;