frequency_runtime/xcm/
xcm_config.rs1use crate::{
2 AccountId, AllPalletsWithSystem, Balances, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent,
3 RuntimeOrigin,
4};
5
6use staging_xcm_builder::{EnsureXcmOrigin, FrameTransactionalProcessor};
7
8use crate::xcm::{
9 AssetTransactors, Barrier, FeeManager, LocalOriginToLocation, MaxAssetsIntoHolding, Trader,
10 TrustedReserves, TrustedTeleporters, UniversalLocation, Weigher,
11 XcmOriginToTransactDispatchOrigin, XcmRouter,
12};
13
14#[cfg(feature = "runtime-benchmarks")]
15use staging_xcm::latest::prelude::{Location, Parachain};
16
17#[cfg(feature = "runtime-benchmarks")]
18use crate::xcm::ForeignAssetsAssetId;
19
20use common_runtime::weights;
21
22use frame_support::{
23 parameter_types,
24 traits::{ConstU32, Disabled, Everything, Nothing},
25};
26
27pub use common_runtime::fee::WeightToFee;
28
29use frame_system::EnsureRoot;
30
31use xcm_executor::XcmExecutor;
32
33parameter_types! {
34 pub CheckingAccount: AccountId = PolkadotXcm::check_account();
35}
36
37pub struct XcmConfig;
38impl xcm_executor::Config for XcmConfig {
39 type RuntimeCall = RuntimeCall;
40 type XcmSender = XcmRouter;
41 type XcmEventEmitter = PolkadotXcm;
42 type AssetTransactor = AssetTransactors;
44 type OriginConverter = XcmOriginToTransactDispatchOrigin;
45 type IsReserve = TrustedReserves;
46 type IsTeleporter = TrustedTeleporters;
47 type UniversalLocation = UniversalLocation;
48 type Barrier = Barrier;
49 type Weigher = Weigher;
50 type Trader = Trader;
51 type ResponseHandler = PolkadotXcm;
52 type AssetTrap = PolkadotXcm;
53 type AssetClaims = PolkadotXcm;
54 type SubscriptionService = PolkadotXcm;
55 type PalletInstancesInfo = AllPalletsWithSystem;
56 type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
57 type AssetLocker = ();
58 type AssetExchanger = ();
59 type FeeManager = FeeManager;
60 type MessageExporter = ();
61 type UniversalAliases = Nothing;
62 type CallDispatcher = RuntimeCall;
63 #[cfg(not(feature = "runtime-benchmarks"))]
64 type SafeCallFilter = Nothing;
65 #[cfg(feature = "runtime-benchmarks")]
66 type SafeCallFilter = Everything;
67 type Aliasers = Nothing;
68 type TransactionalProcessor = FrameTransactionalProcessor;
69 type HrmpNewChannelOpenRequestHandler = ();
70 type HrmpChannelAcceptedHandler = ();
71 type HrmpChannelClosingHandler = ();
72 type XcmRecorder = PolkadotXcm;
73}
74
75impl pallet_xcm::Config for Runtime {
76 type RuntimeEvent = RuntimeEvent;
77 type RuntimeOrigin = RuntimeOrigin;
78 type RuntimeCall = RuntimeCall;
79 type WeightInfo = weights::pallet_xcm::WeightInfo<Runtime>;
80
81 type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
82 type XcmRouter = XcmRouter;
83
84 type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
85 type XcmExecuteFilter = Everything;
86 type XcmExecutor = XcmExecutor<XcmConfig>;
87 type XcmTeleportFilter = Everything;
88 type XcmReserveTransferFilter = Everything;
89 type Weigher = Weigher;
90 type UniversalLocation = UniversalLocation;
91
92 const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
93 type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
95
96 type AdminOrigin = EnsureRoot<AccountId>;
97
98 type Currency = Balances;
99 type CurrencyMatcher = ();
100 type TrustedLockers = ();
101 type MaxLockers = ConstU32<0>;
102 type MaxRemoteLockConsumers = ConstU32<0>;
103 type RemoteLockConsumerIdentifier = ();
104 type SovereignAccountOf = ();
105 type AuthorizedAliasConsideration = Disabled;
106}
107
108impl cumulus_pallet_xcm::Config for Runtime {
109 type RuntimeEvent = RuntimeEvent;
110 type XcmExecutor = XcmExecutor<XcmConfig>;
111}
112
113#[cfg(feature = "runtime-benchmarks")]
115pub struct XcmBenchmarkHelper;
116#[cfg(feature = "runtime-benchmarks")]
117impl pallet_assets::BenchmarkHelper<ForeignAssetsAssetId> for XcmBenchmarkHelper {
118 fn create_asset_id_parameter(id: u32) -> ForeignAssetsAssetId {
119 Location::new(1, [Parachain(id)])
120 }
121}