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::{18 {match_types, weights::Weight},19 traits::Everything,20};21use xcm::{22 latest::Xcm,23 v1::{BodyId, Junction::*, Junctions::*, MultiLocation},24};25use xcm_builder::{AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, TakeWeightCredit};26use xcm_executor::traits::ShouldExecute;2728use crate::runtime_common::config::xcm::{DenyThenTry, DenyTransact};2930match_types! {31 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {32 MultiLocation { parents: 1, interior: Here } |33 MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }34 };35}3637/// Execution barrier that just takes `max_weight` from `weight_credit`.38///39/// Useful to allow XCM execution by local chain users via extrinsics.40/// E.g. `pallet_xcm::reserve_asset_transfer` to transfer a reserve asset41/// out of the local chain to another one.42pub struct AllowAllDebug;43impl ShouldExecute for AllowAllDebug {44 fn should_execute<Call>(45 _origin: &MultiLocation,46 _message: &mut Xcm<Call>,47 _max_weight: Weight,48 _weight_credit: &mut Weight,49 ) -> Result<(), ()> {50 Ok(())51 }52}5354pub type Barrier = DenyThenTry<55 DenyTransact,56 (57 TakeWeightCredit,58 AllowTopLevelPaidExecutionFrom<Everything>,59 AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,60 // ^^^ Parent & its unit plurality gets free execution61 AllowAllDebug,62 ),63>;difftreelog
source
runtime/opal/src/xcm_config.rs2.0 KiBsourcehistory