1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#![cfg_attr(not(feature = "std"), no_std)]

use super::{
	AccountId, AllPalletsWithSystem, Balance, Maintenance, ParachainSystem, PolkadotXcm, Runtime,
	RuntimeCall, RuntimeEvent, RuntimeOrigin, TokenId,
};
use common_runtime::tokens;
pub use frame_support::{
	match_types, parameter_types,
	traits::{Everything, Get, Nothing},
	weights::Weight,
};
use frame_system::EnsureRoot;
use orml_traits::location::AbsoluteReserveProvider;
use orml_xcm_support::MultiNativeAsset;
use sp_runtime::traits::ConstU32;
use xcm_builder::EnsureXcmOrigin;
use xcm_executor::XcmExecutor;

#[cfg(feature = "runtime-benchmarks")]
use xcm::prelude::{MultiLocation, Parent};

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
	type RuntimeCall = RuntimeCall;
	type XcmSender = common_runtime::xcm_config::XcmRouter<Runtime>;
	// How to withdraw and deposit an asset.
	type AssetTransactor = common_runtime::xcm_config::LocalAssetTransactor<Runtime>;
	type OriginConverter =
		common_runtime::xcm_config::XcmOriginToCallOrigin<Runtime, RuntimeOrigin>;
	type IsReserve = MultiNativeAsset<AbsoluteReserveProvider>;
	// Teleporting is disabled.
	type IsTeleporter = ();
	type UniversalLocation = common_runtime::xcm_config::UniversalLocation<Runtime>;
	type Barrier = common_runtime::xcm_config::Barrier<Runtime>;
	type Weigher = common_runtime::xcm_config::Weigher<RuntimeCall>;
	type Trader = common_runtime::xcm_config::Trader<Runtime>;
	type ResponseHandler = PolkadotXcm;
	type AssetTrap = common_runtime::xcm_config::DropAssetsHandler<Runtime>;
	type AssetClaims = PolkadotXcm;
	type SubscriptionService = PolkadotXcm;
	type AssetLocker = ();
	type AssetExchanger = ();
	type PalletInstancesInfo = AllPalletsWithSystem;
	type MaxAssetsIntoHolding = common_runtime::xcm_config::MaxAssetsIntoHolding;
	type FeeManager = ();
	type MessageExporter = ();
	type UniversalAliases = ();
	type CallDispatcher = RuntimeCall;
	type SafeCallFilter = Everything;
	type Aliasers = Nothing;
}

#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
	pub ReachableDest: Option<MultiLocation> = Some(Parent.into());
}

impl pallet_xcm::Config for Runtime {
	type RuntimeEvent = RuntimeEvent;
	type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
	type XcmRouter = common_runtime::xcm_config::XcmRouter<Runtime>;
	type ExecuteXcmOrigin = EnsureXcmOrigin<
		RuntimeOrigin,
		common_runtime::xcm_config::LocalOriginToLocation<RuntimeOrigin>,
	>;
	type XcmExecuteFilter = Nothing;
	type XcmExecutor = XcmExecutor<XcmConfig>;
	type XcmTeleportFilter = Nothing;
	type XcmReserveTransferFilter = Everything;
	type Weigher = common_runtime::xcm_config::Weigher<RuntimeCall>;
	type UniversalLocation = common_runtime::xcm_config::UniversalLocation<Runtime>;
	type RuntimeOrigin = RuntimeOrigin;
	type RuntimeCall = RuntimeCall;
	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
	type Currency = orml_tokens::CurrencyAdapter<Runtime, tokens::MgxTokenId>;
	type CurrencyMatcher = ();
	type TrustedLockers = ();
	type SovereignAccountOf = common_runtime::xcm_config::LocationToAccountId<Runtime>;
	type MaxLockers = ConstU32<8>;
	type WeightInfo = pallet_xcm::TestWeightInfo;
	#[cfg(feature = "runtime-benchmarks")]
	type ReachableDest = ReachableDest;
	type AdminOrigin = EnsureRoot<AccountId>;
	type MaxRemoteLockConsumers = ConstU32<0>;
	type RemoteLockConsumerIdentifier = ();
}

impl cumulus_pallet_xcm::Config for Runtime {
	type RuntimeEvent = RuntimeEvent;
	type XcmExecutor = XcmExecutor<XcmConfig>;
}

impl cumulus_pallet_xcmp_queue::Config for Runtime {
	type RuntimeEvent = RuntimeEvent;
	type MaintenanceStatusProvider = Maintenance;
	type XcmExecutor = XcmExecutor<XcmConfig>;
	type ChannelInfo = ParachainSystem;
	type VersionWrapper = ();
	type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
	type ControllerOrigin = EnsureRoot<AccountId>;
	type ControllerOriginConverter =
		common_runtime::xcm_config::XcmOriginToTransactDispatchOrigin<Runtime, RuntimeOrigin>;
	type WeightInfo = ();
	type PriceForSiblingDelivery = ();
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
	type RuntimeEvent = RuntimeEvent;
	type MaintenanceStatusProvider = Maintenance;
	type XcmExecutor = XcmExecutor<XcmConfig>;
	type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
}

impl orml_xtokens::Config for Runtime {
	type RuntimeEvent = RuntimeEvent;
	type Balance = Balance;
	type CurrencyId = TokenId;
	type CurrencyIdConvert = common_runtime::xcm_config::TokenToMultiLocation<Runtime>;
	type AccountIdToMultiLocation = common_runtime::xcm_config::AccountIdToMultiLocation;
	type SelfLocation = common_runtime::xcm_config::SelfLocation<Runtime>;
	type MinXcmFee = common_runtime::xcm_config::ParachainMinFee;
	type XcmExecutor = XcmExecutor<XcmConfig>;
	type MultiLocationsFilter = Everything;
	type Weigher = common_runtime::xcm_config::Weigher<RuntimeCall>;
	type BaseXcmWeight = common_runtime::xcm_config::BaseXcmWeight;
	type UniversalLocation = common_runtime::xcm_config::UniversalLocation<Runtime>;
	type MaxAssetsForTransfer = common_runtime::xcm_config::MaxAssetsForTransfer;
	type ReserveProvider = AbsoluteReserveProvider;
}