shell_runtime/
xcm_config.rs1use super::{
17 AccountId, AllPalletsWithSystem, ParachainInfo, Runtime, RuntimeCall, RuntimeEvent,
18 RuntimeOrigin,
19};
20use frame_support::{
21 parameter_types,
22 traits::{Contains, Everything, Nothing},
23 weights::Weight,
24};
25use xcm::latest::prelude::*;
26use xcm_builder::{
27 AllowExplicitUnpaidExecutionFrom, FixedWeightBounds, ParentAsSuperuser, ParentIsPreset,
28 SovereignSignedViaLocation,
29};
30
31parameter_types! {
32 pub const RococoLocation: Location = Location::parent();
33 pub const RococoNetwork: NetworkId = NetworkId::Rococo;
34 pub UniversalLocation: InteriorLocation = [GlobalConsensus(RococoNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
35}
36
37pub type XcmOriginToTransactDispatchOrigin = (
41 SovereignSignedViaLocation<ParentIsPreset<AccountId>, RuntimeOrigin>,
45 ParentAsSuperuser<RuntimeOrigin>,
48);
49
50pub struct JustTheParent;
51impl Contains<Location> for JustTheParent {
52 fn contains(location: &Location) -> bool {
53 matches!(location.unpack(), (1, []))
54 }
55}
56
57parameter_types! {
58 pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
60 pub const MaxInstructions: u32 = 100;
61 pub const MaxAssetsIntoHolding: u32 = 64;
62}
63
64pub struct XcmConfig;
65impl xcm_executor::Config for XcmConfig {
66 type RuntimeCall = RuntimeCall;
67 type XcmSender = (); type AssetTransactor = (); type OriginConverter = XcmOriginToTransactDispatchOrigin;
70 type IsReserve = (); type IsTeleporter = (); type UniversalLocation = UniversalLocation;
73 type Barrier = AllowExplicitUnpaidExecutionFrom<JustTheParent>;
74 type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>; type Trader = (); type ResponseHandler = (); type AssetTrap = (); type AssetClaims = (); type SubscriptionService = (); type PalletInstancesInfo = AllPalletsWithSystem;
81 type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
82 type AssetLocker = ();
83 type AssetExchanger = ();
84 type FeeManager = ();
85 type MessageExporter = ();
86 type UniversalAliases = Nothing;
87 type CallDispatcher = RuntimeCall;
88 type SafeCallFilter = Everything;
89 type Aliasers = Nothing;
90 type TransactionalProcessor = ();
91 type HrmpNewChannelOpenRequestHandler = ();
92 type HrmpChannelAcceptedHandler = ();
93 type HrmpChannelClosingHandler = ();
94 type XcmRecorder = ();
95}
96
97impl cumulus_pallet_xcm::Config for Runtime {
98 type RuntimeEvent = RuntimeEvent;
99 type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>;
100}