use super::{
AccountId, AllPalletsWithSystem, ParachainInfo, Runtime, RuntimeCall, RuntimeEvent,
RuntimeOrigin,
};
use frame_support::{
match_types, parameter_types,
traits::{Everything, Nothing},
weights::Weight,
};
use xcm::latest::prelude::*;
use xcm_builder::{
AllowExplicitUnpaidExecutionFrom, FixedWeightBounds, ParentAsSuperuser, ParentIsPreset,
SovereignSignedViaLocation,
};
parameter_types! {
pub const RococoLocation: MultiLocation = MultiLocation::parent();
pub const RococoNetwork: Option<NetworkId> = Some(NetworkId::Rococo);
pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));
}
pub type XcmOriginToTransactDispatchOrigin = (
SovereignSignedViaLocation<ParentIsPreset<AccountId>, RuntimeOrigin>,
ParentAsSuperuser<RuntimeOrigin>,
);
match_types! {
pub type JustTheParent: impl Contains<MultiLocation> = { MultiLocation { parents:1, interior: Here } };
}
parameter_types! {
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
}
pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
type RuntimeCall = RuntimeCall;
type XcmSender = (); type AssetTransactor = (); type OriginConverter = XcmOriginToTransactDispatchOrigin;
type IsReserve = (); type IsTeleporter = (); type UniversalLocation = UniversalLocation;
type Barrier = AllowExplicitUnpaidExecutionFrom<JustTheParent>;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>; type Trader = (); type ResponseHandler = (); type AssetTrap = (); type AssetClaims = (); type SubscriptionService = (); type PalletInstancesInfo = AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
}
impl cumulus_pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>;
}