git.delta.rocks / unique-network / refs/commits / 80605288d8ba

difftreelog

Fix after rebase

Daniel Shiposha2022-03-10parent: #8750840.patch.diff
in: master

7 files changed

modifiedruntime/common/Cargo.tomldiffbeforeafterboth
--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -26,12 +26,12 @@
 [dependencies.sp-core]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-runtime]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.codec]
 default-features = false
@@ -47,9 +47,9 @@
 [dependencies.frame-support]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-system]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -7,7 +7,7 @@
 description = 'Opal Runtime'
 edition = '2021'
 homepage = 'https://unique.network'
-license = 'All Rights Reserved'
+license = 'GPLv3'
 name = 'opal-runtime'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
 version = '0.1.0'
@@ -100,6 +100,7 @@
     'xcm/std',
     'xcm-builder/std',
     'xcm-executor/std',
+    'unique-runtime-common/std',
 
     "orml-vesting/std",
 ]
@@ -118,33 +119,33 @@
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
 optional = true
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-executive]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-support]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-system]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-system-benchmarking]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
 optional = true
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-system-rpc-runtime-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.hex-literal]
 optional = true
@@ -159,131 +160,131 @@
 [dependencies.pallet-aura]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-balances]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 # Contracts specific packages
 # [dependencies.pallet-contracts]
 # git = 'https://github.com/paritytech/substrate.git'
 # default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
 # version = '4.0.0-dev'
 
 # [dependencies.pallet-contracts-primitives]
 # git = 'https://github.com/paritytech/substrate.git'
 # default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
 # version = '4.0.0-dev'
 
 # [dependencies.pallet-contracts-rpc-runtime-api]
 # git = 'https://github.com/paritytech/substrate.git'
 # default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
 # version = '4.0.0-dev'
 
 [dependencies.pallet-randomness-collective-flip]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-sudo]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-timestamp]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-transaction-payment]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-transaction-payment-rpc-runtime-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-treasury]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 # [dependencies.pallet-vesting]
 # default-features = false
 # git = 'https://github.com/paritytech/substrate.git'
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-arithmetic]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-block-builder]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-core]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-consensus-aura]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-inherents]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-io]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-offchain]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-runtime]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-session]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-std]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-transaction-pool]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-version]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.smallvec]
 version = '1.6.1'
@@ -293,47 +294,47 @@
 
 [dependencies.parachain-info]
 default-features = false
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.cumulus-pallet-aura-ext]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-pallet-parachain-system]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-primitives-core]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-pallet-xcm]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-pallet-dmp-queue]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-pallet-xcmp-queue]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-primitives-utility]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-primitives-timestamp]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 ################################################################################
@@ -341,32 +342,32 @@
 
 [dependencies.polkadot-parachain]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.xcm]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.xcm-builder]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.xcm-executor]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.pallet-xcm]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.orml-vesting]
 git = 'https://github.com/UniqueNetwork/open-runtime-module-library'
-branch = 'unique-polkadot-v0.9.16'
+branch = 'unique-polkadot-v0.9.17'
 version = "0.4.1-dev"
 default-features = false
 
@@ -390,21 +391,20 @@
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
 pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.16', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
+pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.17', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
 pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
 pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
 pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
 
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-
 ################################################################################
 # Build Dependencies
 
 [build-dependencies.substrate-wasm-builder]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
