git.delta.rocks / unique-network / refs/commits / 5ae285ceffc0

difftreelog

wip upd quartz

Ilja Khabarov2022-08-23parent: #bad3c4a.patch.diff
in: master

4 files changed

modifiedruntime/common/config/xcm.rsdiffbeforeafterboth
--- a/runtime/common/config/xcm.rs
+++ b/runtime/common/config/xcm.rs
@@ -358,8 +358,8 @@
 #[cfg(feature = "foreign-assets")]
 pub type AssetTransactors = FungiblesTransactor;
 
-//#[cfg(not(feature = "foreign-assets"))]
-//pub type AssetTransactors = LocalAssetTransactor;
+#[cfg(not(feature = "foreign-assets"))]
+pub type AssetTransactors = LocalAssetTransactor;
 
 #[cfg(feature = "foreign-assets")]
 pub struct AllAsset;
@@ -372,15 +372,14 @@
 
 #[cfg(feature = "foreign-assets")]
 pub type IsReserve = AllAsset;
-//#[cfg(not(feature = "foreign-assets"))]
-//pub type IsReserve = NativeAsset;
+#[cfg(not(feature = "foreign-assets"))]
+pub type IsReserve = NativeAsset;
 
 #[cfg(feature = "foreign-assets")]
 type Trader<T> =
 	UsingAnyCurrencyComponents<
 		pallet_configuration::WeightToFee<T, Balance>,
 		RelayLocation, AccountId, Balances, ()>;
-/*
 #[cfg(not(feature = "foreign-assets"))]
 type Trader<T> = UsingOnlySelfCurrencyComponents<
 	pallet_configuration::WeightToFee<T, Balance>,
@@ -389,7 +388,6 @@
 	Balances,
 	(),
 >;
-*/
 
 pub struct XcmConfig<T>(PhantomData<T>);
 impl<T> Config for XcmConfig<T>
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -35,6 +35,8 @@
 #[path = "../../common/mod.rs"]
 mod runtime_common;
 
+pub mod xcm_config;
+
 pub use runtime_common::*;
 
 pub const RUNTIME_NAME: &str = "quartz";
addedruntime/quartz/src/xcm_config.rsdiffbeforeafterboth
after · runtime/quartz/src/xcm_config.rs
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 cumulus_pallet_xcm;18use frame_support::{19    {match_types, parameter_types, weights::Weight},20    pallet_prelude::Get,21    traits::{Contains, Everything, fungibles},22};23use frame_system::EnsureRoot;24use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};25use pallet_xcm::XcmPassthrough;26use polkadot_parachain::primitives::Sibling;27use sp_runtime::traits::{AccountIdConversion, CheckedConversion, Convert, Zero};28use sp_std::{borrow::Borrow, marker::PhantomData, vec, vec::Vec};29use xcm::{30    latest::{MultiAsset, Xcm},31    prelude::{Concrete, Fungible as XcmFungible},32    v1::{BodyId, Junction::*, Junctions::*, MultiLocation, NetworkId},33};34use xcm_builder::{35    AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom,36    EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, LocationInverter, ParentAsSuperuser,37    ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,38    SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,39    ConvertedConcreteAssetId,40};41use xcm_executor::{42    {Config, XcmExecutor},43    traits::{Convert as ConvertXcm, FilterAssetLocation, JustTry, MatchesFungible, ShouldExecute},44};4546use up_common::{47    constants::{MAXIMUM_BLOCK_WEIGHT, UNIQUE},48    types::{AccountId, Balance},49};5051use crate::{52    Balances, Call, DmpQueue, Event, Origin, ParachainInfo,53    ParachainSystem, PolkadotXcm, Runtime, XcmpQueue,54};55use crate::runtime_common::config::substrate::{TreasuryModuleId, MaxLocks, MaxReserves};56use crate::runtime_common::config::pallets::TreasuryAccountId;57use crate::runtime_common::config::xcm::*;58use crate::*;5960// Signed version of balance61pub type Amount = i128;6263match_types! {64	pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {65		MultiLocation { parents: 1, interior: Here } |66		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }67	};68	pub type ParentOrSiblings: impl Contains<MultiLocation> = {69		MultiLocation { parents: 1, interior: Here } |70		MultiLocation { parents: 1, interior: X1(_) }71	};72}7374/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.75/// If it passes the Deny, and matches one of the Allow cases then it is let through.76pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)77    where78        Deny: ShouldExecute,79        Allow: ShouldExecute;8081impl<Deny, Allow> ShouldExecute for DenyThenTry<Deny, Allow>82    where83        Deny: ShouldExecute,84        Allow: ShouldExecute,85{86    fn should_execute<Call>(87        origin: &MultiLocation,88        message: &mut Xcm<Call>,89        max_weight: Weight,90        weight_credit: &mut Weight,91    ) -> Result<(), ()> {92        Deny::should_execute(origin, message, max_weight, weight_credit)?;93        Allow::should_execute(origin, message, max_weight, weight_credit)94    }95}9697pub type Barrier = DenyThenTry<98    DenyExchangeWithUnknownLocation,99    (100        TakeWeightCredit,101        AllowTopLevelPaidExecutionFrom<Everything>,102        // Parent and its exec plurality get free execution103        AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,104        // Expected responses are OK.105        AllowKnownQueryResponses<PolkadotXcm>,106        // Subscriptions for version tracking are OK.107        AllowSubscriptionsFrom<ParentOrSiblings>,108    ),109>;
addedruntime/unique/src/xcm_config.rsdiffbeforeafterboth

no changes