git.delta.rocks / unique-network / refs/commits / e0c98a46d28e

difftreelog

source

runtime/unique/src/xcm_config.rs2.5 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{match_types, parameter_types, traits::Get};18use sp_std::{vec, vec::Vec};19use xcm::v1::{BodyId, Junction::*, Junctions::*, MultiLocation};20use xcm_builder::{21	AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowUnpaidExecutionFrom, TakeWeightCredit,22};2324use crate::{25	ParachainInfo, PolkadotXcm,26	runtime_common::config::xcm::{DenyThenTry, DenyTransact, DenyExchangeWithUnknownLocation},27};2829match_types! {30	pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {31		MultiLocation { parents: 1, interior: Here } |32		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }33	};34	pub type ParentOrSiblings: impl Contains<MultiLocation> = {35		MultiLocation { parents: 1, interior: Here } |36		MultiLocation { parents: 1, interior: X1(_) }37	};38}3940parameter_types! {41	pub UniqueAllowedLocations: Vec<MultiLocation> = vec![42		// Self location43		MultiLocation {44			parents: 0,45			interior: Here,46		},47		// Parent location48		MultiLocation {49			parents: 1,50			interior: Here,51		},52		// Karura/Acala location53		MultiLocation {54			parents: 1,55			interior: X1(Parachain(2000)),56		},57		// Moonbeam location58		MultiLocation {59			parents: 1,60			interior: X1(Parachain(2004)),61		},62		// Self parachain address63		MultiLocation {64			parents: 1,65			interior: X1(Parachain(ParachainInfo::get().into())),66		},67	];68}6970pub type Barrier = DenyThenTry<71	(72		DenyTransact,73		DenyExchangeWithUnknownLocation<UniqueAllowedLocations>,74	),75	(76		TakeWeightCredit,77		// Parent and its exec plurality get free execution78		AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,79		// Expected responses are OK.80		AllowKnownQueryResponses<PolkadotXcm>,81		// Subscriptions for version tracking are OK.82		AllowSubscriptionsFrom<ParentOrSiblings>,83	),84>;