before · runtime/opal/src/lib.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/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;31// #[cfg(any(feature = "std", test))]32// pub use sp_runtime::BuildStorage;3334use sp_runtime::{35	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,36	traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},37	transaction_validity::{TransactionSource, TransactionValidity},38	ApplyExtrinsicResult, RuntimeAppPublic,39};4041use sp_std::prelude::*;4243#[cfg(feature = "std")]44use sp_version::NativeVersion;45use sp_version::RuntimeVersion;46pub use pallet_transaction_payment::{47	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,48};49// A few exports that help ease life for downstream crates.50pub use pallet_balances::Call as BalancesCall;51pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};52pub use frame_support::{53	construct_runtime, match_type,54	dispatch::DispatchResult,55	PalletId, parameter_types, StorageValue, ConsensusEngineId,56	traits::{57		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,58		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,59		OnUnbalanced, Randomness, FindAuthor,60	},61	weights::{62		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},63		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,64		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,65	},66};67use up_data_structs::*;68// use pallet_contracts::weights::WeightInfo;69// #[cfg(any(feature = "std", test))]70use frame_system::{71	self as frame_system, EnsureRoot, EnsureSigned,72	limits::{BlockWeights, BlockLength},73};74use sp_arithmetic::{75	traits::{BaseArithmetic, Unsigned},76};77use smallvec::smallvec;78use codec::{Encode, Decode};79use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};80use fp_rpc::TransactionStatus;81use sp_runtime::{82	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},83	transaction_validity::TransactionValidityError,84	SaturatedConversion,85};8687// pub use pallet_timestamp::Call as TimestampCall;88pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;8990// Polkadot imports91use pallet_xcm::XcmPassthrough;92use polkadot_parachain::primitives::Sibling;93use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};94use xcm_builder::{95	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,96	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,97	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,98	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,99	ParentIsPreset,100};101use xcm_executor::{Config, XcmExecutor, Assets};102use sp_std::{marker::PhantomData};103104use xcm::latest::{105	//	Xcm,106	AssetId::{Concrete},107	Fungibility::Fungible as XcmFungible,108	MultiAsset,109	Error as XcmError,110};111use xcm_executor::traits::{MatchesFungible, WeightTrader};112//use xcm_executor::traits::MatchesFungible;113use sp_runtime::traits::CheckedConversion;114115use unique_runtime_common::{types::*, constants::*};116117// mod chain_extension;118// use crate::chain_extension::{NFTExtension, Imbalance};119120pub const RUNTIME_NAME: &'static str = "Opal";121122pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;123124/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know125/// the specifics of the runtime. They can then be made to be agnostic over specific formats126/// of data like extrinsics, allowing for them to continue syncing the network through upgrades127/// to even the core data structures.128pub mod opaque {129	use sp_std::prelude::*;130	use sp_runtime::impl_opaque_keys;131	use super::Aura;132133	pub use unique_runtime_common::types::*;134	pub use super::CrossAccountId;135136	impl_opaque_keys! {137		pub struct SessionKeys {138			pub aura: Aura,139		}140	}141}142143/// This runtime version.144pub const VERSION: RuntimeVersion = RuntimeVersion {145	spec_name: create_runtime_str!(RUNTIME_NAME),146	impl_name: create_runtime_str!(RUNTIME_NAME),147	authoring_version: 1,148	spec_version: 917004,149	impl_version: 0,150	apis: RUNTIME_API_VERSIONS,151	transaction_version: 1,152	state_version: 0,153};154155#[derive(codec::Encode, codec::Decode)]156pub enum XCMPMessage<XAccountId, XBalance> {157	/// Transfer tokens to the given account from the Parachain account.158	TransferToken(XAccountId, XBalance),159}160161/// The version information used to identify this runtime when compiled natively.162#[cfg(feature = "std")]163pub fn native_version() -> NativeVersion {164	NativeVersion {165		runtime_version: VERSION,166		can_author_with: Default::default(),167	}168}169170type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;171172pub struct DealWithFees;173impl OnUnbalanced<NegativeImbalance> for DealWithFees {174	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {175		if let Some(fees) = fees_then_tips.next() {176			// for fees, 100% to treasury177			let mut split = fees.ration(100, 0);178			if let Some(tips) = fees_then_tips.next() {179				// for tips, if any, 100% to treasury180				tips.ration_merge_into(100, 0, &mut split);181			}182			Treasury::on_unbalanced(split.0);183			// Author::on_unbalanced(split.1);184		}185	}186}187188parameter_types! {189	pub const BlockHashCount: BlockNumber = 2400;190	pub RuntimeBlockLength: BlockLength =191		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);192	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);193	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;194	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()195		.base_block(BlockExecutionWeight::get())196		.for_class(DispatchClass::all(), |weights| {197			weights.base_extrinsic = ExtrinsicBaseWeight::get();198		})199		.for_class(DispatchClass::Normal, |weights| {200			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);201		})202		.for_class(DispatchClass::Operational, |weights| {203			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);204			// Operational transactions have some extra reserved space, so that they205			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.206			weights.reserved = Some(207				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT208			);209		})210		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)211		.build_or_panic();212	pub const Version: RuntimeVersion = VERSION;213	pub const SS58Prefix: u8 = 42;214}215216/*2178880 - Unique2188881 - Quartz2198882 - Opal220*/221parameter_types! {222	pub const ChainId: u64 = 8882;223}224225pub struct FixedFee;226impl FeeCalculator for FixedFee {227	fn min_gas_price() -> U256 {228		// Targeting 0.15 UNQ per transfer229		1_018_751_825_264u64.into()230	}231}232233// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case234// (contract, which only writes a lot of data),235// approximating on top of our real store write weight236parameter_types! {237	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;238	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;239	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();240}241242/// Limiting EVM execution to 50% of block for substrate users and management tasks243/// EVM transaction consumes more weight than substrate's, so we can't rely on them being244/// scheduled fairly245const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);246parameter_types! {247	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());248}249250pub enum FixedGasWeightMapping {}251impl GasWeightMapping for FixedGasWeightMapping {252	fn gas_to_weight(gas: u64) -> Weight {253		gas.saturating_mul(WeightPerGas::get())254	}255	fn weight_to_gas(weight: Weight) -> u64 {256		weight / WeightPerGas::get()257	}258}259260impl pallet_evm::Config for Runtime {261	type BlockGasLimit = BlockGasLimit;262	type FeeCalculator = FixedFee;263	type GasWeightMapping = FixedGasWeightMapping;264	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;265	type CallOrigin = EnsureAddressTruncated;266	type WithdrawOrigin = EnsureAddressTruncated;267	type AddressMapping = HashedAddressMapping<Self::Hashing>;268	type PrecompilesType = ();269	type PrecompilesValue = ();270	type Currency = Balances;271	type Event = Event;272	type OnMethodCall = (273		pallet_evm_migration::OnMethodCall<Self>,274		pallet_unique::UniqueErcSupport<Self>,275		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,276	);277	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;278	type ChainId = ChainId;279	type Runner = pallet_evm::runner::stack::Runner<Self>;280	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;281	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;282	type FindAuthor = EthereumFindAuthor<Aura>;283}284285impl pallet_evm_migration::Config for Runtime {286	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;287}288289pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);290impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {291	fn find_author<'a, I>(digests: I) -> Option<H160>292	where293		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,294	{295		if let Some(author_index) = F::find_author(digests) {296			let authority_id = Aura::authorities()[author_index as usize].clone();297			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));298		}299		None300	}301}302303impl pallet_ethereum::Config for Runtime {304	type Event = Event;305	type StateRoot = pallet_ethereum::IntermediateStateRoot;306}307308impl pallet_randomness_collective_flip::Config for Runtime {}309310impl frame_system::Config for Runtime {311	/// The data to be stored in an account.312	type AccountData = pallet_balances::AccountData<Balance>;313	/// The identifier used to distinguish between accounts.314	type AccountId = AccountId;315	/// The basic call filter to use in dispatchable.316	type BaseCallFilter = Everything;317	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).318	type BlockHashCount = BlockHashCount;319	/// The maximum length of a block (in bytes).320	type BlockLength = RuntimeBlockLength;321	/// The index type for blocks.322	type BlockNumber = BlockNumber;323	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.324	type BlockWeights = RuntimeBlockWeights;325	/// The aggregated dispatch type that is available for extrinsics.326	type Call = Call;327	/// The weight of database operations that the runtime can invoke.328	type DbWeight = RocksDbWeight;329	/// The ubiquitous event type.330	type Event = Event;331	/// The type for hashing blocks and tries.332	type Hash = Hash;333	/// The hashing algorithm used.334	type Hashing = BlakeTwo256;335	/// The header type.336	type Header = generic::Header<BlockNumber, BlakeTwo256>;337	/// The index type for storing how many extrinsics an account has signed.338	type Index = Index;339	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.340	type Lookup = AccountIdLookup<AccountId, ()>;341	/// What to do if an account is fully reaped from the system.342	type OnKilledAccount = ();343	/// What to do if a new account is created.344	type OnNewAccount = ();345	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;346	/// The ubiquitous origin type.347	type Origin = Origin;348	/// This type is being generated by `construct_runtime!`.349	type PalletInfo = PalletInfo;350	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.351	type SS58Prefix = SS58Prefix;352	/// Weight information for the extrinsics of this pallet.353	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;354	/// Version of the runtime.355	type Version = Version;356	type MaxConsumers = ConstU32<16>;357}358359parameter_types! {360	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;361}362363impl pallet_timestamp::Config for Runtime {364	/// A timestamp: milliseconds since the unix epoch.365	type Moment = u64;366	type OnTimestampSet = ();367	type MinimumPeriod = MinimumPeriod;368	type WeightInfo = ();369}370371parameter_types! {372	// pub const ExistentialDeposit: u128 = 500;373	pub const ExistentialDeposit: u128 = 0;374	pub const MaxLocks: u32 = 50;375}376377impl pallet_balances::Config for Runtime {378	type MaxLocks = MaxLocks;379	type MaxReserves = ();380	type ReserveIdentifier = [u8; 8];381	/// The type for recording an account's balance.382	type Balance = Balance;383	/// The ubiquitous event type.384	type Event = Event;385	type DustRemoval = Treasury;386	type ExistentialDeposit = ExistentialDeposit;387	type AccountStore = System;388	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;389}390391pub const MICROUNIQUE: Balance = 1_000_000_000_000;392pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;393pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;394pub const UNIQUE: Balance = 100 * CENTIUNIQUE;395396pub const fn deposit(items: u32, bytes: u32) -> Balance {397	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE398}399400/*401parameter_types! {402	pub TombstoneDeposit: Balance = deposit(403		1,404		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,405	);406	pub DepositPerContract: Balance = TombstoneDeposit::get();407	pub const DepositPerStorageByte: Balance = deposit(0, 1);408	pub const DepositPerStorageItem: Balance = deposit(1, 0);409	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);410	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;411	pub const SignedClaimHandicap: u32 = 2;412	pub const MaxDepth: u32 = 32;413	pub const MaxValueSize: u32 = 16 * 1024;414	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb415	// The lazy deletion runs inside on_initialize.416	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *417		RuntimeBlockWeights::get().max_block;418	// The weight needed for decoding the queue should be less or equal than a fifth419	// of the overall weight dedicated to the lazy deletion.420	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (421			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -422			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)423		)) / 5) as u32;424	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();425}426427impl pallet_contracts::Config for Runtime {428	type Time = Timestamp;429	type Randomness = RandomnessCollectiveFlip;430	type Currency = Balances;431	type Event = Event;432	type RentPayment = ();433	type SignedClaimHandicap = SignedClaimHandicap;434	type TombstoneDeposit = TombstoneDeposit;435	type DepositPerContract = DepositPerContract;436	type DepositPerStorageByte = DepositPerStorageByte;437	type DepositPerStorageItem = DepositPerStorageItem;438	type RentFraction = RentFraction;439	type SurchargeReward = SurchargeReward;440	type WeightPrice = pallet_transaction_payment::Pallet<Self>;441	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;442	type ChainExtension = NFTExtension;443	type DeletionQueueDepth = DeletionQueueDepth;444	type DeletionWeightLimit = DeletionWeightLimit;445	type Schedule = Schedule;446	type CallStack = [pallet_contracts::Frame<Self>; 31];447}448*/449450parameter_types! {451	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer452	/// This value increases the priority of `Operational` transactions by adding453	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.454	pub const OperationalFeeMultiplier: u8 = 5;455}456457/// Linear implementor of `WeightToFeePolynomial`458pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);459460impl<T> WeightToFeePolynomial for LinearFee<T>461where462	T: BaseArithmetic + From<u32> + Copy + Unsigned,463{464	type Balance = T;465466	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {467		smallvec!(WeightToFeeCoefficient {468			// Targeting 0.1 Unique per NFT transfer469			coeff_integer: 142_688_000u32.into(),470			coeff_frac: Perbill::zero(),471			negative: false,472			degree: 1,473		})474	}475}476477impl pallet_transaction_payment::Config for Runtime {478	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;479	type TransactionByteFee = TransactionByteFee;480	type OperationalFeeMultiplier = OperationalFeeMultiplier;481	type WeightToFee = LinearFee<Balance>;482	type FeeMultiplierUpdate = ();483}484485parameter_types! {486	pub const ProposalBond: Permill = Permill::from_percent(5);487	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;488	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;489	pub const SpendPeriod: BlockNumber = 5 * MINUTES;490	pub const Burn: Permill = Permill::from_percent(0);491	pub const TipCountdown: BlockNumber = 1 * DAYS;492	pub const TipFindersFee: Percent = Percent::from_percent(20);493	pub const TipReportDepositBase: Balance = 1 * UNIQUE;494	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;495	pub const BountyDepositBase: Balance = 1 * UNIQUE;496	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;497	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");498	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;499	pub const MaximumReasonLength: u32 = 16384;500	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);501	pub const BountyValueMinimum: Balance = 5 * UNIQUE;502	pub const MaxApprovals: u32 = 100;503}504505impl pallet_treasury::Config for Runtime {506	type PalletId = TreasuryModuleId;507	type Currency = Balances;508	type ApproveOrigin = EnsureRoot<AccountId>;509	type RejectOrigin = EnsureRoot<AccountId>;510	type Event = Event;511	type OnSlash = ();512	type ProposalBond = ProposalBond;513	type ProposalBondMinimum = ProposalBondMinimum;514	type ProposalBondMaximum = ProposalBondMaximum;515	type SpendPeriod = SpendPeriod;516	type Burn = Burn;517	type BurnDestination = ();518	type SpendFunds = ();519	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;520	type MaxApprovals = MaxApprovals;521}522523impl pallet_sudo::Config for Runtime {524	type Event = Event;525	type Call = Call;526}527528pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);529530impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider531	for RelayChainBlockNumberProvider<T>532{533	type BlockNumber = BlockNumber;534535	fn current_block_number() -> Self::BlockNumber {536		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()537			.map(|d| d.relay_parent_number)538			.unwrap_or_default()539	}540}541542parameter_types! {543	pub const MinVestedTransfer: Balance = 10 * UNIQUE;544	pub const MaxVestingSchedules: u32 = 28;545}546547impl orml_vesting::Config for Runtime {548	type Event = Event;549	type Currency = pallet_balances::Pallet<Runtime>;550	type MinVestedTransfer = MinVestedTransfer;551	type VestedTransferOrigin = EnsureSigned<AccountId>;552	type WeightInfo = ();553	type MaxVestingSchedules = MaxVestingSchedules;554	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;555}556557parameter_types! {558	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;559	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;560}561562impl cumulus_pallet_parachain_system::Config for Runtime {563	type Event = Event;564	type SelfParaId = parachain_info::Pallet<Self>;565	type OnSystemEvent = ();566	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<567	// 	MaxDownwardMessageWeight,568	// 	XcmExecutor<XcmConfig>,569	// 	Call,570	// >;571	type OutboundXcmpMessageSource = XcmpQueue;572	type DmpMessageHandler = DmpQueue;573	type ReservedDmpWeight = ReservedDmpWeight;574	type ReservedXcmpWeight = ReservedXcmpWeight;575	type XcmpMessageHandler = XcmpQueue;576}577578impl parachain_info::Config for Runtime {}579580impl cumulus_pallet_aura_ext::Config for Runtime {}581582parameter_types! {583	pub const RelayLocation: MultiLocation = MultiLocation::parent();584	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;585	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();586	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();587}588589/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used590/// when determining ownership of accounts for asset transacting and when attempting to use XCM591/// `Transact` in order to determine the dispatch Origin.592pub type LocationToAccountId = (593	// The parent (Relay-chain) origin converts to the default `AccountId`.594	ParentIsPreset<AccountId>,595	// Sibling parachain origins convert to AccountId via the `ParaId::into`.596	SiblingParachainConvertsVia<Sibling, AccountId>,597	// Straight up local `AccountId32` origins just alias directly to `AccountId`.598	AccountId32Aliases<RelayNetwork, AccountId>,599);600601pub struct OnlySelfCurrency;602impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {603	fn matches_fungible(a: &MultiAsset) -> Option<B> {604		match (&a.id, &a.fun) {605			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),606			_ => None,607		}608	}609}610611/// Means for transacting assets on this chain.612pub type LocalAssetTransactor = CurrencyAdapter<613	// Use this currency:614	Balances,615	// Use this currency when it is a fungible asset matching the given location or name:616	OnlySelfCurrency,617	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:618	LocationToAccountId,619	// Our chain's account ID type (we can't get away without mentioning it explicitly):620	AccountId,621	// We don't track any teleports.622	(),623>;624625/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,626/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can627/// biases the kind of local `Origin` it will become.628pub type XcmOriginToTransactDispatchOrigin = (629	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location630	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for631	// foreign chains who want to have a local sovereign account on this chain which they control.632	SovereignSignedViaLocation<LocationToAccountId, Origin>,633	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when634	// recognised.635	RelayChainAsNative<RelayOrigin, Origin>,636	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when637	// recognised.638	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,639	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a640	// transaction from the Root origin.641	ParentAsSuperuser<Origin>,642	// Native signed account converter; this just converts an `AccountId32` origin into a normal643	// `Origin::Signed` origin of the same 32-byte value.644	SignedAccountId32AsNative<RelayNetwork, Origin>,645	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.646	XcmPassthrough<Origin>,647);648649parameter_types! {650	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.651	pub UnitWeightCost: Weight = 1_000_000;652	// 1200 UNIQUEs buy 1 second of weight.653	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);654	pub const MaxInstructions: u32 = 100;655	pub const MaxAuthorities: u32 = 100_000;656}657658match_type! {659	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {660		MultiLocation { parents: 1, interior: Here } |661		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }662	};663}664665pub type Barrier = (666	TakeWeightCredit,667	AllowTopLevelPaidExecutionFrom<Everything>,668	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,669	// ^^^ Parent & its unit plurality gets free execution670);671672pub struct UsingOnlySelfCurrencyComponents<673	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,674	AssetId: Get<MultiLocation>,675	AccountId,676	Currency: CurrencyT<AccountId>,677	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,678>(679	Weight,680	Currency::Balance,681	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,682);683impl<684		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,685		AssetId: Get<MultiLocation>,686		AccountId,687		Currency: CurrencyT<AccountId>,688		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,689	> WeightTrader690	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>691{692	fn new() -> Self {693		Self(0, Zero::zero(), PhantomData)694	}695696	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {697		let amount = WeightToFee::calc(&weight);698		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;699700		// location to this parachain through relay chain701		let option1: xcm::v1::AssetId = Concrete(MultiLocation {702			parents: 1,703			interior: X1(Parachain(ParachainInfo::parachain_id().into())),704		});705		// direct location706		let option2: xcm::v1::AssetId = Concrete(MultiLocation {707			parents: 0,708			interior: Here,709		});710711		let required = if payment.fungible.contains_key(&option1) {712			(option1, u128_amount).into()713		} else if payment.fungible.contains_key(&option2) {714			(option2, u128_amount).into()715		} else {716			(Concrete(MultiLocation::default()), u128_amount).into()717		};718719		let unused = payment720			.checked_sub(required)721			.map_err(|_| XcmError::TooExpensive)?;722		self.0 = self.0.saturating_add(weight);723		self.1 = self.1.saturating_add(amount);724		Ok(unused)725	}726727	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {728		let weight = weight.min(self.0);729		let amount = WeightToFee::calc(&weight);730		self.0 -= weight;731		self.1 = self.1.saturating_sub(amount);732		let amount: u128 = amount.saturated_into();733		if amount > 0 {734			Some((AssetId::get(), amount).into())735		} else {736			None737		}738	}739}740impl<741		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,742		AssetId: Get<MultiLocation>,743		AccountId,744		Currency: CurrencyT<AccountId>,745		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,746	> Drop747	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>748{749	fn drop(&mut self) {750		OnUnbalanced::on_unbalanced(Currency::issue(self.1));751	}752}753754pub struct XcmConfig;755impl Config for XcmConfig {756	type Call = Call;757	type XcmSender = XcmRouter;758	// How to withdraw and deposit an asset.759	type AssetTransactor = LocalAssetTransactor;760	type OriginConverter = XcmOriginToTransactDispatchOrigin;761	type IsReserve = NativeAsset;762	type IsTeleporter = (); // Teleportation is disabled763	type LocationInverter = LocationInverter<Ancestry>;764	type Barrier = Barrier;765	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;766	type Trader = UsingOnlySelfCurrencyComponents<767		IdentityFee<Balance>,768		RelayLocation,769		AccountId,770		Balances,771		(),772	>;773	type ResponseHandler = (); // Don't handle responses for now.774	type SubscriptionService = PolkadotXcm;775776	type AssetTrap = PolkadotXcm;777	type AssetClaims = PolkadotXcm;778}779780// parameter_types! {781// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;782// }783784/// No local origins on this chain are allowed to dispatch XCM sends/executions.785pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);786787/// The means for routing XCM messages which are not for local execution into the right message788/// queues.789pub type XcmRouter = (790	// Two routers - use UMP to communicate with the relay chain:791	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,792	// ..and XCMP to communicate with the sibling chains.793	XcmpQueue,794);795796impl pallet_evm_coder_substrate::Config for Runtime {797	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;798	type GasWeightMapping = FixedGasWeightMapping;799}800801impl pallet_xcm::Config for Runtime {802	type Event = Event;803	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;804	type XcmRouter = XcmRouter;805	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;806	type XcmExecuteFilter = Everything;807	type XcmExecutor = XcmExecutor<XcmConfig>;808	type XcmTeleportFilter = Everything;809	type XcmReserveTransferFilter = Everything;810	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;811	type LocationInverter = LocationInverter<Ancestry>;812	type Origin = Origin;813	type Call = Call;814	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;815	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;816}817818impl cumulus_pallet_xcm::Config for Runtime {819	type Event = Event;820	type XcmExecutor = XcmExecutor<XcmConfig>;821}822823impl cumulus_pallet_xcmp_queue::Config for Runtime {824	type Event = Event;825	type XcmExecutor = XcmExecutor<XcmConfig>;826	type ChannelInfo = ParachainSystem;827	type VersionWrapper = ();828	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;829	type ControllerOrigin = EnsureRoot<AccountId>;830	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;831}832833impl cumulus_pallet_dmp_queue::Config for Runtime {834	type Event = Event;835	type XcmExecutor = XcmExecutor<XcmConfig>;836	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;837}838839impl pallet_aura::Config for Runtime {840	type AuthorityId = AuraId;841	type DisabledValidators = ();842	type MaxAuthorities = MaxAuthorities;843}844845parameter_types! {846	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();847	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;848}849850impl pallet_common::Config for Runtime {851	type Event = Event;852	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;853	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;854	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;855856	type Currency = Balances;857	type CollectionCreationPrice = CollectionCreationPrice;858	type TreasuryAccountId = TreasuryAccountId;859}860861impl pallet_fungible::Config for Runtime {862	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;863}864impl pallet_refungible::Config for Runtime {865	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;866}867impl pallet_nonfungible::Config for Runtime {868	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;869}870871impl pallet_unique::Config for Runtime {872	type Event = Event;873	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;874}875876parameter_types! {877	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied878}879880/// Used for the pallet inflation881impl pallet_inflation::Config for Runtime {882	type Currency = Balances;883	type TreasuryAccountId = TreasuryAccountId;884	type InflationBlockInterval = InflationBlockInterval;885	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;886}887888// parameter_types! {889// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *890// 		RuntimeBlockWeights::get().max_block;891// 	pub const MaxScheduledPerBlock: u32 = 50;892// }893894type EvmSponsorshipHandler = (895	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,896	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,897);898type SponsorshipHandler = (899	pallet_unique::UniqueSponsorshipHandler<Runtime>,900	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,901	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,902);903904// impl pallet_unq_scheduler::Config for Runtime {905// 	type Event = Event;906// 	type Origin = Origin;907// 	type PalletsOrigin = OriginCaller;908// 	type Call = Call;909// 	type MaximumWeight = MaximumSchedulerWeight;910// 	type ScheduleOrigin = EnsureSigned<AccountId>;911// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;912// 	type SponsorshipHandler = SponsorshipHandler;913// 	type WeightInfo = ();914// }915916impl pallet_evm_transaction_payment::Config for Runtime {917	type EvmSponsorshipHandler = EvmSponsorshipHandler;918	type Currency = Balances;919	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;920	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;921}922923impl pallet_charge_transaction::Config for Runtime {924	type SponsorshipHandler = SponsorshipHandler;925}926927// impl pallet_contract_helpers::Config for Runtime {928//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;929// }930931parameter_types! {932	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049933	pub const HelpersContractAddress: H160 = H160([934		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,935	]);936}937938impl pallet_evm_contract_helpers::Config for Runtime {939	type ContractAddress = HelpersContractAddress;940	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;941}942943construct_runtime!(944	pub enum Runtime where945		Block = Block,946		NodeBlock = opaque::Block,947		UncheckedExtrinsic = UncheckedExtrinsic948	{949		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,950		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,951952		Aura: pallet_aura::{Pallet, Config<T>} = 22,953		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,954955		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,956		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,957		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,958		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,959		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,960		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,961		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,962		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,963		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,964		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,965966		// XCM helpers.967		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,968		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,969		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,970		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,971972		// Unique Pallets973		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,974		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,975		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,976		// free = 63977		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,978		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,979		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,980		Fungible: pallet_fungible::{Pallet, Storage} = 67,981		Refungible: pallet_refungible::{Pallet, Storage} = 68,982		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,983984		// Frontier985		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,986		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,987988		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,989		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,990		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,991		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,992	}993);994995pub struct TransactionConverter;996997impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {998	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {999		UncheckedExtrinsic::new_unsigned(1000			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1001		)1002	}1003}10041005impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1006	fn convert_transaction(1007		&self,1008		transaction: pallet_ethereum::Transaction,1009	) -> opaque::UncheckedExtrinsic {1010		let extrinsic = UncheckedExtrinsic::new_unsigned(1011			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1012		);1013		let encoded = extrinsic.encode();1014		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1015			.expect("Encoded extrinsic is always valid")1016	}1017}10181019/// The address format for describing accounts.1020pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1021/// Block header type as expected by this runtime.1022pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1023/// Block type as expected by this runtime.1024pub type Block = generic::Block<Header, UncheckedExtrinsic>;1025/// A Block signed with a Justification1026pub type SignedBlock = generic::SignedBlock<Block>;1027/// BlockId type as expected by this runtime.1028pub type BlockId = generic::BlockId<Block>;1029/// The SignedExtension to the basic transaction logic.1030pub type SignedExtra = (1031	frame_system::CheckSpecVersion<Runtime>,1032	// system::CheckTxVersion<Runtime>,1033	frame_system::CheckGenesis<Runtime>,1034	frame_system::CheckEra<Runtime>,1035	frame_system::CheckNonce<Runtime>,1036	frame_system::CheckWeight<Runtime>,1037	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1038	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,1039);1040/// Unchecked extrinsic type as expected by this runtime.1041pub type UncheckedExtrinsic =1042	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1043/// Extrinsic type that has already been checked.1044pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1045/// Executive: handles dispatch to the various modules.1046pub type Executive = frame_executive::Executive<1047	Runtime,1048	Block,1049	frame_system::ChainContext<Runtime>,1050	Runtime,1051	AllPalletsReversedWithSystemFirst,1052>;10531054impl_opaque_keys! {1055	pub struct SessionKeys {1056		pub aura: Aura,1057	}1058}10591060impl fp_self_contained::SelfContainedCall for Call {1061	type SignedInfo = H160;10621063	fn is_self_contained(&self) -> bool {1064		match self {1065			Call::Ethereum(call) => call.is_self_contained(),1066			_ => false,1067		}1068	}10691070	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1071		match self {1072			Call::Ethereum(call) => call.check_self_contained(),1073			_ => None,1074		}1075	}10761077	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1078		match self {1079			Call::Ethereum(call) => call.validate_self_contained(info),1080			_ => None,1081		}1082	}10831084	fn pre_dispatch_self_contained(1085		&self,1086		info: &Self::SignedInfo,1087	) -> Option<Result<(), TransactionValidityError>> {1088		match self {1089			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1090			_ => None,1091		}1092	}10931094	fn apply_self_contained(1095		self,1096		info: Self::SignedInfo,1097	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1098		match self {1099			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1100				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1101			)),1102			_ => None,1103		}1104	}1105}11061107macro_rules! dispatch_unique_runtime {1108	($collection:ident.$method:ident($($name:ident),*)) => {{1109		use pallet_unique::dispatch::Dispatched;11101111		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1112		let dispatch = collection.as_dyn();11131114		Ok(dispatch.$method($($name),*))1115	}};1116}1117impl_runtime_apis! {1118	impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1119		for Runtime1120	{1121		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1122			dispatch_unique_runtime!(collection.account_tokens(account))1123		}1124		fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1125			dispatch_unique_runtime!(collection.token_exists(token))1126		}11271128		fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1129			dispatch_unique_runtime!(collection.token_owner(token))1130		}1131		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1132			dispatch_unique_runtime!(collection.const_metadata(token))1133		}1134		fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1135			dispatch_unique_runtime!(collection.variable_metadata(token))1136		}11371138		fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1139			dispatch_unique_runtime!(collection.collection_tokens())1140		}1141		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1142			dispatch_unique_runtime!(collection.account_balance(account))1143		}1144		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1145			dispatch_unique_runtime!(collection.balance(account, token))1146		}1147		fn allowance(1148			collection: CollectionId,1149			sender: CrossAccountId,1150			spender: CrossAccountId,1151			token: TokenId,1152		) -> Result<u128, DispatchError> {1153			dispatch_unique_runtime!(collection.allowance(sender, spender, token))1154		}11551156		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1157			<pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1158				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1159				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1160		}1161		fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1162			Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1163		}1164		fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1165			Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1166		}1167		fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1168			Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1169		}1170		fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1171			dispatch_unique_runtime!(collection.last_token_id())1172		}1173		fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1174			Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1175		}1176		fn collection_stats() -> Result<CollectionStats, DispatchError> {1177			Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1178		}1179	}11801181	impl sp_api::Core<Block> for Runtime {1182		fn version() -> RuntimeVersion {1183			VERSION1184		}11851186		fn execute_block(block: Block) {1187			Executive::execute_block(block)1188		}11891190		fn initialize_block(header: &<Block as BlockT>::Header) {1191			Executive::initialize_block(header)1192		}1193	}11941195	impl sp_api::Metadata<Block> for Runtime {1196		fn metadata() -> OpaqueMetadata {1197			OpaqueMetadata::new(Runtime::metadata().into())1198		}1199	}12001201	impl sp_block_builder::BlockBuilder<Block> for Runtime {1202		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1203			Executive::apply_extrinsic(extrinsic)1204		}12051206		fn finalize_block() -> <Block as BlockT>::Header {1207			Executive::finalize_block()1208		}12091210		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1211			data.create_extrinsics()1212		}12131214		fn check_inherents(1215			block: Block,1216			data: sp_inherents::InherentData,1217		) -> sp_inherents::CheckInherentsResult {1218			data.check_extrinsics(&block)1219		}12201221		// fn random_seed() -> <Block as BlockT>::Hash {1222		//     RandomnessCollectiveFlip::random_seed().01223		// }1224	}12251226	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1227		fn validate_transaction(1228			source: TransactionSource,1229			tx: <Block as BlockT>::Extrinsic,1230			hash: <Block as BlockT>::Hash,1231		) -> TransactionValidity {1232			Executive::validate_transaction(source, tx, hash)1233		}1234	}12351236	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1237		fn offchain_worker(header: &<Block as BlockT>::Header) {1238			Executive::offchain_worker(header)1239		}1240	}12411242	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1243		fn chain_id() -> u64 {1244			<Runtime as pallet_evm::Config>::ChainId::get()1245		}12461247		fn account_basic(address: H160) -> EVMAccount {1248			EVM::account_basic(&address)1249		}12501251		fn gas_price() -> U256 {1252			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1253		}12541255		fn account_code_at(address: H160) -> Vec<u8> {1256			EVM::account_codes(address)1257		}12581259		fn author() -> H160 {1260			<pallet_evm::Pallet<Runtime>>::find_author()1261		}12621263		fn storage_at(address: H160, index: U256) -> H256 {1264			let mut tmp = [0u8; 32];1265			index.to_big_endian(&mut tmp);1266			EVM::account_storages(address, H256::from_slice(&tmp[..]))1267		}12681269		#[allow(clippy::redundant_closure)]1270		fn call(1271			from: H160,1272			to: H160,1273			data: Vec<u8>,1274			value: U256,1275			gas_limit: U256,1276			max_fee_per_gas: Option<U256>,1277			max_priority_fee_per_gas: Option<U256>,1278			nonce: Option<U256>,1279			estimate: bool,1280			access_list: Option<Vec<(H160, Vec<H256>)>>,1281		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1282			let config = if estimate {1283				let mut config = <Runtime as pallet_evm::Config>::config().clone();1284				config.estimate = true;1285				Some(config)1286			} else {1287				None1288			};12891290			<Runtime as pallet_evm::Config>::Runner::call(1291				from,1292				to,1293				data,1294				value,1295				gas_limit.low_u64(),1296				max_fee_per_gas,1297				max_priority_fee_per_gas,1298				nonce,1299				access_list.unwrap_or_default(),1300				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1301			).map_err(|err| err.into())1302		}13031304		#[allow(clippy::redundant_closure)]1305		fn create(1306			from: H160,1307			data: Vec<u8>,1308			value: U256,1309			gas_limit: U256,1310			max_fee_per_gas: Option<U256>,1311			max_priority_fee_per_gas: Option<U256>,1312			nonce: Option<U256>,1313			estimate: bool,1314			access_list: Option<Vec<(H160, Vec<H256>)>>,1315		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1316			let config = if estimate {1317				let mut config = <Runtime as pallet_evm::Config>::config().clone();1318				config.estimate = true;1319				Some(config)1320			} else {1321				None1322			};13231324			<Runtime as pallet_evm::Config>::Runner::create(1325				from,1326				data,1327				value,1328				gas_limit.low_u64(),1329				max_fee_per_gas,1330				max_priority_fee_per_gas,1331				nonce,1332				access_list.unwrap_or_default(),1333				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1334			).map_err(|err| err.into())1335		}13361337		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1338			Ethereum::current_transaction_statuses()1339		}13401341		fn current_block() -> Option<pallet_ethereum::Block> {1342			Ethereum::current_block()1343		}13441345		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1346			Ethereum::current_receipts()1347		}13481349		fn current_all() -> (1350			Option<pallet_ethereum::Block>,1351			Option<Vec<pallet_ethereum::Receipt>>,1352			Option<Vec<TransactionStatus>>1353		) {1354			(1355				Ethereum::current_block(),1356				Ethereum::current_receipts(),1357				Ethereum::current_transaction_statuses()1358			)1359		}13601361		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1362			xts.into_iter().filter_map(|xt| match xt.0.function {1363				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1364				_ => None1365			}).collect()1366		}13671368		fn elasticity() -> Option<Permill> {1369			None1370		}1371	}13721373	impl sp_session::SessionKeys<Block> for Runtime {1374		fn decode_session_keys(1375			encoded: Vec<u8>,1376		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1377			SessionKeys::decode_into_raw_public_keys(&encoded)1378		}13791380		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1381			SessionKeys::generate(seed)1382		}1383	}13841385	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1386		fn slot_duration() -> sp_consensus_aura::SlotDuration {1387			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1388		}13891390		fn authorities() -> Vec<AuraId> {1391			Aura::authorities().to_vec()1392		}1393	}13941395	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1396		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1397			ParachainSystem::collect_collation_info(header)1398		}1399	}14001401	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1402		fn account_nonce(account: AccountId) -> Index {1403			System::account_nonce(account)1404		}1405	}14061407	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1408		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1409			TransactionPayment::query_info(uxt, len)1410		}1411		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1412			TransactionPayment::query_fee_details(uxt, len)1413		}1414	}14151416	/*1417	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1418		for Runtime1419	{1420		fn call(1421			origin: AccountId,1422			dest: AccountId,1423			value: Balance,1424			gas_limit: u64,1425			input_data: Vec<u8>,1426		) -> pallet_contracts_primitives::ContractExecResult {1427			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1428		}14291430		fn instantiate(1431			origin: AccountId,1432			endowment: Balance,1433			gas_limit: u64,1434			code: pallet_contracts_primitives::Code<Hash>,1435			data: Vec<u8>,1436			salt: Vec<u8>,1437		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1438		{1439			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1440		}14411442		fn get_storage(1443			address: AccountId,1444			key: [u8; 32],1445		) -> pallet_contracts_primitives::GetStorageResult {1446			Contracts::get_storage(address, key)1447		}14481449		fn rent_projection(1450			address: AccountId,1451		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1452			Contracts::rent_projection(address)1453		}1454	}1455	*/14561457	#[cfg(feature = "runtime-benchmarks")]1458	impl frame_benchmarking::Benchmark<Block> for Runtime {1459		fn benchmark_metadata(extra: bool) -> (1460			Vec<frame_benchmarking::BenchmarkList>,1461			Vec<frame_support::traits::StorageInfo>,1462		) {1463			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1464			use frame_support::traits::StorageInfoTrait;14651466			let mut list = Vec::<BenchmarkList>::new();14671468			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1469			list_benchmark!(list, extra, pallet_unique, Unique);1470			list_benchmark!(list, extra, pallet_inflation, Inflation);1471			list_benchmark!(list, extra, pallet_fungible, Fungible);1472			list_benchmark!(list, extra, pallet_refungible, Refungible);1473			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1474			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);14751476			let storage_info = AllPalletsReversedWithSystemFirst::storage_info();14771478			return (list, storage_info)1479		}14801481		fn dispatch_benchmark(1482			config: frame_benchmarking::BenchmarkConfig1483		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1484			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};14851486			let allowlist: Vec<TrackedStorageKey> = vec![1487				// Block Number1488				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1489				// Total Issuance1490				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1491				// Execution Phase1492				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1493				// Event Count1494				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1495				// System Events1496				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1497			];14981499			let mut batches = Vec::<BenchmarkBatch>::new();1500			let params = (&config, &allowlist);15011502			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1503			add_benchmark!(params, batches, pallet_unique, Unique);1504			add_benchmark!(params, batches, pallet_inflation, Inflation);1505			add_benchmark!(params, batches, pallet_fungible, Fungible);1506			add_benchmark!(params, batches, pallet_refungible, Refungible);1507			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1508			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);15091510			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1511			Ok(batches)1512		}1513	}1514}15151516struct CheckInherents;15171518impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1519	fn check_inherents(1520		block: &Block,1521		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1522	) -> sp_inherents::CheckInherentsResult {1523		let relay_chain_slot = relay_state_proof1524			.read_slot()1525			.expect("Could not read the relay chain slot from the proof");15261527		let inherent_data =1528			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1529				relay_chain_slot,1530				sp_std::time::Duration::from_secs(6),1531			)1532			.create_inherent_data()1533			.expect("Could not create the timestamp inherent data");15341535		inherent_data.check_extrinsics(block)1536	}1537}15381539cumulus_pallet_parachain_system::register_validate_block!(1540	Runtime = Runtime,1541	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1542	CheckInherents = CheckInherents,1543);
after · runtime/opal/src/lib.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/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;31// #[cfg(any(feature = "std", test))]32// pub use sp_runtime::BuildStorage;3334use sp_runtime::{35	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,36	traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},37	transaction_validity::{TransactionSource, TransactionValidity},38	ApplyExtrinsicResult, RuntimeAppPublic,39};4041use sp_std::prelude::*;4243#[cfg(feature = "std")]44use sp_version::NativeVersion;45use sp_version::RuntimeVersion;46pub use pallet_transaction_payment::{47	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,48};49// A few exports that help ease life for downstream crates.50pub use pallet_balances::Call as BalancesCall;51pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};52pub use frame_support::{53	construct_runtime, match_type,54	dispatch::DispatchResult,55	PalletId, parameter_types, StorageValue, ConsensusEngineId,56	traits::{57		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,58		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,59		OnUnbalanced, Randomness, FindAuthor,60	},61	weights::{62		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},63		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,64		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,65	},66};67use up_data_structs::*;68// use pallet_contracts::weights::WeightInfo;69// #[cfg(any(feature = "std", test))]70use frame_system::{71	self as frame_system, EnsureRoot, EnsureSigned,72	limits::{BlockWeights, BlockLength},73};74use sp_arithmetic::{75	traits::{BaseArithmetic, Unsigned},76};77use smallvec::smallvec;78use codec::{Encode, Decode};79use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};80use fp_rpc::TransactionStatus;81use sp_runtime::{82	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},83	transaction_validity::TransactionValidityError,84	SaturatedConversion,85};8687// pub use pallet_timestamp::Call as TimestampCall;88pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;8990// Polkadot imports91use pallet_xcm::XcmPassthrough;92use polkadot_parachain::primitives::Sibling;93use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};94use xcm_builder::{95	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,96	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,97	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,98	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,99	ParentIsPreset,100};101use xcm_executor::{Config, XcmExecutor, Assets};102use sp_std::{marker::PhantomData};103104use xcm::latest::{105	//	Xcm,106	AssetId::{Concrete},107	Fungibility::Fungible as XcmFungible,108	MultiAsset,109	Error as XcmError,110};111use xcm_executor::traits::{MatchesFungible, WeightTrader};112//use xcm_executor::traits::MatchesFungible;113use sp_runtime::traits::CheckedConversion;114115use unique_runtime_common::{types::*, constants::*};116117pub const RUNTIME_NAME: &str = "Opal";118119pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;120121/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know122/// the specifics of the runtime. They can then be made to be agnostic over specific formats123/// of data like extrinsics, allowing for them to continue syncing the network through upgrades124/// to even the core data structures.125pub mod opaque {126	use sp_std::prelude::*;127	use sp_runtime::impl_opaque_keys;128	use super::Aura;129130	pub use unique_runtime_common::types::*;131	pub use super::CrossAccountId;132133	impl_opaque_keys! {134		pub struct SessionKeys {135			pub aura: Aura,136		}137	}138}139140/// This runtime version.141pub const VERSION: RuntimeVersion = RuntimeVersion {142	spec_name: create_runtime_str!(RUNTIME_NAME),143	impl_name: create_runtime_str!(RUNTIME_NAME),144	authoring_version: 1,145	spec_version: 917004,146	impl_version: 0,147	apis: RUNTIME_API_VERSIONS,148	transaction_version: 1,149	state_version: 0,150};151152#[derive(codec::Encode, codec::Decode)]153pub enum XCMPMessage<XAccountId, XBalance> {154	/// Transfer tokens to the given account from the Parachain account.155	TransferToken(XAccountId, XBalance),156}157158/// The version information used to identify this runtime when compiled natively.159#[cfg(feature = "std")]160pub fn native_version() -> NativeVersion {161	NativeVersion {162		runtime_version: VERSION,163		can_author_with: Default::default(),164	}165}166167type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;168169pub struct DealWithFees;170impl OnUnbalanced<NegativeImbalance> for DealWithFees {171	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {172		if let Some(fees) = fees_then_tips.next() {173			// for fees, 100% to treasury174			let mut split = fees.ration(100, 0);175			if let Some(tips) = fees_then_tips.next() {176				// for tips, if any, 100% to treasury177				tips.ration_merge_into(100, 0, &mut split);178			}179			Treasury::on_unbalanced(split.0);180			// Author::on_unbalanced(split.1);181		}182	}183}184185parameter_types! {186	pub const BlockHashCount: BlockNumber = 2400;187	pub RuntimeBlockLength: BlockLength =188		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);189	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);190	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;191	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()192		.base_block(BlockExecutionWeight::get())193		.for_class(DispatchClass::all(), |weights| {194			weights.base_extrinsic = ExtrinsicBaseWeight::get();195		})196		.for_class(DispatchClass::Normal, |weights| {197			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);198		})199		.for_class(DispatchClass::Operational, |weights| {200			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);201			// Operational transactions have some extra reserved space, so that they202			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.203			weights.reserved = Some(204				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT205			);206		})207		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)208		.build_or_panic();209	pub const Version: RuntimeVersion = VERSION;210	pub const SS58Prefix: u8 = 42;211}212213/*2148880 - Unique2158881 - Quartz2168882 - Opal217*/218parameter_types! {219	pub const ChainId: u64 = 8882;220}221222pub struct FixedFee;223impl FeeCalculator for FixedFee {224	fn min_gas_price() -> U256 {225		// Targeting 0.15 UNQ per transfer226		1_018_751_825_264u64.into()227	}228}229230// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case231// (contract, which only writes a lot of data),232// approximating on top of our real store write weight233parameter_types! {234	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;235	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;236	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();237}238239/// Limiting EVM execution to 50% of block for substrate users and management tasks240/// EVM transaction consumes more weight than substrate's, so we can't rely on them being241/// scheduled fairly242const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);243parameter_types! {244	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());245}246247pub enum FixedGasWeightMapping {}248impl GasWeightMapping for FixedGasWeightMapping {249	fn gas_to_weight(gas: u64) -> Weight {250		gas.saturating_mul(WeightPerGas::get())251	}252	fn weight_to_gas(weight: Weight) -> u64 {253		weight / WeightPerGas::get()254	}255}256257impl pallet_evm::Config for Runtime {258	type BlockGasLimit = BlockGasLimit;259	type FeeCalculator = FixedFee;260	type GasWeightMapping = FixedGasWeightMapping;261	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;262	type CallOrigin = EnsureAddressTruncated;263	type WithdrawOrigin = EnsureAddressTruncated;264	type AddressMapping = HashedAddressMapping<Self::Hashing>;265	type PrecompilesType = ();266	type PrecompilesValue = ();267	type Currency = Balances;268	type Event = Event;269	type OnMethodCall = (270		pallet_evm_migration::OnMethodCall<Self>,271		pallet_unique::UniqueErcSupport<Self>,272		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,273	);274	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;275	type ChainId = ChainId;276	type Runner = pallet_evm::runner::stack::Runner<Self>;277	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;278	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;279	type FindAuthor = EthereumFindAuthor<Aura>;280}281282impl pallet_evm_migration::Config for Runtime {283	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;284}285286pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);287impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {288	fn find_author<'a, I>(digests: I) -> Option<H160>289	where290		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,291	{292		if let Some(author_index) = F::find_author(digests) {293			let authority_id = Aura::authorities()[author_index as usize].clone();294			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));295		}296		None297	}298}299300impl pallet_ethereum::Config for Runtime {301	type Event = Event;302	type StateRoot = pallet_ethereum::IntermediateStateRoot;303}304305impl pallet_randomness_collective_flip::Config for Runtime {}306307impl frame_system::Config for Runtime {308	/// The data to be stored in an account.309	type AccountData = pallet_balances::AccountData<Balance>;310	/// The identifier used to distinguish between accounts.311	type AccountId = AccountId;312	/// The basic call filter to use in dispatchable.313	type BaseCallFilter = Everything;314	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).315	type BlockHashCount = BlockHashCount;316	/// The maximum length of a block (in bytes).317	type BlockLength = RuntimeBlockLength;318	/// The index type for blocks.319	type BlockNumber = BlockNumber;320	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.321	type BlockWeights = RuntimeBlockWeights;322	/// The aggregated dispatch type that is available for extrinsics.323	type Call = Call;324	/// The weight of database operations that the runtime can invoke.325	type DbWeight = RocksDbWeight;326	/// The ubiquitous event type.327	type Event = Event;328	/// The type for hashing blocks and tries.329	type Hash = Hash;330	/// The hashing algorithm used.331	type Hashing = BlakeTwo256;332	/// The header type.333	type Header = generic::Header<BlockNumber, BlakeTwo256>;334	/// The index type for storing how many extrinsics an account has signed.335	type Index = Index;336	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.337	type Lookup = AccountIdLookup<AccountId, ()>;338	/// What to do if an account is fully reaped from the system.339	type OnKilledAccount = ();340	/// What to do if a new account is created.341	type OnNewAccount = ();342	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;343	/// The ubiquitous origin type.344	type Origin = Origin;345	/// This type is being generated by `construct_runtime!`.346	type PalletInfo = PalletInfo;347	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.348	type SS58Prefix = SS58Prefix;349	/// Weight information for the extrinsics of this pallet.350	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;351	/// Version of the runtime.352	type Version = Version;353	type MaxConsumers = ConstU32<16>;354}355356parameter_types! {357	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;358}359360impl pallet_timestamp::Config for Runtime {361	/// A timestamp: milliseconds since the unix epoch.362	type Moment = u64;363	type OnTimestampSet = ();364	type MinimumPeriod = MinimumPeriod;365	type WeightInfo = ();366}367368parameter_types! {369	// pub const ExistentialDeposit: u128 = 500;370	pub const ExistentialDeposit: u128 = 0;371	pub const MaxLocks: u32 = 50;372}373374impl pallet_balances::Config for Runtime {375	type MaxLocks = MaxLocks;376	type MaxReserves = ();377	type ReserveIdentifier = [u8; 8];378	/// The type for recording an account's balance.379	type Balance = Balance;380	/// The ubiquitous event type.381	type Event = Event;382	type DustRemoval = Treasury;383	type ExistentialDeposit = ExistentialDeposit;384	type AccountStore = System;385	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;386}387388pub const MICROUNIQUE: Balance = 1_000_000_000_000;389pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;390pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;391pub const UNIQUE: Balance = 100 * CENTIUNIQUE;392393pub const fn deposit(items: u32, bytes: u32) -> Balance {394	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE395}396397/*398parameter_types! {399	pub TombstoneDeposit: Balance = deposit(400		1,401		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,402	);403	pub DepositPerContract: Balance = TombstoneDeposit::get();404	pub const DepositPerStorageByte: Balance = deposit(0, 1);405	pub const DepositPerStorageItem: Balance = deposit(1, 0);406	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);407	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;408	pub const SignedClaimHandicap: u32 = 2;409	pub const MaxDepth: u32 = 32;410	pub const MaxValueSize: u32 = 16 * 1024;411	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb412	// The lazy deletion runs inside on_initialize.413	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *414		RuntimeBlockWeights::get().max_block;415	// The weight needed for decoding the queue should be less or equal than a fifth416	// of the overall weight dedicated to the lazy deletion.417	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (418			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -419			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)420		)) / 5) as u32;421	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();422}423424impl pallet_contracts::Config for Runtime {425	type Time = Timestamp;426	type Randomness = RandomnessCollectiveFlip;427	type Currency = Balances;428	type Event = Event;429	type RentPayment = ();430	type SignedClaimHandicap = SignedClaimHandicap;431	type TombstoneDeposit = TombstoneDeposit;432	type DepositPerContract = DepositPerContract;433	type DepositPerStorageByte = DepositPerStorageByte;434	type DepositPerStorageItem = DepositPerStorageItem;435	type RentFraction = RentFraction;436	type SurchargeReward = SurchargeReward;437	type WeightPrice = pallet_transaction_payment::Pallet<Self>;438	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;439	type ChainExtension = NFTExtension;440	type DeletionQueueDepth = DeletionQueueDepth;441	type DeletionWeightLimit = DeletionWeightLimit;442	type Schedule = Schedule;443	type CallStack = [pallet_contracts::Frame<Self>; 31];444}445*/446447parameter_types! {448	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer449	/// This value increases the priority of `Operational` transactions by adding450	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.451	pub const OperationalFeeMultiplier: u8 = 5;452}453454/// Linear implementor of `WeightToFeePolynomial`455pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);456457impl<T> WeightToFeePolynomial for LinearFee<T>458where459	T: BaseArithmetic + From<u32> + Copy + Unsigned,460{461	type Balance = T;462463	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {464		smallvec!(WeightToFeeCoefficient {465			// Targeting 0.1 Unique per NFT transfer466			coeff_integer: 142_688_000u32.into(),467			coeff_frac: Perbill::zero(),468			negative: false,469			degree: 1,470		})471	}472}473474impl pallet_transaction_payment::Config for Runtime {475	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;476	type TransactionByteFee = TransactionByteFee;477	type OperationalFeeMultiplier = OperationalFeeMultiplier;478	type WeightToFee = LinearFee<Balance>;479	type FeeMultiplierUpdate = ();480}481482parameter_types! {483	pub const ProposalBond: Permill = Permill::from_percent(5);484	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;485	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;486	pub const SpendPeriod: BlockNumber = 5 * MINUTES;487	pub const Burn: Permill = Permill::from_percent(0);488	pub const TipCountdown: BlockNumber = 1 * DAYS;489	pub const TipFindersFee: Percent = Percent::from_percent(20);490	pub const TipReportDepositBase: Balance = 1 * UNIQUE;491	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;492	pub const BountyDepositBase: Balance = 1 * UNIQUE;493	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;494	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");495	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;496	pub const MaximumReasonLength: u32 = 16384;497	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);498	pub const BountyValueMinimum: Balance = 5 * UNIQUE;499	pub const MaxApprovals: u32 = 100;500}501502impl pallet_treasury::Config for Runtime {503	type PalletId = TreasuryModuleId;504	type Currency = Balances;505	type ApproveOrigin = EnsureRoot<AccountId>;506	type RejectOrigin = EnsureRoot<AccountId>;507	type Event = Event;508	type OnSlash = ();509	type ProposalBond = ProposalBond;510	type ProposalBondMinimum = ProposalBondMinimum;511	type ProposalBondMaximum = ProposalBondMaximum;512	type SpendPeriod = SpendPeriod;513	type Burn = Burn;514	type BurnDestination = ();515	type SpendFunds = ();516	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;517	type MaxApprovals = MaxApprovals;518}519520impl pallet_sudo::Config for Runtime {521	type Event = Event;522	type Call = Call;523}524525pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);526527impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider528	for RelayChainBlockNumberProvider<T>529{530	type BlockNumber = BlockNumber;531532	fn current_block_number() -> Self::BlockNumber {533		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()534			.map(|d| d.relay_parent_number)535			.unwrap_or_default()536	}537}538539parameter_types! {540	pub const MinVestedTransfer: Balance = 10 * UNIQUE;541	pub const MaxVestingSchedules: u32 = 28;542}543544impl orml_vesting::Config for Runtime {545	type Event = Event;546	type Currency = pallet_balances::Pallet<Runtime>;547	type MinVestedTransfer = MinVestedTransfer;548	type VestedTransferOrigin = EnsureSigned<AccountId>;549	type WeightInfo = ();550	type MaxVestingSchedules = MaxVestingSchedules;551	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;552}553554parameter_types! {555	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;556	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;557}558559impl cumulus_pallet_parachain_system::Config for Runtime {560	type Event = Event;561	type SelfParaId = parachain_info::Pallet<Self>;562	type OnSystemEvent = ();563	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<564	// 	MaxDownwardMessageWeight,565	// 	XcmExecutor<XcmConfig>,566	// 	Call,567	// >;568	type OutboundXcmpMessageSource = XcmpQueue;569	type DmpMessageHandler = DmpQueue;570	type ReservedDmpWeight = ReservedDmpWeight;571	type ReservedXcmpWeight = ReservedXcmpWeight;572	type XcmpMessageHandler = XcmpQueue;573}574575impl parachain_info::Config for Runtime {}576577impl cumulus_pallet_aura_ext::Config for Runtime {}578579parameter_types! {580	pub const RelayLocation: MultiLocation = MultiLocation::parent();581	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;582	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();583	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();584}585586/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used587/// when determining ownership of accounts for asset transacting and when attempting to use XCM588/// `Transact` in order to determine the dispatch Origin.589pub type LocationToAccountId = (590	// The parent (Relay-chain) origin converts to the default `AccountId`.591	ParentIsPreset<AccountId>,592	// Sibling parachain origins convert to AccountId via the `ParaId::into`.593	SiblingParachainConvertsVia<Sibling, AccountId>,594	// Straight up local `AccountId32` origins just alias directly to `AccountId`.595	AccountId32Aliases<RelayNetwork, AccountId>,596);597598pub struct OnlySelfCurrency;599impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {600	fn matches_fungible(a: &MultiAsset) -> Option<B> {601		match (&a.id, &a.fun) {602			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),603			_ => None,604		}605	}606}607608/// Means for transacting assets on this chain.609pub type LocalAssetTransactor = CurrencyAdapter<610	// Use this currency:611	Balances,612	// Use this currency when it is a fungible asset matching the given location or name:613	OnlySelfCurrency,614	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:615	LocationToAccountId,616	// Our chain's account ID type (we can't get away without mentioning it explicitly):617	AccountId,618	// We don't track any teleports.619	(),620>;621622/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,623/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can624/// biases the kind of local `Origin` it will become.625pub type XcmOriginToTransactDispatchOrigin = (626	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location627	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for628	// foreign chains who want to have a local sovereign account on this chain which they control.629	SovereignSignedViaLocation<LocationToAccountId, Origin>,630	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when631	// recognised.632	RelayChainAsNative<RelayOrigin, Origin>,633	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when634	// recognised.635	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,636	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a637	// transaction from the Root origin.638	ParentAsSuperuser<Origin>,639	// Native signed account converter; this just converts an `AccountId32` origin into a normal640	// `Origin::Signed` origin of the same 32-byte value.641	SignedAccountId32AsNative<RelayNetwork, Origin>,642	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.643	XcmPassthrough<Origin>,644);645646parameter_types! {647	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.648	pub UnitWeightCost: Weight = 1_000_000;649	// 1200 UNIQUEs buy 1 second of weight.650	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);651	pub const MaxInstructions: u32 = 100;652	pub const MaxAuthorities: u32 = 100_000;653}654655match_type! {656	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {657		MultiLocation { parents: 1, interior: Here } |658		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }659	};660}661662pub type Barrier = (663	TakeWeightCredit,664	AllowTopLevelPaidExecutionFrom<Everything>,665	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,666	// ^^^ Parent & its unit plurality gets free execution667);668669pub struct UsingOnlySelfCurrencyComponents<670	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,671	AssetId: Get<MultiLocation>,672	AccountId,673	Currency: CurrencyT<AccountId>,674	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,675>(676	Weight,677	Currency::Balance,678	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,679);680impl<681		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,682		AssetId: Get<MultiLocation>,683		AccountId,684		Currency: CurrencyT<AccountId>,685		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,686	> WeightTrader687	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>688{689	fn new() -> Self {690		Self(0, Zero::zero(), PhantomData)691	}692693	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {694		let amount = WeightToFee::calc(&weight);695		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;696697		// location to this parachain through relay chain698		let option1: xcm::v1::AssetId = Concrete(MultiLocation {699			parents: 1,700			interior: X1(Parachain(ParachainInfo::parachain_id().into())),701		});702		// direct location703		let option2: xcm::v1::AssetId = Concrete(MultiLocation {704			parents: 0,705			interior: Here,706		});707708		let required = if payment.fungible.contains_key(&option1) {709			(option1, u128_amount).into()710		} else if payment.fungible.contains_key(&option2) {711			(option2, u128_amount).into()712		} else {713			(Concrete(MultiLocation::default()), u128_amount).into()714		};715716		let unused = payment717			.checked_sub(required)718			.map_err(|_| XcmError::TooExpensive)?;719		self.0 = self.0.saturating_add(weight);720		self.1 = self.1.saturating_add(amount);721		Ok(unused)722	}723724	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {725		let weight = weight.min(self.0);726		let amount = WeightToFee::calc(&weight);727		self.0 -= weight;728		self.1 = self.1.saturating_sub(amount);729		let amount: u128 = amount.saturated_into();730		if amount > 0 {731			Some((AssetId::get(), amount).into())732		} else {733			None734		}735	}736}737impl<738		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,739		AssetId: Get<MultiLocation>,740		AccountId,741		Currency: CurrencyT<AccountId>,742		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,743	> Drop744	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>745{746	fn drop(&mut self) {747		OnUnbalanced::on_unbalanced(Currency::issue(self.1));748	}749}750751pub struct XcmConfig;752impl Config for XcmConfig {753	type Call = Call;754	type XcmSender = XcmRouter;755	// How to withdraw and deposit an asset.756	type AssetTransactor = LocalAssetTransactor;757	type OriginConverter = XcmOriginToTransactDispatchOrigin;758	type IsReserve = NativeAsset;759	type IsTeleporter = (); // Teleportation is disabled760	type LocationInverter = LocationInverter<Ancestry>;761	type Barrier = Barrier;762	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;763	type Trader = UsingOnlySelfCurrencyComponents<764		IdentityFee<Balance>,765		RelayLocation,766		AccountId,767		Balances,768		(),769	>;770	type ResponseHandler = (); // Don't handle responses for now.771	type SubscriptionService = PolkadotXcm;772773	type AssetTrap = PolkadotXcm;774	type AssetClaims = PolkadotXcm;775}776777// parameter_types! {778// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;779// }780781/// No local origins on this chain are allowed to dispatch XCM sends/executions.782pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);783784/// The means for routing XCM messages which are not for local execution into the right message785/// queues.786pub type XcmRouter = (787	// Two routers - use UMP to communicate with the relay chain:788	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,789	// ..and XCMP to communicate with the sibling chains.790	XcmpQueue,791);792793impl pallet_evm_coder_substrate::Config for Runtime {794	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;795	type GasWeightMapping = FixedGasWeightMapping;796}797798impl pallet_xcm::Config for Runtime {799	type Event = Event;800	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;801	type XcmRouter = XcmRouter;802	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;803	type XcmExecuteFilter = Everything;804	type XcmExecutor = XcmExecutor<XcmConfig>;805	type XcmTeleportFilter = Everything;806	type XcmReserveTransferFilter = Everything;807	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;808	type LocationInverter = LocationInverter<Ancestry>;809	type Origin = Origin;810	type Call = Call;811	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;812	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;813}814815impl cumulus_pallet_xcm::Config for Runtime {816	type Event = Event;817	type XcmExecutor = XcmExecutor<XcmConfig>;818}819820impl cumulus_pallet_xcmp_queue::Config for Runtime {821	type Event = Event;822	type XcmExecutor = XcmExecutor<XcmConfig>;823	type ChannelInfo = ParachainSystem;824	type VersionWrapper = ();825	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;826	type ControllerOrigin = EnsureRoot<AccountId>;827	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;828}829830impl cumulus_pallet_dmp_queue::Config for Runtime {831	type Event = Event;832	type XcmExecutor = XcmExecutor<XcmConfig>;833	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;834}835836impl pallet_aura::Config for Runtime {837	type AuthorityId = AuraId;838	type DisabledValidators = ();839	type MaxAuthorities = MaxAuthorities;840}841842parameter_types! {843	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();844	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;845}846847impl pallet_common::Config for Runtime {848	type Event = Event;849	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;850	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;851	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;852853	type Currency = Balances;854	type CollectionCreationPrice = CollectionCreationPrice;855	type TreasuryAccountId = TreasuryAccountId;856}857858impl pallet_fungible::Config for Runtime {859	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;860}861impl pallet_refungible::Config for Runtime {862	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;863}864impl pallet_nonfungible::Config for Runtime {865	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;866}867868impl pallet_unique::Config for Runtime {869	type Event = Event;870	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;871}872873parameter_types! {874	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied875}876877/// Used for the pallet inflation878impl pallet_inflation::Config for Runtime {879	type Currency = Balances;880	type TreasuryAccountId = TreasuryAccountId;881	type InflationBlockInterval = InflationBlockInterval;882	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;883}884885// parameter_types! {886// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *887// 		RuntimeBlockWeights::get().max_block;888// 	pub const MaxScheduledPerBlock: u32 = 50;889// }890891type EvmSponsorshipHandler = (892	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,893	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,894);895type SponsorshipHandler = (896	pallet_unique::UniqueSponsorshipHandler<Runtime>,897	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,898	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,899);900901// impl pallet_unq_scheduler::Config for Runtime {902// 	type Event = Event;903// 	type Origin = Origin;904// 	type PalletsOrigin = OriginCaller;905// 	type Call = Call;906// 	type MaximumWeight = MaximumSchedulerWeight;907// 	type ScheduleOrigin = EnsureSigned<AccountId>;908// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;909// 	type SponsorshipHandler = SponsorshipHandler;910// 	type WeightInfo = ();911// }912913impl pallet_evm_transaction_payment::Config for Runtime {914	type EvmSponsorshipHandler = EvmSponsorshipHandler;915	type Currency = Balances;916	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;917	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;918}919920impl pallet_charge_transaction::Config for Runtime {921	type SponsorshipHandler = SponsorshipHandler;922}923924// impl pallet_contract_helpers::Config for Runtime {925//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;926// }927928parameter_types! {929	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049930	pub const HelpersContractAddress: H160 = H160([931		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,932	]);933}934935impl pallet_evm_contract_helpers::Config for Runtime {936	type ContractAddress = HelpersContractAddress;937	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;938}939940construct_runtime!(941	pub enum Runtime where942		Block = Block,943		NodeBlock = opaque::Block,944		UncheckedExtrinsic = UncheckedExtrinsic945	{946		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,947		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,948949		Aura: pallet_aura::{Pallet, Config<T>} = 22,950		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,951952		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,953		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,954		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,955		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,956		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,957		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,958		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,959		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,960		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,961		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,962963		// XCM helpers.964		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,965		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,966		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,967		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,968969		// Unique Pallets970		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,971		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,972		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,973		// free = 63974		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,975		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,976		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,977		Fungible: pallet_fungible::{Pallet, Storage} = 67,978		Refungible: pallet_refungible::{Pallet, Storage} = 68,979		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,980981		// Frontier982		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,983		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,984985		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,986		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,987		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,988		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,989	}990);991992pub struct TransactionConverter;993994impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {995	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {996		UncheckedExtrinsic::new_unsigned(997			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),998		)999	}1000}10011002impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1003	fn convert_transaction(1004		&self,1005		transaction: pallet_ethereum::Transaction,1006	) -> opaque::UncheckedExtrinsic {1007		let extrinsic = UncheckedExtrinsic::new_unsigned(1008			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1009		);1010		let encoded = extrinsic.encode();1011		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1012			.expect("Encoded extrinsic is always valid")1013	}1014}10151016/// The address format for describing accounts.1017pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1018/// Block header type as expected by this runtime.1019pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1020/// Block type as expected by this runtime.1021pub type Block = generic::Block<Header, UncheckedExtrinsic>;1022/// A Block signed with a Justification1023pub type SignedBlock = generic::SignedBlock<Block>;1024/// BlockId type as expected by this runtime.1025pub type BlockId = generic::BlockId<Block>;1026/// The SignedExtension to the basic transaction logic.1027pub type SignedExtra = (1028	frame_system::CheckSpecVersion<Runtime>,1029	// system::CheckTxVersion<Runtime>,1030	frame_system::CheckGenesis<Runtime>,1031	frame_system::CheckEra<Runtime>,1032	frame_system::CheckNonce<Runtime>,1033	frame_system::CheckWeight<Runtime>,1034	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1035	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,1036);1037/// Unchecked extrinsic type as expected by this runtime.1038pub type UncheckedExtrinsic =1039	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1040/// Extrinsic type that has already been checked.1041pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1042/// Executive: handles dispatch to the various modules.1043pub type Executive = frame_executive::Executive<1044	Runtime,1045	Block,1046	frame_system::ChainContext<Runtime>,1047	Runtime,1048	AllPalletsReversedWithSystemFirst,1049>;10501051impl_opaque_keys! {1052	pub struct SessionKeys {1053		pub aura: Aura,1054	}1055}10561057impl fp_self_contained::SelfContainedCall for Call {1058	type SignedInfo = H160;10591060	fn is_self_contained(&self) -> bool {1061		match self {1062			Call::Ethereum(call) => call.is_self_contained(),1063			_ => false,1064		}1065	}10661067	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1068		match self {1069			Call::Ethereum(call) => call.check_self_contained(),1070			_ => None,1071		}1072	}10731074	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1075		match self {1076			Call::Ethereum(call) => call.validate_self_contained(info),1077			_ => None,1078		}1079	}10801081	fn pre_dispatch_self_contained(1082		&self,1083		info: &Self::SignedInfo,1084	) -> Option<Result<(), TransactionValidityError>> {1085		match self {1086			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1087			_ => None,1088		}1089	}10901091	fn apply_self_contained(1092		self,1093		info: Self::SignedInfo,1094	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1095		match self {1096			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1097				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1098			)),1099			_ => None,1100		}1101	}1102}11031104macro_rules! dispatch_unique_runtime {1105	($collection:ident.$method:ident($($name:ident),*)) => {{1106		use pallet_unique::dispatch::Dispatched;11071108		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1109		let dispatch = collection.as_dyn();11101111		Ok(dispatch.$method($($name),*))1112	}};1113}1114impl_runtime_apis! {1115	impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1116		for Runtime1117	{1118		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1119			dispatch_unique_runtime!(collection.account_tokens(account))1120		}1121		fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1122			dispatch_unique_runtime!(collection.token_exists(token))1123		}11241125		fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1126			dispatch_unique_runtime!(collection.token_owner(token))1127		}1128		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1129			dispatch_unique_runtime!(collection.const_metadata(token))1130		}1131		fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1132			dispatch_unique_runtime!(collection.variable_metadata(token))1133		}11341135		fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1136			dispatch_unique_runtime!(collection.collection_tokens())1137		}1138		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1139			dispatch_unique_runtime!(collection.account_balance(account))1140		}1141		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1142			dispatch_unique_runtime!(collection.balance(account, token))1143		}1144		fn allowance(1145			collection: CollectionId,1146			sender: CrossAccountId,1147			spender: CrossAccountId,1148			token: TokenId,1149		) -> Result<u128, DispatchError> {1150			dispatch_unique_runtime!(collection.allowance(sender, spender, token))1151		}11521153		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1154			<pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1155				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1156				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1157		}1158		fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1159			Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1160		}1161		fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1162			Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1163		}1164		fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1165			Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1166		}1167		fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1168			dispatch_unique_runtime!(collection.last_token_id())1169		}1170		fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1171			Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1172		}1173		fn collection_stats() -> Result<CollectionStats, DispatchError> {1174			Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1175		}1176	}11771178	impl sp_api::Core<Block> for Runtime {1179		fn version() -> RuntimeVersion {1180			VERSION1181		}11821183		fn execute_block(block: Block) {1184			Executive::execute_block(block)1185		}11861187		fn initialize_block(header: &<Block as BlockT>::Header) {1188			Executive::initialize_block(header)1189		}1190	}11911192	impl sp_api::Metadata<Block> for Runtime {1193		fn metadata() -> OpaqueMetadata {1194			OpaqueMetadata::new(Runtime::metadata().into())1195		}1196	}11971198	impl sp_block_builder::BlockBuilder<Block> for Runtime {1199		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1200			Executive::apply_extrinsic(extrinsic)1201		}12021203		fn finalize_block() -> <Block as BlockT>::Header {1204			Executive::finalize_block()1205		}12061207		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1208			data.create_extrinsics()1209		}12101211		fn check_inherents(1212			block: Block,1213			data: sp_inherents::InherentData,1214		) -> sp_inherents::CheckInherentsResult {1215			data.check_extrinsics(&block)1216		}12171218		// fn random_seed() -> <Block as BlockT>::Hash {1219		//     RandomnessCollectiveFlip::random_seed().01220		// }1221	}12221223	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1224		fn validate_transaction(1225			source: TransactionSource,1226			tx: <Block as BlockT>::Extrinsic,1227			hash: <Block as BlockT>::Hash,1228		) -> TransactionValidity {1229			Executive::validate_transaction(source, tx, hash)1230		}1231	}12321233	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1234		fn offchain_worker(header: &<Block as BlockT>::Header) {1235			Executive::offchain_worker(header)1236		}1237	}12381239	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1240		fn chain_id() -> u64 {1241			<Runtime as pallet_evm::Config>::ChainId::get()1242		}12431244		fn account_basic(address: H160) -> EVMAccount {1245			EVM::account_basic(&address)1246		}12471248		fn gas_price() -> U256 {1249			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1250		}12511252		fn account_code_at(address: H160) -> Vec<u8> {1253			EVM::account_codes(address)1254		}12551256		fn author() -> H160 {1257			<pallet_evm::Pallet<Runtime>>::find_author()1258		}12591260		fn storage_at(address: H160, index: U256) -> H256 {1261			let mut tmp = [0u8; 32];1262			index.to_big_endian(&mut tmp);1263			EVM::account_storages(address, H256::from_slice(&tmp[..]))1264		}12651266		#[allow(clippy::redundant_closure)]1267		fn call(1268			from: H160,1269			to: H160,1270			data: Vec<u8>,1271			value: U256,1272			gas_limit: U256,1273			max_fee_per_gas: Option<U256>,1274			max_priority_fee_per_gas: Option<U256>,1275			nonce: Option<U256>,1276			estimate: bool,1277			access_list: Option<Vec<(H160, Vec<H256>)>>,1278		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1279			let config = if estimate {1280				let mut config = <Runtime as pallet_evm::Config>::config().clone();1281				config.estimate = true;1282				Some(config)1283			} else {1284				None1285			};12861287			<Runtime as pallet_evm::Config>::Runner::call(1288				from,1289				to,1290				data,1291				value,1292				gas_limit.low_u64(),1293				max_fee_per_gas,1294				max_priority_fee_per_gas,1295				nonce,1296				access_list.unwrap_or_default(),1297				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1298			).map_err(|err| err.into())1299		}13001301		#[allow(clippy::redundant_closure)]1302		fn create(1303			from: H160,1304			data: Vec<u8>,1305			value: U256,1306			gas_limit: U256,1307			max_fee_per_gas: Option<U256>,1308			max_priority_fee_per_gas: Option<U256>,1309			nonce: Option<U256>,1310			estimate: bool,1311			access_list: Option<Vec<(H160, Vec<H256>)>>,1312		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1313			let config = if estimate {1314				let mut config = <Runtime as pallet_evm::Config>::config().clone();1315				config.estimate = true;1316				Some(config)1317			} else {1318				None1319			};13201321			<Runtime as pallet_evm::Config>::Runner::create(1322				from,1323				data,1324				value,1325				gas_limit.low_u64(),1326				max_fee_per_gas,1327				max_priority_fee_per_gas,1328				nonce,1329				access_list.unwrap_or_default(),1330				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1331			).map_err(|err| err.into())1332		}13331334		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1335			Ethereum::current_transaction_statuses()1336		}13371338		fn current_block() -> Option<pallet_ethereum::Block> {1339			Ethereum::current_block()1340		}13411342		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1343			Ethereum::current_receipts()1344		}13451346		fn current_all() -> (1347			Option<pallet_ethereum::Block>,1348			Option<Vec<pallet_ethereum::Receipt>>,1349			Option<Vec<TransactionStatus>>1350		) {1351			(1352				Ethereum::current_block(),1353				Ethereum::current_receipts(),1354				Ethereum::current_transaction_statuses()1355			)1356		}13571358		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1359			xts.into_iter().filter_map(|xt| match xt.0.function {1360				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1361				_ => None1362			}).collect()1363		}13641365		fn elasticity() -> Option<Permill> {1366			None1367		}1368	}13691370	impl sp_session::SessionKeys<Block> for Runtime {1371		fn decode_session_keys(1372			encoded: Vec<u8>,1373		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1374			SessionKeys::decode_into_raw_public_keys(&encoded)1375		}13761377		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1378			SessionKeys::generate(seed)1379		}1380	}13811382	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1383		fn slot_duration() -> sp_consensus_aura::SlotDuration {1384			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1385		}13861387		fn authorities() -> Vec<AuraId> {1388			Aura::authorities().to_vec()1389		}1390	}13911392	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1393		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1394			ParachainSystem::collect_collation_info(header)1395		}1396	}13971398	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1399		fn account_nonce(account: AccountId) -> Index {1400			System::account_nonce(account)1401		}1402	}14031404	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1405		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1406			TransactionPayment::query_info(uxt, len)1407		}1408		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1409			TransactionPayment::query_fee_details(uxt, len)1410		}1411	}14121413	/*1414	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1415		for Runtime1416	{1417		fn call(1418			origin: AccountId,1419			dest: AccountId,1420			value: Balance,1421			gas_limit: u64,1422			input_data: Vec<u8>,1423		) -> pallet_contracts_primitives::ContractExecResult {1424			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1425		}14261427		fn instantiate(1428			origin: AccountId,1429			endowment: Balance,1430			gas_limit: u64,1431			code: pallet_contracts_primitives::Code<Hash>,1432			data: Vec<u8>,1433			salt: Vec<u8>,1434		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1435		{1436			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1437		}14381439		fn get_storage(1440			address: AccountId,1441			key: [u8; 32],1442		) -> pallet_contracts_primitives::GetStorageResult {1443			Contracts::get_storage(address, key)1444		}14451446		fn rent_projection(1447			address: AccountId,1448		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1449			Contracts::rent_projection(address)1450		}1451	}1452	*/14531454	#[cfg(feature = "runtime-benchmarks")]1455	impl frame_benchmarking::Benchmark<Block> for Runtime {1456		fn benchmark_metadata(extra: bool) -> (1457			Vec<frame_benchmarking::BenchmarkList>,1458			Vec<frame_support::traits::StorageInfo>,1459		) {1460			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1461			use frame_support::traits::StorageInfoTrait;14621463			let mut list = Vec::<BenchmarkList>::new();14641465			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1466			list_benchmark!(list, extra, pallet_unique, Unique);1467			list_benchmark!(list, extra, pallet_inflation, Inflation);1468			list_benchmark!(list, extra, pallet_fungible, Fungible);1469			list_benchmark!(list, extra, pallet_refungible, Refungible);1470			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1471			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);14721473			let storage_info = AllPalletsReversedWithSystemFirst::storage_info();14741475			return (list, storage_info)1476		}14771478		fn dispatch_benchmark(1479			config: frame_benchmarking::BenchmarkConfig1480		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1481			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};14821483			let allowlist: Vec<TrackedStorageKey> = vec![1484				// Block Number1485				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1486				// Total Issuance1487				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1488				// Execution Phase1489				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1490				// Event Count1491				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1492				// System Events1493				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1494			];14951496			let mut batches = Vec::<BenchmarkBatch>::new();1497			let params = (&config, &allowlist);14981499			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1500			add_benchmark!(params, batches, pallet_unique, Unique);1501			add_benchmark!(params, batches, pallet_inflation, Inflation);1502			add_benchmark!(params, batches, pallet_fungible, Fungible);1503			add_benchmark!(params, batches, pallet_refungible, Refungible);1504			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1505			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);15061507			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1508			Ok(batches)1509		}1510	}1511}15121513struct CheckInherents;15141515impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1516	fn check_inherents(1517		block: &Block,1518		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1519	) -> sp_inherents::CheckInherentsResult {1520		let relay_chain_slot = relay_state_proof1521			.read_slot()1522			.expect("Could not read the relay chain slot from the proof");15231524		let inherent_data =1525			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1526				relay_chain_slot,1527				sp_std::time::Duration::from_secs(6),1528			)1529			.create_inherent_data()1530			.expect("Could not create the timestamp inherent data");15311532		inherent_data.check_extrinsics(block)1533	}1534}15351536cumulus_pallet_parachain_system::register_validate_block!(1537	Runtime = Runtime,1538	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1539	CheckInherents = CheckInherents,1540);
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -7,7 +7,7 @@
 description = 'Quartz Runtime'
 edition = '2021'
 homepage = 'https://unique.network'
