git.delta.rocks / unique-network / refs/commits / 1cbdff92adea

difftreelog

refactor add up-common

Daniel Shiposha2022-08-11parent: #7a36e4c.patch.diff
in: master

28 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1128,18 +1128,6 @@
 ]
 
 [[package]]
-name = "common-types"
-version = "0.9.24"
-dependencies = [
- "fp-rpc",
- "pallet-evm",
- "sp-consensus-aura",
- "sp-core",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
 name = "concurrent-queue"
 version = "1.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5294,7 +5282,6 @@
 name = "opal-runtime"
 version = "0.9.24"
 dependencies = [
- "common-types",
  "cumulus-pallet-aura-ext",
  "cumulus-pallet-dmp-queue",
  "cumulus-pallet-parachain-system",
@@ -5366,6 +5353,7 @@
  "sp-transaction-pool",
  "sp-version",
  "substrate-wasm-builder",
+ "up-common",
  "up-data-structs",
  "up-rpc",
  "up-sponsorship",
@@ -8610,7 +8598,6 @@
 name = "quartz-runtime"
 version = "0.9.24"
 dependencies = [
- "common-types",
  "cumulus-pallet-aura-ext",
  "cumulus-pallet-dmp-queue",
  "cumulus-pallet-parachain-system",
@@ -8682,6 +8669,7 @@
  "sp-transaction-pool",
  "sp-version",
  "substrate-wasm-builder",
+ "up-common",
  "up-data-structs",
  "up-rpc",
  "up-sponsorship",
@@ -11897,7 +11885,6 @@
 name = "tests"
 version = "0.1.0"
 dependencies = [
- "common-types",
  "evm-coder",
  "fp-evm-mapping",
  "frame-support",
@@ -12480,7 +12467,6 @@
 version = "0.9.24"
 dependencies = [
  "clap",
- "common-types",
  "cumulus-client-cli",
  "cumulus-client-collator",
  "cumulus-client-consensus-aura",
@@ -12559,6 +12545,7 @@
  "try-runtime-cli",
  "unique-rpc",
  "unique-runtime",
+ "up-common",
  "up-data-structs",
  "up-rpc",
 ]
@@ -12567,7 +12554,6 @@
 name = "unique-rpc"
 version = "0.1.0"
 dependencies = [
- "common-types",
  "fc-db",
  "fc-mapping-sync",
  "fc-rpc",
@@ -12608,6 +12594,7 @@
  "substrate-frame-rpc-system",
  "tokio 0.2.25",
  "uc-rpc",
+ "up-common",
  "up-data-structs",
  "up-rpc",
 ]
@@ -12616,7 +12603,6 @@
 name = "unique-runtime"
 version = "0.9.24"
 dependencies = [
- "common-types",
  "cumulus-pallet-aura-ext",
  "cumulus-pallet-dmp-queue",
  "cumulus-pallet-parachain-system",
@@ -12688,6 +12674,7 @@
  "sp-transaction-pool",
  "sp-version",
  "substrate-wasm-builder",
+ "up-common",
  "up-data-structs",
  "up-rpc",
  "up-sponsorship",
@@ -12725,6 +12712,19 @@
 checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
 
 [[package]]
+name = "up-common"
+version = "0.9.24"
+dependencies = [
+ "fp-rpc",
+ "frame-support",
+ "pallet-evm",
+ "sp-consensus-aura",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
 name = "up-data-structs"
 version = "0.2.1"
 dependencies = [
deletedcommon-types/Cargo.tomldiffbeforeafterboth
--- a/common-types/Cargo.toml
+++ /dev/null
@@ -1,50 +0,0 @@
-[package]
-authors = ['Unique Network <support@uniquenetwork.io>']
-description = 'Unique Runtime Common'
-edition = '2021'
-homepage = 'https://unique.network'
-license = 'All Rights Reserved'
-name = 'common-types'
-repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.9.24'
-
-[features]
-default = ['std']
-std = [
-    'sp-std/std',
-    'sp-runtime/std',
-    'sp-core/std',
-    'sp-consensus-aura/std',
-    'fp-rpc/std',
-    'pallet-evm/std',
-]
-
-[dependencies.sp-std]
-default-features = false
-git = "https://github.com/paritytech/substrate"
-branch = "polkadot-v0.9.24"
-
-[dependencies.sp-runtime]
-default-features = false
-git = "https://github.com/paritytech/substrate"
-branch = "polkadot-v0.9.24"
-
-[dependencies.sp-core]
-default-features = false
-git = "https://github.com/paritytech/substrate"
-branch = "polkadot-v0.9.24"
-
-[dependencies.sp-consensus-aura]
-default-features = false
-git = "https://github.com/paritytech/substrate"
-branch = "polkadot-v0.9.24"
-
-[dependencies.fp-rpc]
-default-features = false
-git = "https://github.com/uniquenetwork/frontier"
-branch = "unique-polkadot-v0.9.24"
-
-[dependencies.pallet-evm]
-default-features = false
-git = "https://github.com/uniquenetwork/frontier"
-branch = "unique-polkadot-v0.9.24"
deletedcommon-types/src/lib.rsdiffbeforeafterboth
--- a/common-types/src/lib.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-#![cfg_attr(not(feature = "std"), no_std)]
-
-use sp_runtime::{
-	generic,
-	traits::{Verify, IdentifyAccount},
-	MultiSignature,
-};
-
-/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
-/// the specifics of the runtime. They can then be made to be agnostic over specific formats
-/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
-/// to even the core data structures.
-pub mod opaque {
-	pub use sp_runtime::{generic, traits::BlakeTwo256, OpaqueExtrinsic as UncheckedExtrinsic};
-
-	pub use super::{BlockNumber, Signature, AccountId, Balance, Index, Hash, AuraId};
-
-	/// Opaque block header type.
-	pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
-
-	/// Opaque block type.
-	pub type Block = generic::Block<Header, UncheckedExtrinsic>;
-
-	pub trait RuntimeInstance {
-		type CrossAccountId: pallet_evm::account::CrossAccountId<sp_runtime::AccountId32>
-			+ Send
-			+ Sync
-			+ 'static;
-
-		type TransactionConverter: fp_rpc::ConvertTransaction<UncheckedExtrinsic>
-			+ Send
-			+ Sync
-			+ 'static;
-
-		fn get_transaction_converter() -> Self::TransactionConverter;
-	}
-}
-
-pub type SessionHandlers = ();
-
-/// An index to a block.
-pub type BlockNumber = u32;
-
-/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
-pub type Signature = MultiSignature;
-
-/// Some way of identifying an account on the chain. We intentionally make it equivalent
-/// to the public key of our transaction signing scheme.
-pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
-
-/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
-/// never know...
-pub type AccountIndex = u32;
-
-/// Balance of an account.
-pub type Balance = u128;
-
-/// Index of a transaction in the chain.
-pub type Index = u32;
-
-/// A hash of some data used by the chain.
-pub type Hash = sp_core::H256;
-
-/// Digest item type.
-pub type DigestItem = generic::DigestItem;
-
-pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -253,8 +253,8 @@
 ################################################################################
 # Local dependencies
 
-[dependencies.common-types]
-path = "../../common-types"
+[dependencies.up-common]
+path = "../../primitives/common"
 
 [dependencies.unique-runtime]
 path = '../../runtime/unique'
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -23,7 +23,7 @@
 use serde::{Deserialize, Serialize};
 use serde_json::map::Map;
 
-use common_types::opaque::*;
+use up_common::types::opaque::*;
 
 #[cfg(feature = "unique-runtime")]
 pub use unique_runtime as default_runtime;
modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -64,7 +64,7 @@
 use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
 use std::{io::Write, net::SocketAddr, time::Duration};
 
-use common_types::opaque::Block;
+use up_common::types::opaque::Block;
 
 macro_rules! no_runtime_err {
 	($chain_name:expr) => {
modifiednode/cli/src/service.rsdiffbeforeafterboth
--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -63,7 +63,7 @@
 use fc_rpc_core::types::FilterPool;
 use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};
 
-use common_types::opaque::{AuraId, RuntimeInstance, AccountId, Balance, Index, Hash, Block};
+use up_common::types::opaque::{AuraId, RuntimeInstance, AccountId, Balance, Index, Hash, Block};
 
 // RMRK
 use up_data_structs::{
modifiednode/rpc/Cargo.tomldiffbeforeafterboth
--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -49,7 +49,7 @@
 fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }
 
 pallet-common = { default-features = false, path = "../../pallets/common" }
-common-types = { path = "../../common-types" }
+up-common = { path = "../../primitives/common" }
 pallet-unique = { path = "../../pallets/unique" }
 uc-rpc = { path = "../../client/rpc" }
 up-rpc = { path = "../../primitives/rpc" }
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -40,7 +40,7 @@
 use sc_service::TransactionPool;
 use std::{collections::BTreeMap, sync::Arc};
 
-use common_types::opaque::{Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance};
+use up_common::types::opaque::{Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance};
 
 // RMRK
 use up_data_structs::{
modifiedruntime/common/config/ethereum.rsdiffbeforeafterboth
--- a/runtime/common/config/ethereum.rs
+++ b/runtime/common/config/ethereum.rs
@@ -7,12 +7,13 @@
 use sp_runtime::{RuntimeAppPublic, Perbill};
 use crate::{
 	runtime_common::{
-		constants::*, dispatch::CollectionDispatchT, ethereum::sponsoring::EvmSponsorshipHandler,
+		dispatch::CollectionDispatchT, ethereum::sponsoring::EvmSponsorshipHandler,
 		config::sponsoring::DefaultSponsoringRateLimit, DealWithFees,
 	},
 	Runtime, Aura, Balances, Event, ChainId,
 };
 use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping};
+use up_common::constants::*;
 
 pub type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;
 
modifiedruntime/common/config/orml.rsdiffbeforeafterboth
--- a/runtime/common/config/orml.rs
+++ b/runtime/common/config/orml.rs
@@ -16,8 +16,11 @@
 
 use frame_support::parameter_types;
 use frame_system::EnsureSigned;
-use crate::{runtime_common::constants::*, Runtime, Event, RelayChainBlockNumberProvider};
-use common_types::{AccountId, Balance};
+use crate::{Runtime, Event, RelayChainBlockNumberProvider};
+use up_common::{
+	types::{AccountId, Balance},
+	constants::*,
+};
 
 parameter_types! {
 	pub const MinVestedTransfer: Balance = 10 * UNIQUE;
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -18,7 +18,6 @@
 use sp_runtime::traits::AccountIdConversion;
 use crate::{
 	runtime_common::{
-		constants::*,
 		dispatch::CollectionDispatchT,
 		config::{substrate::TreasuryModuleId, ethereum::EvmCollectionHelpersAddress},
 		weights::CommonWeights,
@@ -26,7 +25,10 @@
 	},
 	Runtime, Event, Call, Balances,
 };
-use common_types::{AccountId, Balance, BlockNumber};
+use up_common::{
+	types::{AccountId, Balance, BlockNumber},
+	constants::*,
+};
 use up_data_structs::{
 	mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},
 };
modifiedruntime/common/config/pallets/scheduler.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/scheduler.rs
+++ b/runtime/common/config/pallets/scheduler.rs
@@ -22,7 +22,7 @@
 	runtime_common::{scheduler::SchedulerPaymentExecutor, config::substrate::RuntimeBlockWeights},
 	Runtime, Call, Event, Origin, OriginCaller, Balances,
 };
-use common_types::AccountId;
+use up_common::types::AccountId;
 
 parameter_types! {
 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
modifiedruntime/common/config/parachain.rsdiffbeforeafterboth
--- a/runtime/common/config/parachain.rs
+++ b/runtime/common/config/parachain.rs
@@ -15,7 +15,8 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{weights::Weight, parameter_types};
-use crate::{runtime_common::constants::*, Runtime, Event, XcmpQueue, DmpQueue};
+use crate::{Runtime, Event, XcmpQueue, DmpQueue};
+use up_common::constants::*;
 
 parameter_types! {
 	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
modifiedruntime/common/config/sponsoring.rsdiffbeforeafterboth
--- a/runtime/common/config/sponsoring.rs
+++ b/runtime/common/config/sponsoring.rs
@@ -16,10 +16,10 @@
 
 use frame_support::parameter_types;
 use crate::{
-	runtime_common::{constants::*, sponsoring::UniqueSponsorshipHandler},
+	runtime_common::{sponsoring::UniqueSponsorshipHandler},
 	Runtime,
 };
-use common_types::BlockNumber;
+use up_common::{types::BlockNumber, constants::*};
 
 parameter_types! {
 	pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;
modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -35,10 +35,10 @@
 use sp_arithmetic::traits::{BaseArithmetic, Unsigned};
 use smallvec::smallvec;
 use crate::{
-	runtime_common::{DealWithFees, constants::*},
-	Runtime, Event, Call, Origin, PalletInfo, System, Balances, Treasury, SS58Prefix, Version,
+	runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,
+	Treasury, SS58Prefix, Version,
 };
-use common_types::*;
+use up_common::{types::*, constants::*};
 
 parameter_types! {
 	pub const BlockHashCount: BlockNumber = 2400;
modifiedruntime/common/config/xcm.rsdiffbeforeafterboth
before · runtime/common/config/xcm.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 frame_support::{18	traits::{19		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Get, Everything,20	},21	weights::{Weight, WeightToFeePolynomial, WeightToFee},22	parameter_types, match_types,23};24use frame_system::EnsureRoot;25use sp_runtime::{26	traits::{Saturating, CheckedConversion, Zero},27	SaturatedConversion,28};29use pallet_xcm::XcmPassthrough;30use polkadot_parachain::primitives::Sibling;31use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};32use xcm::latest::{33	AssetId::{Concrete},34	Fungibility::Fungible as XcmFungible,35	MultiAsset, Error as XcmError,36};37use xcm_executor::traits::{MatchesFungible, WeightTrader};38use xcm_builder::{39	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,40	FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser, RelayChainAsNative,41	SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,42	SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, ParentIsPreset,43};44use xcm_executor::{Config, XcmExecutor, Assets};45use sp_std::marker::PhantomData;46use crate::{47	runtime_common::{constants::*, config::substrate::LinearFee},48	Runtime, Call, Event, Origin, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,49};50use common_types::{AccountId, Balance};5152parameter_types! {53	pub const RelayLocation: MultiLocation = MultiLocation::parent();54	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;55	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();56	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();57}5859/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used60/// when determining ownership of accounts for asset transacting and when attempting to use XCM61/// `Transact` in order to determine the dispatch Origin.62pub type LocationToAccountId = (63	// The parent (Relay-chain) origin converts to the default `AccountId`.64	ParentIsPreset<AccountId>,65	// Sibling parachain origins convert to AccountId via the `ParaId::into`.66	SiblingParachainConvertsVia<Sibling, AccountId>,67	// Straight up local `AccountId32` origins just alias directly to `AccountId`.68	AccountId32Aliases<RelayNetwork, AccountId>,69);7071pub struct OnlySelfCurrency;72impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {73	fn matches_fungible(a: &MultiAsset) -> Option<B> {74		match (&a.id, &a.fun) {75			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),76			_ => None,77		}78	}79}8081/// Means for transacting assets on this chain.82pub type LocalAssetTransactor = CurrencyAdapter<83	// Use this currency:84	Balances,85	// Use this currency when it is a fungible asset matching the given location or name:86	OnlySelfCurrency,87	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:88	LocationToAccountId,89	// Our chain's account ID type (we can't get away without mentioning it explicitly):90	AccountId,91	// We don't track any teleports.92	(),93>;9495/// No local origins on this chain are allowed to dispatch XCM sends/executions.96pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);9798/// The means for routing XCM messages which are not for local execution into the right message99/// queues.100pub type XcmRouter = (101	// Two routers - use UMP to communicate with the relay chain:102	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,103	// ..and XCMP to communicate with the sibling chains.104	XcmpQueue,105);106107/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,108/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can109/// biases the kind of local `Origin` it will become.110pub type XcmOriginToTransactDispatchOrigin = (111	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location112	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for113	// foreign chains who want to have a local sovereign account on this chain which they control.114	SovereignSignedViaLocation<LocationToAccountId, Origin>,115	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when116	// recognised.117	RelayChainAsNative<RelayOrigin, Origin>,118	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when119	// recognised.120	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,121	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a122	// transaction from the Root origin.123	ParentAsSuperuser<Origin>,124	// Native signed account converter; this just converts an `AccountId32` origin into a normal125	// `Origin::Signed` origin of the same 32-byte value.126	SignedAccountId32AsNative<RelayNetwork, Origin>,127	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.128	XcmPassthrough<Origin>,129);130131parameter_types! {132	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.133	pub UnitWeightCost: Weight = 1_000_000;134	// 1200 UNIQUEs buy 1 second of weight.135	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);136	pub const MaxInstructions: u32 = 100;137}138139match_types! {140	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {141		MultiLocation { parents: 1, interior: Here } |142		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }143	};144}145146pub type Barrier = (147	TakeWeightCredit,148	AllowTopLevelPaidExecutionFrom<Everything>,149	// ^^^ Parent & its unit plurality gets free execution150);151152pub struct UsingOnlySelfCurrencyComponents<153	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,154	AssetId: Get<MultiLocation>,155	AccountId,156	Currency: CurrencyT<AccountId>,157	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,158>(159	Weight,160	Currency::Balance,161	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,162);163impl<164		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,165		AssetId: Get<MultiLocation>,166		AccountId,167		Currency: CurrencyT<AccountId>,168		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,169	> WeightTrader170	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>171{172	fn new() -> Self {173		Self(0, Zero::zero(), PhantomData)174	}175176	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {177		let amount = WeightToFee::weight_to_fee(&weight);178		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;179180		// location to this parachain through relay chain181		let option1: xcm::v1::AssetId = Concrete(MultiLocation {182			parents: 1,183			interior: X1(Parachain(ParachainInfo::parachain_id().into())),184		});185		// direct location186		let option2: xcm::v1::AssetId = Concrete(MultiLocation {187			parents: 0,188			interior: Here,189		});190191		let required = if payment.fungible.contains_key(&option1) {192			(option1, u128_amount).into()193		} else if payment.fungible.contains_key(&option2) {194			(option2, u128_amount).into()195		} else {196			(Concrete(MultiLocation::default()), u128_amount).into()197		};198199		let unused = payment200			.checked_sub(required)201			.map_err(|_| XcmError::TooExpensive)?;202		self.0 = self.0.saturating_add(weight);203		self.1 = self.1.saturating_add(amount);204		Ok(unused)205	}206207	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {208		let weight = weight.min(self.0);209		let amount = WeightToFee::weight_to_fee(&weight);210		self.0 -= weight;211		self.1 = self.1.saturating_sub(amount);212		let amount: u128 = amount.saturated_into();213		if amount > 0 {214			Some((AssetId::get(), amount).into())215		} else {216			None217		}218	}219}220impl<221		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,222		AssetId: Get<MultiLocation>,223		AccountId,224		Currency: CurrencyT<AccountId>,225		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,226	> Drop227	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>228{229	fn drop(&mut self) {230		OnUnbalanced::on_unbalanced(Currency::issue(self.1));231	}232}233234pub struct XcmConfig;235impl Config for XcmConfig {236	type Call = Call;237	type XcmSender = XcmRouter;238	// How to withdraw and deposit an asset.239	type AssetTransactor = LocalAssetTransactor;240	type OriginConverter = XcmOriginToTransactDispatchOrigin;241	type IsReserve = NativeAsset;242	type IsTeleporter = (); // Teleportation is disabled243	type LocationInverter = LocationInverter<Ancestry>;244	type Barrier = Barrier;245	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;246	type Trader =247		UsingOnlySelfCurrencyComponents<LinearFee<Balance>, RelayLocation, AccountId, Balances, ()>;248	type ResponseHandler = (); // Don't handle responses for now.249	type SubscriptionService = PolkadotXcm;250251	type AssetTrap = PolkadotXcm;252	type AssetClaims = PolkadotXcm;253}254255impl pallet_xcm::Config for Runtime {256	type Event = Event;257	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;258	type XcmRouter = XcmRouter;259	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;260	type XcmExecuteFilter = Everything;261	type XcmExecutor = XcmExecutor<XcmConfig>;262	type XcmTeleportFilter = Everything;263	type XcmReserveTransferFilter = Everything;264	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;265	type LocationInverter = LocationInverter<Ancestry>;266	type Origin = Origin;267	type Call = Call;268	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;269	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;270}271272impl cumulus_pallet_xcm::Config for Runtime {273	type Event = Event;274	type XcmExecutor = XcmExecutor<XcmConfig>;275}276277impl cumulus_pallet_xcmp_queue::Config for Runtime {278	type WeightInfo = ();279	type Event = Event;280	type XcmExecutor = XcmExecutor<XcmConfig>;281	type ChannelInfo = ParachainSystem;282	type VersionWrapper = ();283	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;284	type ControllerOrigin = EnsureRoot<AccountId>;285	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;286}287288impl cumulus_pallet_dmp_queue::Config for Runtime {289	type Event = Event;290	type XcmExecutor = XcmExecutor<XcmConfig>;291	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;292}
modifiedruntime/common/constants.rsdiffbeforeafterboth
--- a/runtime/common/constants.rs
+++ b/runtime/common/constants.rs
@@ -19,7 +19,7 @@
 	parameter_types,
 	weights::{Weight, constants::WEIGHT_PER_SECOND},
 };
-use common_types::{BlockNumber, Balance};
+use up_common::types::{BlockNumber, Balance};
 
 pub const MILLISECS_PER_BLOCK: u64 = 12000;
 
modifiedruntime/common/instance.rsdiffbeforeafterboth
--- a/runtime/common/instance.rs
+++ b/runtime/common/instance.rs
@@ -4,7 +4,7 @@
 	},
 	Runtime,
 };
-use common_types::opaque::RuntimeInstance;
+use up_common::types::opaque::RuntimeInstance;
 
 impl RuntimeInstance for Runtime {
 	type CrossAccountId = CrossAccountId;
modifiedruntime/common/mod.rsdiffbeforeafterboth
--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -41,7 +41,7 @@
 	Runtime, Call, Balances, Treasury, Aura, Signature, AllPalletsReversedWithSystemFirst,
 	InherentDataExt,
 };
-use common_types::{AccountId, BlockNumber};
+use up_common::types::{AccountId, BlockNumber};
 
 #[macro_export]
 macro_rules! unsupported {
modifiedruntime/common/scheduler.rsdiffbeforeafterboth
--- a/runtime/common/scheduler.rs
+++ b/runtime/common/scheduler.rs
@@ -25,7 +25,7 @@
 	DispatchErrorWithPostInfo, DispatchError,
 };
 use crate::{Runtime, Call, Origin, Balances, ChargeTransactionPayment};
-use common_types::{AccountId, Balance};
+use up_common::types::{AccountId, Balance};
 use fp_self_contained::SelfContainedCall;
 use pallet_unique_scheduler::DispatchCall;
 
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -113,7 +113,7 @@
     'xcm/std',
     'xcm-builder/std',
     'xcm-executor/std',
-    'common-types/std',
+    'up-common/std',
     'rmrk-rpc/std',
     'evm-coder/std',
     'up-sponsorship/std',
@@ -403,7 +403,7 @@
 
 [dependencies]
 log = { version = "0.4.16", default-features = false }
-common-types = { path = "../../common-types", default-features = false }
+up-common = { path = "../../primitives/common", default-features = false }
 scale-info = { version = "2.0.1", default-features = false, features = [
     "derive",
 ] }
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -30,7 +30,7 @@
 use sp_version::RuntimeVersion;
 use sp_runtime::create_runtime_str;
 
-use common_types::*;
+use up_common::types::*;
 
 #[path = "../../common/mod.rs"]
 mod runtime_common;
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -113,7 +113,7 @@
     'xcm/std',
     'xcm-builder/std',
     'xcm-executor/std',
-    'common-types/std',
+    'up-common/std',
 
     "orml-vesting/std",
 ]
@@ -408,7 +408,7 @@
 
 [dependencies]
 log = { version = "0.4.16", default-features = false }
-common-types = { path = "../../common-types", default-features = false }
+up-common = { path = "../../primitives/common", default-features = false }
 scale-info = { version = "2.0.1", default-features = false, features = [
     "derive",
 ] }
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -30,7 +30,7 @@
 use sp_version::RuntimeVersion;
 use sp_runtime::create_runtime_str;
 
-use common_types::*;
+use up_common::types::*;
 
 #[path = "../../common/mod.rs"]
 mod runtime_common;
modifiedruntime/tests/Cargo.tomldiffbeforeafterboth
--- a/runtime/tests/Cargo.toml
+++ b/runtime/tests/Cargo.toml
@@ -42,6 +42,5 @@
 ] }
 scale-info = "*"
 
-common-types = { path = "../../common-types", default-features = false }
 evm-coder = { default-features = false, path = '../../crates/evm-coder' }
 up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.24' }
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -114,7 +114,7 @@
     'xcm/std',
     'xcm-builder/std',
     'xcm-executor/std',
-    'common-types/std',
+    'up-common/std',
 
     "orml-vesting/std",
 ]
@@ -401,7 +401,7 @@
 
 [dependencies]
 log = { version = "0.4.16", default-features = false }
-common-types = { path = "../../common-types", default-features = false }
+up-common = { path = "../../primitives/common", default-features = false }
 scale-info = { version = "2.0.1", default-features = false, features = [
     "derive",
 ] }
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -30,7 +30,7 @@
 use sp_version::RuntimeVersion;
 use sp_runtime::create_runtime_str;
 
-use common_types::*;
+use up_common::types::*;
 
 #[path = "../../common/mod.rs"]
 mod runtime_common;