glutton_westend_runtime/
xcm_config.rs1use super::{
17 AccountId, AllPalletsWithSystem, ParachainInfo, Runtime, RuntimeCall, RuntimeEvent,
18 RuntimeOrigin,
19};
20use frame_support::{
21 parameter_types,
22 traits::{Contains, Equals, Everything, Nothing},
23 weights::Weight,
24};
25use xcm::latest::{prelude::*, WESTEND_GENESIS_HASH};
26use xcm_builder::{
27 AllowExplicitUnpaidExecutionFrom, FixedWeightBounds, FrameTransactionalProcessor,
28 LocationAsSuperuser, ParentAsSuperuser, ParentIsPreset, SovereignSignedViaLocation,
29};
30
31pub use testnet_parachains_constants::westend::locations::GovernanceLocation;
33
34parameter_types! {
35 pub const WestendLocation: Location = Location::parent();
36 pub const WestendNetwork: NetworkId = NetworkId::ByGenesis(WESTEND_GENESIS_HASH);
37 pub UniversalLocation: InteriorLocation = [GlobalConsensus(WestendNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
38}
39
40pub type XcmOriginToTransactDispatchOrigin = (
44 LocationAsSuperuser<Equals<GovernanceLocation>, RuntimeOrigin>,
46 SovereignSignedViaLocation<ParentIsPreset<AccountId>, RuntimeOrigin>,
50 ParentAsSuperuser<RuntimeOrigin>,
53);
54
55pub struct JustTheParent;
56impl Contains<Location> for JustTheParent {
57 fn contains(location: &Location) -> bool {
58 matches!(location.unpack(), (1, []))
59 }
60}
61
62parameter_types! {
63 pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
65 pub const MaxInstructions: u32 = 100;
66 pub const MaxAssetsIntoHolding: u32 = 64;
67}
68
69pub struct XcmConfig;
70impl xcm_executor::Config for XcmConfig {
71 type RuntimeCall = RuntimeCall;
72 type XcmSender = (); type XcmEventEmitter = ();
74 type AssetTransactor = (); type OriginConverter = XcmOriginToTransactDispatchOrigin;
76 type IsReserve = (); type IsTeleporter = (); type UniversalLocation = UniversalLocation;
79 type Barrier = AllowExplicitUnpaidExecutionFrom<(JustTheParent, Equals<GovernanceLocation>)>;
80 type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>; type Trader = (); type ResponseHandler = (); type AssetTrap = (); type AssetClaims = (); type SubscriptionService = (); type PalletInstancesInfo = AllPalletsWithSystem;
87 type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
88 type AssetLocker = ();
89 type AssetExchanger = ();
90 type FeeManager = ();
91 type MessageExporter = ();
92 type UniversalAliases = Nothing;
93 type CallDispatcher = RuntimeCall;
94 type SafeCallFilter = Everything;
95 type Aliasers = Nothing;
96 type TransactionalProcessor = FrameTransactionalProcessor;
97 type HrmpNewChannelOpenRequestHandler = ();
98 type HrmpChannelAcceptedHandler = ();
99 type HrmpChannelClosingHandler = ();
100 type XcmRecorder = ();
101}
102
103impl cumulus_pallet_xcm::Config for Runtime {
104 type RuntimeEvent = RuntimeEvent;
105 type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>;
106}