-license = 'All Rights Reserved'
+license = 'GPLv3'
 name = 'quartz-runtime'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
 version = '0.1.0'
@@ -100,6 +100,7 @@
     'xcm/std',
     'xcm-builder/std',
     'xcm-executor/std',
+    'unique-runtime-common/std',
 
     "orml-vesting/std",
 ]
@@ -118,33 +119,33 @@
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
 optional = true
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-executive]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-support]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-system]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-system-benchmarking]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
 optional = true
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.frame-system-rpc-runtime-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.hex-literal]
 optional = true
@@ -159,131 +160,131 @@
 [dependencies.pallet-aura]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-balances]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 # Contracts specific packages
 # [dependencies.pallet-contracts]
 # git = 'https://github.com/paritytech/substrate.git'
 # default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
 # version = '4.0.0-dev'
 
 # [dependencies.pallet-contracts-primitives]
 # git = 'https://github.com/paritytech/substrate.git'
 # default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
 # version = '4.0.0-dev'
 
 # [dependencies.pallet-contracts-rpc-runtime-api]
 # git = 'https://github.com/paritytech/substrate.git'
 # default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
 # version = '4.0.0-dev'
 
 [dependencies.pallet-randomness-collective-flip]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-sudo]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-timestamp]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-transaction-payment]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-transaction-payment-rpc-runtime-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.pallet-treasury]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 # [dependencies.pallet-vesting]
 # default-features = false
 # git = 'https://github.com/paritytech/substrate.git'
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-arithmetic]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-api]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-block-builder]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-core]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-consensus-aura]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-inherents]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-io]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-offchain]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-runtime]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-session]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-std]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-transaction-pool]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.sp-version]
 default-features = false
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.smallvec]
 version = '1.6.1'
