1234567891011121314151617use frame_support::{18 match_types, parameter_types,19 traits::{Get, Everything},20};21use sp_std::{vec, vec::Vec};22use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};23use xcm_builder::{24 AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowUnpaidExecutionFrom, TakeWeightCredit,25 AllowTopLevelPaidExecutionFrom,26};2728use crate::{29 ParachainInfo, PolkadotXcm,30 runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},31};3233match_types! {34 pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {35 MultiLocation { parents: 1, interior: Here } |36 MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }37 };38 pub type ParentOrSiblings: impl Contains<MultiLocation> = {39 MultiLocation { parents: 1, interior: Here } |40 MultiLocation { parents: 1, interior: X1(_) }41 };42}4344parameter_types! {45 pub UniqueAllowedLocations: Vec<MultiLocation> = vec![46 47 MultiLocation {48 parents: 0,49 interior: Here,50 },51 52 MultiLocation {53 parents: 1,54 interior: Here,55 },56 57 MultiLocation {58 parents: 1,59 interior: X1(Parachain(2000)),60 },61 62 MultiLocation {63 parents: 1,64 interior: X1(Parachain(2004)),65 },66 67 MultiLocation {68 parents: 1,69 interior: X1(Parachain(ParachainInfo::get().into())),70 },71 ];72}7374pub type Barrier = DenyThenTry<75 (76 DenyTransact,77 DenyExchangeWithUnknownLocation<UniqueAllowedLocations>,78 ),79 (80 TakeWeightCredit,81 AllowTopLevelPaidExecutionFrom<Everything>,82 83 AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,84 85 AllowKnownQueryResponses<PolkadotXcm>,86 87 AllowSubscriptionsFrom<ParentOrSiblings>,88 ),89>;