@@ -293,47 +294,47 @@
 
 [dependencies.parachain-info]
 default-features = false
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 
 [dependencies.cumulus-pallet-aura-ext]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-pallet-parachain-system]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-primitives-core]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-pallet-xcm]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-pallet-dmp-queue]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-pallet-xcmp-queue]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-primitives-utility]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 [dependencies.cumulus-primitives-timestamp]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
 default-features = false
 
 ################################################################################
@@ -341,32 +342,32 @@
 
 [dependencies.polkadot-parachain]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.xcm]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.xcm-builder]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.xcm-executor]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.pallet-xcm]
 git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
 default-features = false
 
 [dependencies.orml-vesting]
 git = 'https://github.com/UniqueNetwork/open-runtime-module-library'
-branch = 'unique-polkadot-v0.9.16'
+branch = 'unique-polkadot-v0.9.17'
 version = "0.4.1-dev"
 default-features = false
 
@@ -390,21 +391,20 @@
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
 pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.16', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
+pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.17', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
 pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
 pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
 pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
 
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-
 ################################################################################
 # Build Dependencies
 
 [build-dependencies.substrate-wasm-builder]
 git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -1,7 +1,18 @@
-//
-// This file is subject to the terms and conditions defined in
-// file 'LICENSE', which is part of this source code package.
-//
+// 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/>.
 
 //! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
 
@@ -83,8 +94,9 @@
 use xcm_builder::{
 	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
 	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
-	ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
 	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
+	ParentIsPreset,
 };
 use xcm_executor::{Config, XcmExecutor, Assets};
 use sp_std::{marker::PhantomData};
@@ -102,10 +114,7 @@
 
 use unique_runtime_common::{types::*, constants::*};
 
-// mod chain_extension;
-// use crate::chain_extension::{NFTExtension, Imbalance};
-
-pub const RUNTIME_NAME: &'static str = "Quartz";
+pub const RUNTIME_NAME: &str = "Quartz";
 
 pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
 
@@ -133,7 +142,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 916001,
+	spec_version: 917004,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,
@@ -198,18 +207,27 @@
 		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
 		.build_or_panic();
 	pub const Version: RuntimeVersion = VERSION;
+	/*
+	255 - Quartz
+	42 - Opal
+	*/
 	pub const SS58Prefix: u8 = 255;
 }
 
+/*
+8880 - Unique
+8881 - Quartz
+8882 - Opal
+*/
 parameter_types! {
-	pub const ChainId: u64 = 8888;
+	pub const ChainId: u64 = 8881;
 }
 
 pub struct FixedFee;
 impl FeeCalculator for FixedFee {
 	fn min_gas_price() -> U256 {
 		// Targeting 0.15 UNQ per transfer
-		1_024_947_215_000u64.into()
+		1_018_751_825_264u64.into()
 	}
 }
 
@@ -574,7 +592,7 @@
 /// `Transact` in order to determine the dispatch Origin.
 pub type LocationToAccountId = (
 	// The parent (Relay-chain) origin converts to the default `AccountId`.
-	ParentIsDefault<AccountId>,
+	ParentIsPreset<AccountId>,
 	// Sibling parachain origins convert to AccountId via the `ParaId::into`.
 	SiblingParachainConvertsVia<Sibling, AccountId>,
 	// Straight up local `AccountId32` origins just alias directly to `AccountId`.
@@ -809,6 +827,8 @@
 	type ChannelInfo = ParachainSystem;
 	type VersionWrapper = ();
 	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+	type ControllerOrigin = EnsureRoot<AccountId>;
+	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
 }
 
 impl cumulus_pallet_dmp_queue::Config for Runtime {
@@ -825,7 +845,7 @@
 
 parameter_types! {
 	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();
-	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;
+	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;
 }
 
 impl pallet_common::Config for Runtime {
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -100,6 +100,7 @@
     'xcm/std',
     'xcm-builder/std',
     'xcm-executor/std',
+    'unique-runtime-common/std',
 
     "orml-vesting/std",
 ]
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -1,7 +1,18 @@
-//
-// This file is subject to the terms and conditions defined in
-// file 'LICENSE', which is part of this source code package.
-//
+// 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/>.
 
 //! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
 
@@ -83,8 +94,9 @@
 use xcm_builder::{
 	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
 	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
-	ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
 	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
+	ParentIsPreset,
 };
 use xcm_executor::{Config, XcmExecutor, Assets};
 use sp_std::{marker::PhantomData};
@@ -101,11 +113,8 @@
 use sp_runtime::traits::CheckedConversion;
 
 use unique_runtime_common::{types::*, constants::*};
-
-// mod chain_extension;
-// use crate::chain_extension::{NFTExtension, Imbalance};
 
-pub const RUNTIME_NAME: &'static str = "Unique";
+pub const RUNTIME_NAME: &str = "Unique";
 
 pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
 
@@ -133,7 +142,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 916001,
+	spec_version: 917004,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,
@@ -198,18 +207,28 @@
 		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
 		.build_or_panic();
 	pub const Version: RuntimeVersion = VERSION;
-	pub const SS58Prefix: u8 = 255;
+	/*
+	FIXME - Unique
+	255 - Quartz
+	42 - Opal
+	*/
+	pub const SS58Prefix: u8 = 255; // FIXME set valid valud for the Unique runtime
 }
 
+/*
+8880 - Unique
+8881 - Quartz
+8882 - Opal
+*/
 parameter_types! {
-	pub const ChainId: u64 = 8888;
+	pub const ChainId: u64 = 8880;
 }
 
 pub struct FixedFee;
 impl FeeCalculator for FixedFee {
 	fn min_gas_price() -> U256 {
 		// Targeting 0.15 UNQ per transfer
-		1_024_947_215_000u64.into()
+		1_018_751_825_264u64.into()
 	}
 }
 
@@ -574,7 +593,7 @@
 /// `Transact` in order to determine the dispatch Origin.
 pub type LocationToAccountId = (
 	// The parent (Relay-chain) origin converts to the default `AccountId`.
-	ParentIsDefault<AccountId>,
+	ParentIsPreset<AccountId>,
 	// Sibling parachain origins convert to AccountId via the `ParaId::into`.
 	SiblingParachainConvertsVia<Sibling, AccountId>,
 	// Straight up local `AccountId32` origins just alias directly to `AccountId`.
@@ -809,6 +828,8 @@
 	type ChannelInfo = ParachainSystem;
 	type VersionWrapper = ();
 	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+	type ControllerOrigin = EnsureRoot<AccountId>;
+	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
 }
 
 impl cumulus_pallet_dmp_queue::Config for Runtime {
@@ -825,7 +846,7 @@
 
 parameter_types! {
 	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();
-	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;
+	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;
 }
 
 impl pallet_common::Config for Runtime {