git.delta.rocks / unique-network / refs/commits / 6f2ea23699e0

difftreelog

Merge pull request #351 from UniqueNetwork/release-v0.9.21

kozyrevdev2022-05-12parents: #6cf08e5 #b8d2ab1.patch.diff
in: master
release v921000

13 files changed

modified.envdiffbeforeafterboth
--- a/.env
+++ b/.env
@@ -1,6 +1,6 @@
 RUST_TOOLCHAIN=nightly-2022-04-07
 RUST_C=1.62.0-nightly
-POLKA_VERSION=release-v0.9.20
+POLKA_VERSION=release-v0.9.21
 UNIQUE_BRANCH=develop
 USER=***
 PASS=***
modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -396,7 +396,7 @@
  "instant",
  "pin-project-lite 0.2.9",
  "rand 0.8.5",
- "tokio 1.18.1",
+ "tokio 1.18.2",
 ]
 
 [[package]]
@@ -410,7 +410,7 @@
  "cfg-if 1.0.0",
  "libc",
  "miniz_oxide",
- "object 0.28.3",
+ "object 0.28.4",
  "rustc-demangle",
 ]
 
@@ -977,9 +977,9 @@
 
 [[package]]
 name = "camino"
-version = "1.0.7"
+version = "1.0.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f3132262930b0522068049f5870a856ab8affc80c70d08b6ecb785771a6fc23"
+checksum = "07fd178c5af4d59e83498ef15cf3f154e1a6f9d091270cb86283c65ef44e9ef0"
 dependencies = [
  "serde",
 ]
@@ -1122,9 +1122,9 @@
 
 [[package]]
 name = "clap"
-version = "3.1.16"
+version = "3.1.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f52d4f8e4a1419219935762e32913b4430f37cb0c0200ad17a89ee18c0188a9f"
+checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b"
 dependencies = [
  "atty",
  "bitflags",
@@ -1139,9 +1139,9 @@
 
 [[package]]
 name = "clap_derive"
-version = "3.1.7"
+version = "3.1.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1"
+checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c"
 dependencies = [
  "heck 0.4.0",
  "proc-macro-error",
@@ -2202,9 +2202,9 @@
 
 [[package]]
 name = "ed25519"
-version = "1.4.1"
+version = "1.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d5c4b5e5959dc2c2b89918d8e2cc40fcdd623cef026ed09d2f0ee05199dc8e4"
+checksum = "d916019f70ae3a1faa1195685e290287f39207d38e6dfee727197cffcc002214"
 dependencies = [
  "signature",
 ]
@@ -2638,7 +2638,7 @@
  "sp-io",
  "sp-runtime",
  "sp-storage",
- "tokio 1.18.1",
+ "tokio 1.18.2",
 ]
 
 [[package]]
@@ -3394,7 +3394,7 @@
  "http",
  "indexmap",
  "slab",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tokio-util 0.7.1",
  "tracing",
 ]
@@ -3588,7 +3588,7 @@
  "itoa 1.0.1",
  "pin-project-lite 0.2.9",
  "socket2 0.4.4",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tower-service",
  "tracing",
  "want",
@@ -3606,7 +3606,7 @@
  "log",
  "rustls 0.19.1",
  "rustls-native-certs 0.5.0",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tokio-rustls 0.22.0",
  "webpki 0.21.4",
 ]
@@ -3622,7 +3622,7 @@
  "log",
  "rustls 0.20.4",
  "rustls-native-certs 0.6.2",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tokio-rustls 0.23.4",
  "webpki-roots 0.22.3",
 ]
@@ -3954,7 +3954,7 @@
  "jsonrpc-core",
  "lazy_static",
  "log",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tokio-stream",
  "tokio-util 0.6.9",
  "unicase",
@@ -4002,7 +4002,7 @@
  "rustls-native-certs 0.6.2",
  "soketto",
  "thiserror",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tokio-rustls 0.23.4",
  "tokio-util 0.7.1",
  "tracing",
@@ -4028,7 +4028,7 @@
  "serde_json",
  "soketto",
  "thiserror",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tracing",
 ]
 
@@ -4047,7 +4047,7 @@
  "serde",
  "serde_json",
  "thiserror",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tracing",
 ]
 
@@ -5126,7 +5126,7 @@
  "kernel32-sys",
  "libc",
  "log",
- "miow 0.2.2",
+ "miow",
  "net2",
  "slab",
  "winapi 0.2.8",
@@ -5134,16 +5134,14 @@
 
 [[package]]
 name = "mio"
-version = "0.8.2"
+version = "0.8.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9"
+checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799"
 dependencies = [
  "libc",
  "log",
- "miow 0.3.7",
- "ntapi",
  "wasi 0.11.0+wasi-snapshot-preview1",
- "winapi 0.3.9",
+ "windows-sys",
 ]
 
 [[package]]
@@ -5171,15 +5169,6 @@
 ]
 
 [[package]]
-name = "miow"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
 name = "more-asserts"
 version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5353,15 +5342,6 @@
 dependencies = [
  "memchr",
  "minimal-lexical",
-]
-
-[[package]]
-name = "ntapi"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
-dependencies = [
- "winapi 0.3.9",
 ]
 
 [[package]]
@@ -5460,9 +5440,9 @@
 
 [[package]]
 name = "object"
-version = "0.28.3"
+version = "0.28.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40bec70ba014595f99f7aa110b84331ffe1ee9aece7fe6f387cc7e3ecda4d456"
+checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424"
 dependencies = [
  "memchr",
 ]
@@ -5475,7 +5455,7 @@
 
 [[package]]
 name = "opal-runtime"
-version = "0.9.20"
+version = "0.9.21"
 dependencies = [
  "cumulus-pallet-aura-ext",
  "cumulus-pallet-dmp-queue",
@@ -6884,9 +6864,9 @@
 
 [[package]]
 name = "parity-db"
-version = "0.3.12"
+version = "0.3.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e73cd0b0a78045276b19eaae8eaaa20e44a1da9a0217ff934a810d9492ae701"
+checksum = "55a7901b85874402471e131de3332dde0e51f38432c69a3853627c8e25433048"
 dependencies = [
  "blake2-rfc",
  "crc32fast",
@@ -6943,7 +6923,7 @@
  "libc",
  "log",
  "rand 0.7.3",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "winapi 0.3.9",
 ]
 
@@ -8478,7 +8458,7 @@
  "substrate-test-client",
  "tempfile",
  "test-runtime-constants",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tracing-gum",
 ]
 
@@ -8682,7 +8662,7 @@
 
 [[package]]
 name = "quartz-runtime"
-version = "0.9.20"
+version = "0.9.21"
 dependencies = [
  "cumulus-pallet-aura-ext",
  "cumulus-pallet-dmp-queue",
@@ -9546,7 +9526,7 @@
  "sp-version",
  "thiserror",
  "tiny-bip39",
- "tokio 1.18.1",
+ "tokio 1.18.2",
 ]
 
 [[package]]
@@ -10168,7 +10148,7 @@
  "log",
  "serde_json",
  "substrate-prometheus-endpoint",
- "tokio 1.18.1",
+ "tokio 1.18.2",
 ]
 
 [[package]]
@@ -10231,7 +10211,7 @@
  "substrate-prometheus-endpoint",
  "tempfile",
  "thiserror",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tracing",
  "tracing-futures",
 ]
@@ -11593,9 +11573,9 @@
 
 [[package]]
 name = "ss58-registry"
-version = "1.17.0"
+version = "1.18.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b84a70894df7a73666e0694f44b41a9571625e9546fb58a0818a565d2c7e084"
+checksum = "ceb8b72a924ccfe7882d0e26144c114503760a4d1248bb5cd06c8ab2d55404cc"
 dependencies = [
  "Inflector",
  "num-format",
@@ -11759,7 +11739,7 @@
  "log",
  "prometheus",
  "thiserror",
- "tokio 1.18.1",
+ "tokio 1.18.2",
 ]
 
 [[package]]
@@ -11818,7 +11798,7 @@
 dependencies = [
  "futures 0.3.21",
  "substrate-test-utils-derive",
- "tokio 1.18.1",
+ "tokio 1.18.2",
 ]
 
 [[package]]
@@ -11856,9 +11836,9 @@
 
 [[package]]
 name = "syn"
-version = "1.0.92"
+version = "1.0.93"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52"
+checksum = "04066589568b72ec65f42d65a1a52436e954b168773148893c020269563decf2"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -12077,14 +12057,14 @@
 
 [[package]]
 name = "tokio"
-version = "1.18.1"
+version = "1.18.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dce653fb475565de9f6fb0614b28bca8df2c430c0cf84bcd9c843f15de5414cc"
+checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395"
 dependencies = [
  "bytes 1.1.0",
  "libc",
  "memchr",
- "mio 0.8.2",
+ "mio 0.8.3",
  "num_cpus",
  "once_cell",
  "parking_lot 0.12.0",
@@ -12124,7 +12104,7 @@
 checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"
 dependencies = [
  "rustls 0.19.1",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "webpki 0.21.4",
 ]
 
@@ -12135,7 +12115,7 @@
 checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
 dependencies = [
  "rustls 0.20.4",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "webpki 0.22.0",
 ]
 
@@ -12147,7 +12127,7 @@
 dependencies = [
  "futures-core",
  "pin-project-lite 0.2.9",
- "tokio 1.18.1",
+ "tokio 1.18.2",
 ]
 
 [[package]]
@@ -12161,7 +12141,7 @@
  "futures-sink",
  "log",
  "pin-project-lite 0.2.9",
- "tokio 1.18.1",
+ "tokio 1.18.2",
 ]
 
 [[package]]
@@ -12175,7 +12155,7 @@
  "futures-io",
  "futures-sink",
  "pin-project-lite 0.2.9",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "tracing",
 ]
 
@@ -12515,7 +12495,7 @@
 
 [[package]]
 name = "unique-node"
-version = "0.9.20"
+version = "0.9.21"
 dependencies = [
  "clap",
  "cumulus-client-cli",
@@ -12591,7 +12571,7 @@
  "substrate-build-script-utils",
  "substrate-frame-rpc-system",
  "substrate-prometheus-endpoint",
- "tokio 1.18.1",
+ "tokio 1.18.2",
  "unique-rpc",
  "unique-runtime",
  "unique-runtime-common",
@@ -12649,7 +12629,7 @@
 
 [[package]]
 name = "unique-runtime"
-version = "0.9.18"
+version = "0.9.21"
 dependencies = [
  "cumulus-pallet-aura-ext",
  "cumulus-pallet-dmp-queue",
@@ -12725,7 +12705,7 @@
 
 [[package]]
 name = "unique-runtime-common"
-version = "0.9.20"
+version = "0.9.21"
 dependencies = [
  "fp-rpc",
  "frame-support",
@@ -13627,18 +13607,18 @@
 
 [[package]]
 name = "zstd"
-version = "0.10.0+zstd.1.5.2"
+version = "0.10.2+zstd.1.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b1365becbe415f3f0fcd024e2f7b45bacfb5bdd055f0dc113571394114e7bdd"
+checksum = "5f4a6bd64f22b5e3e94b4e238669ff9f10815c27a5180108b849d24174a83847"
 dependencies = [
  "zstd-safe",
 ]
 
 [[package]]
 name = "zstd-safe"
-version = "4.1.4+zstd.1.5.2"
+version = "4.1.6+zstd.1.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f7cd17c9af1a4d6c24beb1cc54b17e2ef7b593dc92f19e9d9acad8b182bbaee"
+checksum = "94b61c51bb270702d6167b8ce67340d2754b088d0c091b06e593aa772c3ee9bb"
 dependencies = [
  "libc",
  "zstd-sys",
modifiedDockerfile-parachaindiffbeforeafterboth
--- a/Dockerfile-parachain
+++ b/Dockerfile-parachain
@@ -4,7 +4,7 @@
 
 ARG RUST_TOOLCHAIN=nightly-2022-04-07
 #ARG RUST_C=1.62.0-nightly
-ARG POLKA_VERSION=release-v0.9.20
+ARG POLKA_VERSION=release-v0.9.21
 ARG UNIQUE_BRANCH=develop
 
 #ARG USER=***
modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -81,7 +81,7 @@
 ```
 git clone https://github.com/paritytech/polkadot.git
 cd polkadot
-git checkout release-v0.9.20
+git checkout release-v0.9.21
 cargo build --release
 ```
 
modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -283,7 +283,7 @@
 license = 'GPLv3'
 name = 'unique-node'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.9.20'
+version = '0.9.21'
 
 [[bin]]
 name = 'unique-collator'
modifiedruntime/common/Cargo.tomldiffbeforeafterboth
--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -6,7 +6,7 @@
 license = 'All Rights Reserved'
 name = 'unique-runtime-common'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.9.20'
+version = '0.9.21'
 
 [features]
 default = ['std']
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -10,7 +10,7 @@
 license = 'GPLv3'
 name = 'opal-runtime'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.9.20'
+version = '0.9.21'
 
 [package.metadata.docs.rs]
 targets = ['x86_64-unknown-linux-gnu']
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::{52	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,53};54pub use frame_support::{55	construct_runtime, match_types,56	dispatch::DispatchResult,57	PalletId, parameter_types, StorageValue, ConsensusEngineId,58	traits::{59		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,60		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,61		OnUnbalanced, Randomness, FindAuthor,62	},63	weights::{64		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},65		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,66		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,67	},68};69use up_data_structs::*;70// use pallet_contracts::weights::WeightInfo;71// #[cfg(any(feature = "std", test))]72use frame_system::{73	self as frame_system, EnsureRoot, EnsureSigned,74	limits::{BlockWeights, BlockLength},75};76use sp_arithmetic::{77	traits::{BaseArithmetic, Unsigned},78};79use smallvec::smallvec;80use codec::{Encode, Decode};81use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping};82use fp_rpc::TransactionStatus;83use sp_runtime::{84	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},85	transaction_validity::TransactionValidityError,86	SaturatedConversion,87};8889// pub use pallet_timestamp::Call as TimestampCall;90pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;9192// Polkadot imports93use pallet_xcm::XcmPassthrough;94use polkadot_parachain::primitives::Sibling;95use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};96use xcm_builder::{97	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,98	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,99	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,100	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,101	ParentIsPreset,102};103use xcm_executor::{Config, XcmExecutor, Assets};104use sp_std::{marker::PhantomData};105106use xcm::latest::{107	//	Xcm,108	AssetId::{Concrete},109	Fungibility::Fungible as XcmFungible,110	MultiAsset,111	Error as XcmError,112};113use xcm_executor::traits::{MatchesFungible, WeightTrader};114//use xcm_executor::traits::MatchesFungible;115use sp_runtime::traits::CheckedConversion;116117use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};118119pub const RUNTIME_NAME: &str = "opal";120pub const TOKEN_SYMBOL: &str = "OPL";121122type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;123124impl RuntimeInstance for Runtime {125	type CrossAccountId = self::CrossAccountId;126	type TransactionConverter = self::TransactionConverter;127128	fn get_transaction_converter() -> TransactionConverter {129		TransactionConverter130	}131}132133/// The type for looking up accounts. We don't expect more than 4 billion of them, but you134/// never know...135pub type AccountIndex = u32;136137/// Balance of an account.138pub type Balance = u128;139140/// Index of a transaction in the chain.141pub type Index = u32;142143/// A hash of some data used by the chain.144pub type Hash = sp_core::H256;145146/// Digest item type.147pub type DigestItem = generic::DigestItem;148149/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know150/// the specifics of the runtime. They can then be made to be agnostic over specific formats151/// of data like extrinsics, allowing for them to continue syncing the network through upgrades152/// to even the core data structures.153pub mod opaque {154	use sp_std::prelude::*;155	use sp_runtime::impl_opaque_keys;156	use super::Aura;157158	pub use unique_runtime_common::types::*;159160	impl_opaque_keys! {161		pub struct SessionKeys {162			pub aura: Aura,163		}164	}165}166167/// This runtime version.168pub const VERSION: RuntimeVersion = RuntimeVersion {169	spec_name: create_runtime_str!(RUNTIME_NAME),170	impl_name: create_runtime_str!(RUNTIME_NAME),171	authoring_version: 1,172	spec_version: 920000,173	impl_version: 0,174	apis: RUNTIME_API_VERSIONS,175	transaction_version: 1,176	state_version: 0,177};178179#[derive(codec::Encode, codec::Decode)]180pub enum XCMPMessage<XAccountId, XBalance> {181	/// Transfer tokens to the given account from the Parachain account.182	TransferToken(XAccountId, XBalance),183}184185/// The version information used to identify this runtime when compiled natively.186#[cfg(feature = "std")]187pub fn native_version() -> NativeVersion {188	NativeVersion {189		runtime_version: VERSION,190		can_author_with: Default::default(),191	}192}193194type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;195196pub struct DealWithFees;197impl OnUnbalanced<NegativeImbalance> for DealWithFees {198	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {199		if let Some(fees) = fees_then_tips.next() {200			// for fees, 100% to treasury201			let mut split = fees.ration(100, 0);202			if let Some(tips) = fees_then_tips.next() {203				// for tips, if any, 100% to treasury204				tips.ration_merge_into(100, 0, &mut split);205			}206			Treasury::on_unbalanced(split.0);207			// Author::on_unbalanced(split.1);208		}209	}210}211212parameter_types! {213	pub const BlockHashCount: BlockNumber = 2400;214	pub RuntimeBlockLength: BlockLength =215		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);216	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);217	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;218	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()219		.base_block(BlockExecutionWeight::get())220		.for_class(DispatchClass::all(), |weights| {221			weights.base_extrinsic = ExtrinsicBaseWeight::get();222		})223		.for_class(DispatchClass::Normal, |weights| {224			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);225		})226		.for_class(DispatchClass::Operational, |weights| {227			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);228			// Operational transactions have some extra reserved space, so that they229			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.230			weights.reserved = Some(231				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT232			);233		})234		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)235		.build_or_panic();236	pub const Version: RuntimeVersion = VERSION;237	pub const SS58Prefix: u8 = 42;238}239240parameter_types! {241	pub const ChainId: u64 = 8882;242}243244pub struct FixedFee;245impl FeeCalculator for FixedFee {246	fn min_gas_price() -> U256 {247		MIN_GAS_PRICE.into()248	}249}250251// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case252// (contract, which only writes a lot of data),253// approximating on top of our real store write weight254parameter_types! {255	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;256	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;257	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();258}259260/// Limiting EVM execution to 50% of block for substrate users and management tasks261/// EVM transaction consumes more weight than substrate's, so we can't rely on them being262/// scheduled fairly263const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);264parameter_types! {265	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());266}267268pub enum FixedGasWeightMapping {}269impl GasWeightMapping for FixedGasWeightMapping {270	fn gas_to_weight(gas: u64) -> Weight {271		gas.saturating_mul(WeightPerGas::get())272	}273	fn weight_to_gas(weight: Weight) -> u64 {274		weight / WeightPerGas::get()275	}276}277278impl pallet_evm::account::Config for Runtime {279	type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Self>;280	type EvmAddressMapping = pallet_evm::HashedAddressMapping<Self::Hashing>;281	type EvmBackwardsAddressMapping = fp_evm_mapping::MapBackwardsAddressTruncated;282}283284impl pallet_evm::Config for Runtime {285	type BlockGasLimit = BlockGasLimit;286	type FeeCalculator = FixedFee;287	type GasWeightMapping = FixedGasWeightMapping;288	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;289	type CallOrigin = EnsureAddressTruncated<Self>;290	type WithdrawOrigin = EnsureAddressTruncated<Self>;291	type AddressMapping = HashedAddressMapping<Self::Hashing>;292	type PrecompilesType = ();293	type PrecompilesValue = ();294	type Currency = Balances;295	type Event = Event;296	type OnMethodCall = (297		pallet_evm_migration::OnMethodCall<Self>,298		pallet_unique::UniqueErcSupport<Self>,299		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,300	);301	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;302	type ChainId = ChainId;303	type Runner = pallet_evm::runner::stack::Runner<Self>;304	type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter<Balances, DealWithFees>;305	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;306	type FindAuthor = EthereumFindAuthor<Aura>;307}308309impl pallet_evm_migration::Config for Runtime {310	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;311}312313pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);314impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {315	fn find_author<'a, I>(digests: I) -> Option<H160>316	where317		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,318	{319		if let Some(author_index) = F::find_author(digests) {320			let authority_id = Aura::authorities()[author_index as usize].clone();321			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));322		}323		None324	}325}326327impl pallet_ethereum::Config for Runtime {328	type Event = Event;329	type StateRoot = pallet_ethereum::IntermediateStateRoot<Self>;330}331332impl pallet_randomness_collective_flip::Config for Runtime {}333334impl frame_system::Config for Runtime {335	/// The data to be stored in an account.336	type AccountData = pallet_balances::AccountData<Balance>;337	/// The identifier used to distinguish between accounts.338	type AccountId = AccountId;339	/// The basic call filter to use in dispatchable.340	type BaseCallFilter = Everything;341	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).342	type BlockHashCount = BlockHashCount;343	/// The maximum length of a block (in bytes).344	type BlockLength = RuntimeBlockLength;345	/// The index type for blocks.346	type BlockNumber = BlockNumber;347	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.348	type BlockWeights = RuntimeBlockWeights;349	/// The aggregated dispatch type that is available for extrinsics.350	type Call = Call;351	/// The weight of database operations that the runtime can invoke.352	type DbWeight = RocksDbWeight;353	/// The ubiquitous event type.354	type Event = Event;355	/// The type for hashing blocks and tries.356	type Hash = Hash;357	/// The hashing algorithm used.358	type Hashing = BlakeTwo256;359	/// The header type.360	type Header = generic::Header<BlockNumber, BlakeTwo256>;361	/// The index type for storing how many extrinsics an account has signed.362	type Index = Index;363	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.364	type Lookup = AccountIdLookup<AccountId, ()>;365	/// What to do if an account is fully reaped from the system.366	type OnKilledAccount = ();367	/// What to do if a new account is created.368	type OnNewAccount = ();369	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;370	/// The ubiquitous origin type.371	type Origin = Origin;372	/// This type is being generated by `construct_runtime!`.373	type PalletInfo = PalletInfo;374	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.375	type SS58Prefix = SS58Prefix;376	/// Weight information for the extrinsics of this pallet.377	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;378	/// Version of the runtime.379	type Version = Version;380	type MaxConsumers = ConstU32<16>;381}382383parameter_types! {384	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;385}386387impl pallet_timestamp::Config for Runtime {388	/// A timestamp: milliseconds since the unix epoch.389	type Moment = u64;390	type OnTimestampSet = ();391	type MinimumPeriod = MinimumPeriod;392	type WeightInfo = ();393}394395parameter_types! {396	// pub const ExistentialDeposit: u128 = 500;397	pub const ExistentialDeposit: u128 = 0;398	pub const MaxLocks: u32 = 50;399}400401impl pallet_balances::Config for Runtime {402	type MaxLocks = MaxLocks;403	type MaxReserves = ();404	type ReserveIdentifier = [u8; 8];405	/// The type for recording an account's balance.406	type Balance = Balance;407	/// The ubiquitous event type.408	type Event = Event;409	type DustRemoval = Treasury;410	type ExistentialDeposit = ExistentialDeposit;411	type AccountStore = System;412	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;413}414415pub const fn deposit(items: u32, bytes: u32) -> Balance {416	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE417}418419/*420parameter_types! {421	pub TombstoneDeposit: Balance = deposit(422		1,423		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,424	);425	pub DepositPerContract: Balance = TombstoneDeposit::get();426	pub const DepositPerStorageByte: Balance = deposit(0, 1);427	pub const DepositPerStorageItem: Balance = deposit(1, 0);428	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);429	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;430	pub const SignedClaimHandicap: u32 = 2;431	pub const MaxDepth: u32 = 32;432	pub const MaxValueSize: u32 = 16 * 1024;433	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb434	// The lazy deletion runs inside on_initialize.435	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *436		RuntimeBlockWeights::get().max_block;437	// The weight needed for decoding the queue should be less or equal than a fifth438	// of the overall weight dedicated to the lazy deletion.439	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (440			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -441			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)442		)) / 5) as u32;443	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();444}445446impl pallet_contracts::Config for Runtime {447	type Time = Timestamp;448	type Randomness = RandomnessCollectiveFlip;449	type Currency = Balances;450	type Event = Event;451	type RentPayment = ();452	type SignedClaimHandicap = SignedClaimHandicap;453	type TombstoneDeposit = TombstoneDeposit;454	type DepositPerContract = DepositPerContract;455	type DepositPerStorageByte = DepositPerStorageByte;456	type DepositPerStorageItem = DepositPerStorageItem;457	type RentFraction = RentFraction;458	type SurchargeReward = SurchargeReward;459	type WeightPrice = pallet_transaction_payment::Pallet<Self>;460	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;461	type ChainExtension = NFTExtension;462	type DeletionQueueDepth = DeletionQueueDepth;463	type DeletionWeightLimit = DeletionWeightLimit;464	type Schedule = Schedule;465	type CallStack = [pallet_contracts::Frame<Self>; 31];466}467*/468469parameter_types! {470	/// This value increases the priority of `Operational` transactions by adding471	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.472	pub const OperationalFeeMultiplier: u8 = 5;473}474475/// Linear implementor of `WeightToFeePolynomial`476pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);477478impl<T> WeightToFeePolynomial for LinearFee<T>479where480	T: BaseArithmetic + From<u32> + Copy + Unsigned,481{482	type Balance = T;483484	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {485		smallvec!(WeightToFeeCoefficient {486			// Targeting 0.1 Unique per NFT transfer487			coeff_integer: WEIGHT_TO_FEE_COEFF.into(),488			coeff_frac: Perbill::zero(),489			negative: false,490			degree: 1,491		})492	}493}494495impl pallet_transaction_payment::Config for Runtime {496	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;497	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;498	type OperationalFeeMultiplier = OperationalFeeMultiplier;499	type WeightToFee = LinearFee<Balance>;500	type FeeMultiplierUpdate = ();501}502503parameter_types! {504	pub const ProposalBond: Permill = Permill::from_percent(5);505	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;506	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;507	pub const SpendPeriod: BlockNumber = 5 * MINUTES;508	pub const Burn: Permill = Permill::from_percent(0);509	pub const TipCountdown: BlockNumber = 1 * DAYS;510	pub const TipFindersFee: Percent = Percent::from_percent(20);511	pub const TipReportDepositBase: Balance = 1 * UNIQUE;512	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;513	pub const BountyDepositBase: Balance = 1 * UNIQUE;514	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;515	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");516	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;517	pub const MaximumReasonLength: u32 = 16384;518	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);519	pub const BountyValueMinimum: Balance = 5 * UNIQUE;520	pub const MaxApprovals: u32 = 100;521}522523impl pallet_treasury::Config for Runtime {524	type PalletId = TreasuryModuleId;525	type Currency = Balances;526	type ApproveOrigin = EnsureRoot<AccountId>;527	type RejectOrigin = EnsureRoot<AccountId>;528	type Event = Event;529	type OnSlash = ();530	type ProposalBond = ProposalBond;531	type ProposalBondMinimum = ProposalBondMinimum;532	type ProposalBondMaximum = ProposalBondMaximum;533	type SpendPeriod = SpendPeriod;534	type Burn = Burn;535	type BurnDestination = ();536	type SpendFunds = ();537	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;538	type MaxApprovals = MaxApprovals;539}540541impl pallet_sudo::Config for Runtime {542	type Event = Event;543	type Call = Call;544}545546pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);547548impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider549	for RelayChainBlockNumberProvider<T>550{551	type BlockNumber = BlockNumber;552553	fn current_block_number() -> Self::BlockNumber {554		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()555			.map(|d| d.relay_parent_number)556			.unwrap_or_default()557	}558}559560parameter_types! {561	pub const MinVestedTransfer: Balance = 10 * UNIQUE;562	pub const MaxVestingSchedules: u32 = 28;563}564565impl orml_vesting::Config for Runtime {566	type Event = Event;567	type Currency = pallet_balances::Pallet<Runtime>;568	type MinVestedTransfer = MinVestedTransfer;569	type VestedTransferOrigin = EnsureSigned<AccountId>;570	type WeightInfo = ();571	type MaxVestingSchedules = MaxVestingSchedules;572	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;573}574575parameter_types! {576	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;577	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;578}579580impl cumulus_pallet_parachain_system::Config for Runtime {581	type Event = Event;582	type SelfParaId = parachain_info::Pallet<Self>;583	type OnSystemEvent = ();584	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<585	// 	MaxDownwardMessageWeight,586	// 	XcmExecutor<XcmConfig>,587	// 	Call,588	// >;589	type OutboundXcmpMessageSource = XcmpQueue;590	type DmpMessageHandler = DmpQueue;591	type ReservedDmpWeight = ReservedDmpWeight;592	type ReservedXcmpWeight = ReservedXcmpWeight;593	type XcmpMessageHandler = XcmpQueue;594}595596impl parachain_info::Config for Runtime {}597598impl cumulus_pallet_aura_ext::Config for Runtime {}599600parameter_types! {601	pub const RelayLocation: MultiLocation = MultiLocation::parent();602	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;603	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();604	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();605}606607/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used608/// when determining ownership of accounts for asset transacting and when attempting to use XCM609/// `Transact` in order to determine the dispatch Origin.610pub type LocationToAccountId = (611	// The parent (Relay-chain) origin converts to the default `AccountId`.612	ParentIsPreset<AccountId>,613	// Sibling parachain origins convert to AccountId via the `ParaId::into`.614	SiblingParachainConvertsVia<Sibling, AccountId>,615	// Straight up local `AccountId32` origins just alias directly to `AccountId`.616	AccountId32Aliases<RelayNetwork, AccountId>,617);618619pub struct OnlySelfCurrency;620impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {621	fn matches_fungible(a: &MultiAsset) -> Option<B> {622		match (&a.id, &a.fun) {623			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),624			_ => None,625		}626	}627}628629/// Means for transacting assets on this chain.630pub type LocalAssetTransactor = CurrencyAdapter<631	// Use this currency:632	Balances,633	// Use this currency when it is a fungible asset matching the given location or name:634	OnlySelfCurrency,635	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:636	LocationToAccountId,637	// Our chain's account ID type (we can't get away without mentioning it explicitly):638	AccountId,639	// We don't track any teleports.640	(),641>;642643/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,644/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can645/// biases the kind of local `Origin` it will become.646pub type XcmOriginToTransactDispatchOrigin = (647	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location648	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for649	// foreign chains who want to have a local sovereign account on this chain which they control.650	SovereignSignedViaLocation<LocationToAccountId, Origin>,651	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when652	// recognised.653	RelayChainAsNative<RelayOrigin, Origin>,654	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when655	// recognised.656	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,657	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a658	// transaction from the Root origin.659	ParentAsSuperuser<Origin>,660	// Native signed account converter; this just converts an `AccountId32` origin into a normal661	// `Origin::Signed` origin of the same 32-byte value.662	SignedAccountId32AsNative<RelayNetwork, Origin>,663	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.664	XcmPassthrough<Origin>,665);666667parameter_types! {668	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.669	pub UnitWeightCost: Weight = 1_000_000;670	// 1200 UNIQUEs buy 1 second of weight.671	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);672	pub const MaxInstructions: u32 = 100;673	pub const MaxAuthorities: u32 = 100_000;674}675676match_types! {677	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {678		MultiLocation { parents: 1, interior: Here } |679		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }680	};681}682683pub type Barrier = (684	TakeWeightCredit,685	AllowTopLevelPaidExecutionFrom<Everything>,686	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,687	// ^^^ Parent & its unit plurality gets free execution688);689690pub struct UsingOnlySelfCurrencyComponents<691	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,692	AssetId: Get<MultiLocation>,693	AccountId,694	Currency: CurrencyT<AccountId>,695	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,696>(697	Weight,698	Currency::Balance,699	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,700);701impl<702		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,703		AssetId: Get<MultiLocation>,704		AccountId,705		Currency: CurrencyT<AccountId>,706		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,707	> WeightTrader708	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>709{710	fn new() -> Self {711		Self(0, Zero::zero(), PhantomData)712	}713714	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {715		let amount = WeightToFee::calc(&weight);716		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;717718		// location to this parachain through relay chain719		let option1: xcm::v1::AssetId = Concrete(MultiLocation {720			parents: 1,721			interior: X1(Parachain(ParachainInfo::parachain_id().into())),722		});723		// direct location724		let option2: xcm::v1::AssetId = Concrete(MultiLocation {725			parents: 0,726			interior: Here,727		});728729		let required = if payment.fungible.contains_key(&option1) {730			(option1, u128_amount).into()731		} else if payment.fungible.contains_key(&option2) {732			(option2, u128_amount).into()733		} else {734			(Concrete(MultiLocation::default()), u128_amount).into()735		};736737		let unused = payment738			.checked_sub(required)739			.map_err(|_| XcmError::TooExpensive)?;740		self.0 = self.0.saturating_add(weight);741		self.1 = self.1.saturating_add(amount);742		Ok(unused)743	}744745	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {746		let weight = weight.min(self.0);747		let amount = WeightToFee::calc(&weight);748		self.0 -= weight;749		self.1 = self.1.saturating_sub(amount);750		let amount: u128 = amount.saturated_into();751		if amount > 0 {752			Some((AssetId::get(), amount).into())753		} else {754			None755		}756	}757}758impl<759		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,760		AssetId: Get<MultiLocation>,761		AccountId,762		Currency: CurrencyT<AccountId>,763		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,764	> Drop765	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>766{767	fn drop(&mut self) {768		OnUnbalanced::on_unbalanced(Currency::issue(self.1));769	}770}771772pub struct XcmConfig;773impl Config for XcmConfig {774	type Call = Call;775	type XcmSender = XcmRouter;776	// How to withdraw and deposit an asset.777	type AssetTransactor = LocalAssetTransactor;778	type OriginConverter = XcmOriginToTransactDispatchOrigin;779	type IsReserve = NativeAsset;780	type IsTeleporter = (); // Teleportation is disabled781	type LocationInverter = LocationInverter<Ancestry>;782	type Barrier = Barrier;783	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;784	type Trader = UsingOnlySelfCurrencyComponents<785		IdentityFee<Balance>,786		RelayLocation,787		AccountId,788		Balances,789		(),790	>;791	type ResponseHandler = (); // Don't handle responses for now.792	type SubscriptionService = PolkadotXcm;793794	type AssetTrap = PolkadotXcm;795	type AssetClaims = PolkadotXcm;796}797798// parameter_types! {799// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;800// }801802/// No local origins on this chain are allowed to dispatch XCM sends/executions.803pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);804805/// The means for routing XCM messages which are not for local execution into the right message806/// queues.807pub type XcmRouter = (808	// Two routers - use UMP to communicate with the relay chain:809	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,810	// ..and XCMP to communicate with the sibling chains.811	XcmpQueue,812);813814impl pallet_evm_coder_substrate::Config for Runtime {815	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;816	type GasWeightMapping = FixedGasWeightMapping;817}818819impl pallet_xcm::Config for Runtime {820	type Event = Event;821	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;822	type XcmRouter = XcmRouter;823	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;824	type XcmExecuteFilter = Everything;825	type XcmExecutor = XcmExecutor<XcmConfig>;826	type XcmTeleportFilter = Everything;827	type XcmReserveTransferFilter = Everything;828	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;829	type LocationInverter = LocationInverter<Ancestry>;830	type Origin = Origin;831	type Call = Call;832	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;833	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;834}835836impl cumulus_pallet_xcm::Config for Runtime {837	type Event = Event;838	type XcmExecutor = XcmExecutor<XcmConfig>;839}840841impl cumulus_pallet_xcmp_queue::Config for Runtime {842	type WeightInfo = ();843	type Event = Event;844	type XcmExecutor = XcmExecutor<XcmConfig>;845	type ChannelInfo = ParachainSystem;846	type VersionWrapper = ();847	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;848	type ControllerOrigin = EnsureRoot<AccountId>;849	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;850}851852impl cumulus_pallet_dmp_queue::Config for Runtime {853	type Event = Event;854	type XcmExecutor = XcmExecutor<XcmConfig>;855	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;856}857858impl pallet_aura::Config for Runtime {859	type AuthorityId = AuraId;860	type DisabledValidators = ();861	type MaxAuthorities = MaxAuthorities;862}863864parameter_types! {865	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();866	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;867}868869impl pallet_common::Config for Runtime {870	type Event = Event;871	type Currency = Balances;872	type CollectionCreationPrice = CollectionCreationPrice;873	type TreasuryAccountId = TreasuryAccountId;874}875876impl pallet_fungible::Config for Runtime {877	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;878}879impl pallet_refungible::Config for Runtime {880	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;881}882impl pallet_nonfungible::Config for Runtime {883	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;884}885886impl pallet_unique::Config for Runtime {887	type Event = Event;888	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;889}890891parameter_types! {892	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied893}894895/// Used for the pallet inflation896impl pallet_inflation::Config for Runtime {897	type Currency = Balances;898	type TreasuryAccountId = TreasuryAccountId;899	type InflationBlockInterval = InflationBlockInterval;900	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;901}902903// parameter_types! {904// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *905// 		RuntimeBlockWeights::get().max_block;906// 	pub const MaxScheduledPerBlock: u32 = 50;907// }908909type EvmSponsorshipHandler = (910	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,911	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,912);913type SponsorshipHandler = (914	pallet_unique::UniqueSponsorshipHandler<Runtime>,915	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,916	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,917);918919// impl pallet_unq_scheduler::Config for Runtime {920// 	type Event = Event;921// 	type Origin = Origin;922// 	type PalletsOrigin = OriginCaller;923// 	type Call = Call;924// 	type MaximumWeight = MaximumSchedulerWeight;925// 	type ScheduleOrigin = EnsureSigned<AccountId>;926// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;927// 	type SponsorshipHandler = SponsorshipHandler;928// 	type WeightInfo = ();929// }930931impl pallet_evm_transaction_payment::Config for Runtime {932	type EvmSponsorshipHandler = EvmSponsorshipHandler;933	type Currency = Balances;934}935936impl pallet_charge_transaction::Config for Runtime {937	type SponsorshipHandler = SponsorshipHandler;938}939940// impl pallet_contract_helpers::Config for Runtime {941//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;942// }943944parameter_types! {945	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049946	pub const HelpersContractAddress: H160 = H160([947		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,948	]);949}950951impl pallet_evm_contract_helpers::Config for Runtime {952	type ContractAddress = HelpersContractAddress;953	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;954}955956construct_runtime!(957	pub enum Runtime where958		Block = Block,959		NodeBlock = opaque::Block,960		UncheckedExtrinsic = UncheckedExtrinsic961	{962		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,963		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,964965		Aura: pallet_aura::{Pallet, Config<T>} = 22,966		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,967968		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,969		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,970		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,971		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,972		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,973		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,974		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,975		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,976		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,977		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,978979		// XCM helpers.980		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,981		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,982		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,983		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,984985		// Unique Pallets986		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,987		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,988		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,989		// free = 63990		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,991		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,992		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,993		Fungible: pallet_fungible::{Pallet, Storage} = 67,994		Refungible: pallet_refungible::{Pallet, Storage} = 68,995		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,996997		// Frontier998		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,999		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,10001001		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,1002		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1003		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1004		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1005	}1006);10071008pub struct TransactionConverter;10091010impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {1011	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {1012		UncheckedExtrinsic::new_unsigned(1013			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1014		)1015	}1016}10171018impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1019	fn convert_transaction(1020		&self,1021		transaction: pallet_ethereum::Transaction,1022	) -> opaque::UncheckedExtrinsic {1023		let extrinsic = UncheckedExtrinsic::new_unsigned(1024			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1025		);1026		let encoded = extrinsic.encode();1027		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1028			.expect("Encoded extrinsic is always valid")1029	}1030}10311032/// The address format for describing accounts.1033pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1034/// Block header type as expected by this runtime.1035pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1036/// Block type as expected by this runtime.1037pub type Block = generic::Block<Header, UncheckedExtrinsic>;1038/// A Block signed with a Justification1039pub type SignedBlock = generic::SignedBlock<Block>;1040/// BlockId type as expected by this runtime.1041pub type BlockId = generic::BlockId<Block>;1042/// The SignedExtension to the basic transaction logic.1043pub type SignedExtra = (1044	frame_system::CheckSpecVersion<Runtime>,1045	// system::CheckTxVersion<Runtime>,1046	frame_system::CheckGenesis<Runtime>,1047	frame_system::CheckEra<Runtime>,1048	frame_system::CheckNonce<Runtime>,1049	frame_system::CheckWeight<Runtime>,1050	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1051	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,1052);1053/// Unchecked extrinsic type as expected by this runtime.1054pub type UncheckedExtrinsic =1055	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1056/// Extrinsic type that has already been checked.1057pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1058/// Executive: handles dispatch to the various modules.1059pub type Executive = frame_executive::Executive<1060	Runtime,1061	Block,1062	frame_system::ChainContext<Runtime>,1063	Runtime,1064	AllPalletsReversedWithSystemFirst,1065>;10661067impl_opaque_keys! {1068	pub struct SessionKeys {1069		pub aura: Aura,1070	}1071}10721073impl fp_self_contained::SelfContainedCall for Call {1074	type SignedInfo = H160;10751076	fn is_self_contained(&self) -> bool {1077		match self {1078			Call::Ethereum(call) => call.is_self_contained(),1079			_ => false,1080		}1081	}10821083	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1084		match self {1085			Call::Ethereum(call) => call.check_self_contained(),1086			_ => None,1087		}1088	}10891090	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1091		match self {1092			Call::Ethereum(call) => call.validate_self_contained(info),1093			_ => None,1094		}1095	}10961097	fn pre_dispatch_self_contained(1098		&self,1099		info: &Self::SignedInfo,1100	) -> Option<Result<(), TransactionValidityError>> {1101		match self {1102			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1103			_ => None,1104		}1105	}11061107	fn apply_self_contained(1108		self,1109		info: Self::SignedInfo,1110	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1111		match self {1112			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1113				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1114			)),1115			_ => None,1116		}1117	}1118}11191120macro_rules! dispatch_unique_runtime {1121	($collection:ident.$method:ident($($name:ident),*)) => {{1122		use pallet_unique::dispatch::Dispatched;11231124		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1125		let dispatch = collection.as_dyn();11261127		Ok(dispatch.$method($($name),*))1128	}};1129}11301131impl_common_runtime_apis!();11321133struct CheckInherents;11341135impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1136	fn check_inherents(1137		block: &Block,1138		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1139	) -> sp_inherents::CheckInherentsResult {1140		let relay_chain_slot = relay_state_proof1141			.read_slot()1142			.expect("Could not read the relay chain slot from the proof");11431144		let inherent_data =1145			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1146				relay_chain_slot,1147				sp_std::time::Duration::from_secs(6),1148			)1149			.create_inherent_data()1150			.expect("Could not create the timestamp inherent data");11511152		inherent_data.check_extrinsics(block)1153	}1154}11551156cumulus_pallet_parachain_system::register_validate_block!(1157	Runtime = Runtime,1158	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1159	CheckInherents = CheckInherents,1160);
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::{52	EnsureAddressTruncated, HashedAddressMapping, Runner, account::CrossAccountId as _,53};54pub use frame_support::{55	construct_runtime, match_types,56	dispatch::DispatchResult,57	PalletId, parameter_types, StorageValue, ConsensusEngineId,58	traits::{59		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,60		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,61		OnUnbalanced, Randomness, FindAuthor,62	},63	weights::{64		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},65		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,66		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,67	},68};69use up_data_structs::*;70// use pallet_contracts::weights::WeightInfo;71// #[cfg(any(feature = "std", test))]72use frame_system::{73	self as frame_system, EnsureRoot, EnsureSigned,74	limits::{BlockWeights, BlockLength},75};76use sp_arithmetic::{77	traits::{BaseArithmetic, Unsigned},78};79use smallvec::smallvec;80use codec::{Encode, Decode};81use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping};82use fp_rpc::TransactionStatus;83use sp_runtime::{84	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},85	transaction_validity::TransactionValidityError,86	SaturatedConversion,87};8889// pub use pallet_timestamp::Call as TimestampCall;90pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;9192// Polkadot imports93use pallet_xcm::XcmPassthrough;94use polkadot_parachain::primitives::Sibling;95use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};96use xcm_builder::{97	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,98	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,99	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,100	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,101	ParentIsPreset,102};103use xcm_executor::{Config, XcmExecutor, Assets};104use sp_std::{marker::PhantomData};105106use xcm::latest::{107	//	Xcm,108	AssetId::{Concrete},109	Fungibility::Fungible as XcmFungible,110	MultiAsset,111	Error as XcmError,112};113use xcm_executor::traits::{MatchesFungible, WeightTrader};114//use xcm_executor::traits::MatchesFungible;115use sp_runtime::traits::CheckedConversion;116117use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};118119pub const RUNTIME_NAME: &str = "opal";120pub const TOKEN_SYMBOL: &str = "OPL";121122type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;123124impl RuntimeInstance for Runtime {125	type CrossAccountId = self::CrossAccountId;126	type TransactionConverter = self::TransactionConverter;127128	fn get_transaction_converter() -> TransactionConverter {129		TransactionConverter130	}131}132133/// The type for looking up accounts. We don't expect more than 4 billion of them, but you134/// never know...135pub type AccountIndex = u32;136137/// Balance of an account.138pub type Balance = u128;139140/// Index of a transaction in the chain.141pub type Index = u32;142143/// A hash of some data used by the chain.144pub type Hash = sp_core::H256;145146/// Digest item type.147pub type DigestItem = generic::DigestItem;148149/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know150/// the specifics of the runtime. They can then be made to be agnostic over specific formats151/// of data like extrinsics, allowing for them to continue syncing the network through upgrades152/// to even the core data structures.153pub mod opaque {154	use sp_std::prelude::*;155	use sp_runtime::impl_opaque_keys;156	use super::Aura;157158	pub use unique_runtime_common::types::*;159160	impl_opaque_keys! {161		pub struct SessionKeys {162			pub aura: Aura,163		}164	}165}166167/// This runtime version.168pub const VERSION: RuntimeVersion = RuntimeVersion {169	spec_name: create_runtime_str!(RUNTIME_NAME),170	impl_name: create_runtime_str!(RUNTIME_NAME),171	authoring_version: 1,172	spec_version: 921000,173	impl_version: 0,174	apis: RUNTIME_API_VERSIONS,175	transaction_version: 1,176	state_version: 0,177};178179#[derive(codec::Encode, codec::Decode)]180pub enum XCMPMessage<XAccountId, XBalance> {181	/// Transfer tokens to the given account from the Parachain account.182	TransferToken(XAccountId, XBalance),183}184185/// The version information used to identify this runtime when compiled natively.186#[cfg(feature = "std")]187pub fn native_version() -> NativeVersion {188	NativeVersion {189		runtime_version: VERSION,190		can_author_with: Default::default(),191	}192}193194type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;195196pub struct DealWithFees;197impl OnUnbalanced<NegativeImbalance> for DealWithFees {198	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {199		if let Some(fees) = fees_then_tips.next() {200			// for fees, 100% to treasury201			let mut split = fees.ration(100, 0);202			if let Some(tips) = fees_then_tips.next() {203				// for tips, if any, 100% to treasury204				tips.ration_merge_into(100, 0, &mut split);205			}206			Treasury::on_unbalanced(split.0);207			// Author::on_unbalanced(split.1);208		}209	}210}211212parameter_types! {213	pub const BlockHashCount: BlockNumber = 2400;214	pub RuntimeBlockLength: BlockLength =215		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);216	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);217	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;218	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()219		.base_block(BlockExecutionWeight::get())220		.for_class(DispatchClass::all(), |weights| {221			weights.base_extrinsic = ExtrinsicBaseWeight::get();222		})223		.for_class(DispatchClass::Normal, |weights| {224			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);225		})226		.for_class(DispatchClass::Operational, |weights| {227			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);228			// Operational transactions have some extra reserved space, so that they229			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.230			weights.reserved = Some(231				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT232			);233		})234		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)235		.build_or_panic();236	pub const Version: RuntimeVersion = VERSION;237	pub const SS58Prefix: u8 = 42;238}239240parameter_types! {241	pub const ChainId: u64 = 8882;242}243244pub struct FixedFee;245impl FeeCalculator for FixedFee {246	fn min_gas_price() -> U256 {247		MIN_GAS_PRICE.into()248	}249}250251// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case252// (contract, which only writes a lot of data),253// approximating on top of our real store write weight254parameter_types! {255	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;256	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;257	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();258}259260/// Limiting EVM execution to 50% of block for substrate users and management tasks261/// EVM transaction consumes more weight than substrate's, so we can't rely on them being262/// scheduled fairly263const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);264parameter_types! {265	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());266}267268pub enum FixedGasWeightMapping {}269impl GasWeightMapping for FixedGasWeightMapping {270	fn gas_to_weight(gas: u64) -> Weight {271		gas.saturating_mul(WeightPerGas::get())272	}273	fn weight_to_gas(weight: Weight) -> u64 {274		weight / WeightPerGas::get()275	}276}277278impl pallet_evm::account::Config for Runtime {279	type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Self>;280	type EvmAddressMapping = pallet_evm::HashedAddressMapping<Self::Hashing>;281	type EvmBackwardsAddressMapping = fp_evm_mapping::MapBackwardsAddressTruncated;282}283284impl pallet_evm::Config for Runtime {285	type BlockGasLimit = BlockGasLimit;286	type FeeCalculator = FixedFee;287	type GasWeightMapping = FixedGasWeightMapping;288	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;289	type CallOrigin = EnsureAddressTruncated<Self>;290	type WithdrawOrigin = EnsureAddressTruncated<Self>;291	type AddressMapping = HashedAddressMapping<Self::Hashing>;292	type PrecompilesType = ();293	type PrecompilesValue = ();294	type Currency = Balances;295	type Event = Event;296	type OnMethodCall = (297		pallet_evm_migration::OnMethodCall<Self>,298		pallet_unique::UniqueErcSupport<Self>,299		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,300	);301	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;302	type ChainId = ChainId;303	type Runner = pallet_evm::runner::stack::Runner<Self>;304	type OnChargeTransaction = pallet_evm::EVMCurrencyAdapter<Balances, DealWithFees>;305	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;306	type FindAuthor = EthereumFindAuthor<Aura>;307}308309impl pallet_evm_migration::Config for Runtime {310	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;311}312313pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);314impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {315	fn find_author<'a, I>(digests: I) -> Option<H160>316	where317		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,318	{319		if let Some(author_index) = F::find_author(digests) {320			let authority_id = Aura::authorities()[author_index as usize].clone();321			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));322		}323		None324	}325}326327impl pallet_ethereum::Config for Runtime {328	type Event = Event;329	type StateRoot = pallet_ethereum::IntermediateStateRoot<Self>;330}331332impl pallet_randomness_collective_flip::Config for Runtime {}333334impl frame_system::Config for Runtime {335	/// The data to be stored in an account.336	type AccountData = pallet_balances::AccountData<Balance>;337	/// The identifier used to distinguish between accounts.338	type AccountId = AccountId;339	/// The basic call filter to use in dispatchable.340	type BaseCallFilter = Everything;341	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).342	type BlockHashCount = BlockHashCount;343	/// The maximum length of a block (in bytes).344	type BlockLength = RuntimeBlockLength;345	/// The index type for blocks.346	type BlockNumber = BlockNumber;347	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.348	type BlockWeights = RuntimeBlockWeights;349	/// The aggregated dispatch type that is available for extrinsics.350	type Call = Call;351	/// The weight of database operations that the runtime can invoke.352	type DbWeight = RocksDbWeight;353	/// The ubiquitous event type.354	type Event = Event;355	/// The type for hashing blocks and tries.356	type Hash = Hash;357	/// The hashing algorithm used.358	type Hashing = BlakeTwo256;359	/// The header type.360	type Header = generic::Header<BlockNumber, BlakeTwo256>;361	/// The index type for storing how many extrinsics an account has signed.362	type Index = Index;363	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.364	type Lookup = AccountIdLookup<AccountId, ()>;365	/// What to do if an account is fully reaped from the system.366	type OnKilledAccount = ();367	/// What to do if a new account is created.368	type OnNewAccount = ();369	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;370	/// The ubiquitous origin type.371	type Origin = Origin;372	/// This type is being generated by `construct_runtime!`.373	type PalletInfo = PalletInfo;374	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.375	type SS58Prefix = SS58Prefix;376	/// Weight information for the extrinsics of this pallet.377	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;378	/// Version of the runtime.379	type Version = Version;380	type MaxConsumers = ConstU32<16>;381}382383parameter_types! {384	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;385}386387impl pallet_timestamp::Config for Runtime {388	/// A timestamp: milliseconds since the unix epoch.389	type Moment = u64;390	type OnTimestampSet = ();391	type MinimumPeriod = MinimumPeriod;392	type WeightInfo = ();393}394395parameter_types! {396	// pub const ExistentialDeposit: u128 = 500;397	pub const ExistentialDeposit: u128 = 0;398	pub const MaxLocks: u32 = 50;399}400401impl pallet_balances::Config for Runtime {402	type MaxLocks = MaxLocks;403	type MaxReserves = ();404	type ReserveIdentifier = [u8; 8];405	/// The type for recording an account's balance.406	type Balance = Balance;407	/// The ubiquitous event type.408	type Event = Event;409	type DustRemoval = Treasury;410	type ExistentialDeposit = ExistentialDeposit;411	type AccountStore = System;412	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;413}414415pub const fn deposit(items: u32, bytes: u32) -> Balance {416	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE417}418419/*420parameter_types! {421	pub TombstoneDeposit: Balance = deposit(422		1,423		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,424	);425	pub DepositPerContract: Balance = TombstoneDeposit::get();426	pub const DepositPerStorageByte: Balance = deposit(0, 1);427	pub const DepositPerStorageItem: Balance = deposit(1, 0);428	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);429	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;430	pub const SignedClaimHandicap: u32 = 2;431	pub const MaxDepth: u32 = 32;432	pub const MaxValueSize: u32 = 16 * 1024;433	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb434	// The lazy deletion runs inside on_initialize.435	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *436		RuntimeBlockWeights::get().max_block;437	// The weight needed for decoding the queue should be less or equal than a fifth438	// of the overall weight dedicated to the lazy deletion.439	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (440			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -441			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)442		)) / 5) as u32;443	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();444}445446impl pallet_contracts::Config for Runtime {447	type Time = Timestamp;448	type Randomness = RandomnessCollectiveFlip;449	type Currency = Balances;450	type Event = Event;451	type RentPayment = ();452	type SignedClaimHandicap = SignedClaimHandicap;453	type TombstoneDeposit = TombstoneDeposit;454	type DepositPerContract = DepositPerContract;455	type DepositPerStorageByte = DepositPerStorageByte;456	type DepositPerStorageItem = DepositPerStorageItem;457	type RentFraction = RentFraction;458	type SurchargeReward = SurchargeReward;459	type WeightPrice = pallet_transaction_payment::Pallet<Self>;460	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;461	type ChainExtension = NFTExtension;462	type DeletionQueueDepth = DeletionQueueDepth;463	type DeletionWeightLimit = DeletionWeightLimit;464	type Schedule = Schedule;465	type CallStack = [pallet_contracts::Frame<Self>; 31];466}467*/468469parameter_types! {470	/// This value increases the priority of `Operational` transactions by adding471	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.472	pub const OperationalFeeMultiplier: u8 = 5;473}474475/// Linear implementor of `WeightToFeePolynomial`476pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);477478impl<T> WeightToFeePolynomial for LinearFee<T>479where480	T: BaseArithmetic + From<u32> + Copy + Unsigned,481{482	type Balance = T;483484	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {485		smallvec!(WeightToFeeCoefficient {486			// Targeting 0.1 Unique per NFT transfer487			coeff_integer: WEIGHT_TO_FEE_COEFF.into(),488			coeff_frac: Perbill::zero(),489			negative: false,490			degree: 1,491		})492	}493}494495impl pallet_transaction_payment::Config for Runtime {496	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;497	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;498	type OperationalFeeMultiplier = OperationalFeeMultiplier;499	type WeightToFee = LinearFee<Balance>;500	type FeeMultiplierUpdate = ();501}502503parameter_types! {504	pub const ProposalBond: Permill = Permill::from_percent(5);505	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;506	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;507	pub const SpendPeriod: BlockNumber = 5 * MINUTES;508	pub const Burn: Permill = Permill::from_percent(0);509	pub const TipCountdown: BlockNumber = 1 * DAYS;510	pub const TipFindersFee: Percent = Percent::from_percent(20);511	pub const TipReportDepositBase: Balance = 1 * UNIQUE;512	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;513	pub const BountyDepositBase: Balance = 1 * UNIQUE;514	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;515	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");516	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;517	pub const MaximumReasonLength: u32 = 16384;518	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);519	pub const BountyValueMinimum: Balance = 5 * UNIQUE;520	pub const MaxApprovals: u32 = 100;521}522523impl pallet_treasury::Config for Runtime {524	type PalletId = TreasuryModuleId;525	type Currency = Balances;526	type ApproveOrigin = EnsureRoot<AccountId>;527	type RejectOrigin = EnsureRoot<AccountId>;528	type Event = Event;529	type OnSlash = ();530	type ProposalBond = ProposalBond;531	type ProposalBondMinimum = ProposalBondMinimum;532	type ProposalBondMaximum = ProposalBondMaximum;533	type SpendPeriod = SpendPeriod;534	type Burn = Burn;535	type BurnDestination = ();536	type SpendFunds = ();537	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;538	type MaxApprovals = MaxApprovals;539}540541impl pallet_sudo::Config for Runtime {542	type Event = Event;543	type Call = Call;544}545546pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);547548impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider549	for RelayChainBlockNumberProvider<T>550{551	type BlockNumber = BlockNumber;552553	fn current_block_number() -> Self::BlockNumber {554		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()555			.map(|d| d.relay_parent_number)556			.unwrap_or_default()557	}558}559560parameter_types! {561	pub const MinVestedTransfer: Balance = 10 * UNIQUE;562	pub const MaxVestingSchedules: u32 = 28;563}564565impl orml_vesting::Config for Runtime {566	type Event = Event;567	type Currency = pallet_balances::Pallet<Runtime>;568	type MinVestedTransfer = MinVestedTransfer;569	type VestedTransferOrigin = EnsureSigned<AccountId>;570	type WeightInfo = ();571	type MaxVestingSchedules = MaxVestingSchedules;572	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;573}574575parameter_types! {576	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;577	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;578}579580impl cumulus_pallet_parachain_system::Config for Runtime {581	type Event = Event;582	type SelfParaId = parachain_info::Pallet<Self>;583	type OnSystemEvent = ();584	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<585	// 	MaxDownwardMessageWeight,586	// 	XcmExecutor<XcmConfig>,587	// 	Call,588	// >;589	type OutboundXcmpMessageSource = XcmpQueue;590	type DmpMessageHandler = DmpQueue;591	type ReservedDmpWeight = ReservedDmpWeight;592	type ReservedXcmpWeight = ReservedXcmpWeight;593	type XcmpMessageHandler = XcmpQueue;594}595596impl parachain_info::Config for Runtime {}597598impl cumulus_pallet_aura_ext::Config for Runtime {}599600parameter_types! {601	pub const RelayLocation: MultiLocation = MultiLocation::parent();602	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;603	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();604	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();605}606607/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used608/// when determining ownership of accounts for asset transacting and when attempting to use XCM609/// `Transact` in order to determine the dispatch Origin.610pub type LocationToAccountId = (611	// The parent (Relay-chain) origin converts to the default `AccountId`.612	ParentIsPreset<AccountId>,613	// Sibling parachain origins convert to AccountId via the `ParaId::into`.614	SiblingParachainConvertsVia<Sibling, AccountId>,615	// Straight up local `AccountId32` origins just alias directly to `AccountId`.616	AccountId32Aliases<RelayNetwork, AccountId>,617);618619pub struct OnlySelfCurrency;620impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {621	fn matches_fungible(a: &MultiAsset) -> Option<B> {622		match (&a.id, &a.fun) {623			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),624			_ => None,625		}626	}627}628629/// Means for transacting assets on this chain.630pub type LocalAssetTransactor = CurrencyAdapter<631	// Use this currency:632	Balances,633	// Use this currency when it is a fungible asset matching the given location or name:634	OnlySelfCurrency,635	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:636	LocationToAccountId,637	// Our chain's account ID type (we can't get away without mentioning it explicitly):638	AccountId,639	// We don't track any teleports.640	(),641>;642643/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,644/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can645/// biases the kind of local `Origin` it will become.646pub type XcmOriginToTransactDispatchOrigin = (647	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location648	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for649	// foreign chains who want to have a local sovereign account on this chain which they control.650	SovereignSignedViaLocation<LocationToAccountId, Origin>,651	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when652	// recognised.653	RelayChainAsNative<RelayOrigin, Origin>,654	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when655	// recognised.656	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,657	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a658	// transaction from the Root origin.659	ParentAsSuperuser<Origin>,660	// Native signed account converter; this just converts an `AccountId32` origin into a normal661	// `Origin::Signed` origin of the same 32-byte value.662	SignedAccountId32AsNative<RelayNetwork, Origin>,663	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.664	XcmPassthrough<Origin>,665);666667parameter_types! {668	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.669	pub UnitWeightCost: Weight = 1_000_000;670	// 1200 UNIQUEs buy 1 second of weight.671	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);672	pub const MaxInstructions: u32 = 100;673	pub const MaxAuthorities: u32 = 100_000;674}675676match_types! {677	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {678		MultiLocation { parents: 1, interior: Here } |679		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }680	};681}682683pub type Barrier = (684	TakeWeightCredit,685	AllowTopLevelPaidExecutionFrom<Everything>,686	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,687	// ^^^ Parent & its unit plurality gets free execution688);689690pub struct UsingOnlySelfCurrencyComponents<691	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,692	AssetId: Get<MultiLocation>,693	AccountId,694	Currency: CurrencyT<AccountId>,695	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,696>(697	Weight,698	Currency::Balance,699	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,700);701impl<702		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,703		AssetId: Get<MultiLocation>,704		AccountId,705		Currency: CurrencyT<AccountId>,706		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,707	> WeightTrader708	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>709{710	fn new() -> Self {711		Self(0, Zero::zero(), PhantomData)712	}713714	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {715		let amount = WeightToFee::calc(&weight);716		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;717718		// location to this parachain through relay chain719		let option1: xcm::v1::AssetId = Concrete(MultiLocation {720			parents: 1,721			interior: X1(Parachain(ParachainInfo::parachain_id().into())),722		});723		// direct location724		let option2: xcm::v1::AssetId = Concrete(MultiLocation {725			parents: 0,726			interior: Here,727		});728729		let required = if payment.fungible.contains_key(&option1) {730			(option1, u128_amount).into()731		} else if payment.fungible.contains_key(&option2) {732			(option2, u128_amount).into()733		} else {734			(Concrete(MultiLocation::default()), u128_amount).into()735		};736737		let unused = payment738			.checked_sub(required)739			.map_err(|_| XcmError::TooExpensive)?;740		self.0 = self.0.saturating_add(weight);741		self.1 = self.1.saturating_add(amount);742		Ok(unused)743	}744745	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {746		let weight = weight.min(self.0);747		let amount = WeightToFee::calc(&weight);748		self.0 -= weight;749		self.1 = self.1.saturating_sub(amount);750		let amount: u128 = amount.saturated_into();751		if amount > 0 {752			Some((AssetId::get(), amount).into())753		} else {754			None755		}756	}757}758impl<759		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,760		AssetId: Get<MultiLocation>,761		AccountId,762		Currency: CurrencyT<AccountId>,763		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,764	> Drop765	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>766{767	fn drop(&mut self) {768		OnUnbalanced::on_unbalanced(Currency::issue(self.1));769	}770}771772pub struct XcmConfig;773impl Config for XcmConfig {774	type Call = Call;775	type XcmSender = XcmRouter;776	// How to withdraw and deposit an asset.777	type AssetTransactor = LocalAssetTransactor;778	type OriginConverter = XcmOriginToTransactDispatchOrigin;779	type IsReserve = NativeAsset;780	type IsTeleporter = (); // Teleportation is disabled781	type LocationInverter = LocationInverter<Ancestry>;782	type Barrier = Barrier;783	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;784	type Trader = UsingOnlySelfCurrencyComponents<785		IdentityFee<Balance>,786		RelayLocation,787		AccountId,788		Balances,789		(),790	>;791	type ResponseHandler = (); // Don't handle responses for now.792	type SubscriptionService = PolkadotXcm;793794	type AssetTrap = PolkadotXcm;795	type AssetClaims = PolkadotXcm;796}797798// parameter_types! {799// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;800// }801802/// No local origins on this chain are allowed to dispatch XCM sends/executions.803pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);804805/// The means for routing XCM messages which are not for local execution into the right message806/// queues.807pub type XcmRouter = (808	// Two routers - use UMP to communicate with the relay chain:809	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,810	// ..and XCMP to communicate with the sibling chains.811	XcmpQueue,812);813814impl pallet_evm_coder_substrate::Config for Runtime {815	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;816	type GasWeightMapping = FixedGasWeightMapping;817}818819impl pallet_xcm::Config for Runtime {820	type Event = Event;821	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;822	type XcmRouter = XcmRouter;823	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;824	type XcmExecuteFilter = Everything;825	type XcmExecutor = XcmExecutor<XcmConfig>;826	type XcmTeleportFilter = Everything;827	type XcmReserveTransferFilter = Everything;828	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;829	type LocationInverter = LocationInverter<Ancestry>;830	type Origin = Origin;831	type Call = Call;832	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;833	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;834}835836impl cumulus_pallet_xcm::Config for Runtime {837	type Event = Event;838	type XcmExecutor = XcmExecutor<XcmConfig>;839}840841impl cumulus_pallet_xcmp_queue::Config for Runtime {842	type WeightInfo = ();843	type Event = Event;844	type XcmExecutor = XcmExecutor<XcmConfig>;845	type ChannelInfo = ParachainSystem;846	type VersionWrapper = ();847	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;848	type ControllerOrigin = EnsureRoot<AccountId>;849	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;850}851852impl cumulus_pallet_dmp_queue::Config for Runtime {853	type Event = Event;854	type XcmExecutor = XcmExecutor<XcmConfig>;855	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;856}857858impl pallet_aura::Config for Runtime {859	type AuthorityId = AuraId;860	type DisabledValidators = ();861	type MaxAuthorities = MaxAuthorities;862}863864parameter_types! {865	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();866	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;867}868869impl pallet_common::Config for Runtime {870	type Event = Event;871	type Currency = Balances;872	type CollectionCreationPrice = CollectionCreationPrice;873	type TreasuryAccountId = TreasuryAccountId;874}875876impl pallet_fungible::Config for Runtime {877	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;878}879impl pallet_refungible::Config for Runtime {880	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;881}882impl pallet_nonfungible::Config for Runtime {883	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;884}885886impl pallet_unique::Config for Runtime {887	type Event = Event;888	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;889}890891parameter_types! {892	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied893}894895/// Used for the pallet inflation896impl pallet_inflation::Config for Runtime {897	type Currency = Balances;898	type TreasuryAccountId = TreasuryAccountId;899	type InflationBlockInterval = InflationBlockInterval;900	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;901}902903// parameter_types! {904// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *905// 		RuntimeBlockWeights::get().max_block;906// 	pub const MaxScheduledPerBlock: u32 = 50;907// }908909type EvmSponsorshipHandler = (910	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,911	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,912);913type SponsorshipHandler = (914	pallet_unique::UniqueSponsorshipHandler<Runtime>,915	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,916	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,917);918919// impl pallet_unq_scheduler::Config for Runtime {920// 	type Event = Event;921// 	type Origin = Origin;922// 	type PalletsOrigin = OriginCaller;923// 	type Call = Call;924// 	type MaximumWeight = MaximumSchedulerWeight;925// 	type ScheduleOrigin = EnsureSigned<AccountId>;926// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;927// 	type SponsorshipHandler = SponsorshipHandler;928// 	type WeightInfo = ();929// }930931impl pallet_evm_transaction_payment::Config for Runtime {932	type EvmSponsorshipHandler = EvmSponsorshipHandler;933	type Currency = Balances;934}935936impl pallet_charge_transaction::Config for Runtime {937	type SponsorshipHandler = SponsorshipHandler;938}939940// impl pallet_contract_helpers::Config for Runtime {941//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;942// }943944parameter_types! {945	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049946	pub const HelpersContractAddress: H160 = H160([947		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,948	]);949}950951impl pallet_evm_contract_helpers::Config for Runtime {952	type ContractAddress = HelpersContractAddress;953	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;954}955956construct_runtime!(957	pub enum Runtime where958		Block = Block,959		NodeBlock = opaque::Block,960		UncheckedExtrinsic = UncheckedExtrinsic961	{962		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,963		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,964965		Aura: pallet_aura::{Pallet, Config<T>} = 22,966		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,967968		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,969		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,970		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,971		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,972		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,973		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,974		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,975		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,976		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,977		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,978979		// XCM helpers.980		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,981		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,982		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,983		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,984985		// Unique Pallets986		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,987		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,988		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,989		// free = 63990		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,991		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,992		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,993		Fungible: pallet_fungible::{Pallet, Storage} = 67,994		Refungible: pallet_refungible::{Pallet, Storage} = 68,995		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,996997		// Frontier998		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,999		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,10001001		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,1002		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1003		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1004		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1005	}1006);10071008pub struct TransactionConverter;10091010impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {1011	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {1012		UncheckedExtrinsic::new_unsigned(1013			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1014		)1015	}1016}10171018impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1019	fn convert_transaction(1020		&self,1021		transaction: pallet_ethereum::Transaction,1022	) -> opaque::UncheckedExtrinsic {1023		let extrinsic = UncheckedExtrinsic::new_unsigned(1024			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1025		);1026		let encoded = extrinsic.encode();1027		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1028			.expect("Encoded extrinsic is always valid")1029	}1030}10311032/// The address format for describing accounts.1033pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1034/// Block header type as expected by this runtime.1035pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1036/// Block type as expected by this runtime.1037pub type Block = generic::Block<Header, UncheckedExtrinsic>;1038/// A Block signed with a Justification1039pub type SignedBlock = generic::SignedBlock<Block>;1040/// BlockId type as expected by this runtime.1041pub type BlockId = generic::BlockId<Block>;1042/// The SignedExtension to the basic transaction logic.1043pub type SignedExtra = (1044	frame_system::CheckSpecVersion<Runtime>,1045	// system::CheckTxVersion<Runtime>,1046	frame_system::CheckGenesis<Runtime>,1047	frame_system::CheckEra<Runtime>,1048	frame_system::CheckNonce<Runtime>,1049	frame_system::CheckWeight<Runtime>,1050	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1051	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,1052);1053/// Unchecked extrinsic type as expected by this runtime.1054pub type UncheckedExtrinsic =1055	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1056/// Extrinsic type that has already been checked.1057pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1058/// Executive: handles dispatch to the various modules.1059pub type Executive = frame_executive::Executive<1060	Runtime,1061	Block,1062	frame_system::ChainContext<Runtime>,1063	Runtime,1064	AllPalletsReversedWithSystemFirst,1065>;10661067impl_opaque_keys! {1068	pub struct SessionKeys {1069		pub aura: Aura,1070	}1071}10721073impl fp_self_contained::SelfContainedCall for Call {1074	type SignedInfo = H160;10751076	fn is_self_contained(&self) -> bool {1077		match self {1078			Call::Ethereum(call) => call.is_self_contained(),1079			_ => false,1080		}1081	}10821083	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1084		match self {1085			Call::Ethereum(call) => call.check_self_contained(),1086			_ => None,1087		}1088	}10891090	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1091		match self {1092			Call::Ethereum(call) => call.validate_self_contained(info),1093			_ => None,1094		}1095	}10961097	fn pre_dispatch_self_contained(1098		&self,1099		info: &Self::SignedInfo,1100	) -> Option<Result<(), TransactionValidityError>> {1101		match self {1102			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1103			_ => None,1104		}1105	}11061107	fn apply_self_contained(1108		self,1109		info: Self::SignedInfo,1110	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1111		match self {1112			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1113				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1114			)),1115			_ => None,1116		}1117	}1118}11191120macro_rules! dispatch_unique_runtime {1121	($collection:ident.$method:ident($($name:ident),*)) => {{1122		use pallet_unique::dispatch::Dispatched;11231124		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1125		let dispatch = collection.as_dyn();11261127		Ok(dispatch.$method($($name),*))1128	}};1129}11301131impl_common_runtime_apis!();11321133struct CheckInherents;11341135impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1136	fn check_inherents(1137		block: &Block,1138		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1139	) -> sp_inherents::CheckInherentsResult {1140		let relay_chain_slot = relay_state_proof1141			.read_slot()1142			.expect("Could not read the relay chain slot from the proof");11431144		let inherent_data =1145			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1146				relay_chain_slot,1147				sp_std::time::Duration::from_secs(6),1148			)1149			.create_inherent_data()1150			.expect("Could not create the timestamp inherent data");11511152		inherent_data.check_extrinsics(block)1153	}1154}11551156cumulus_pallet_parachain_system::register_validate_block!(1157	Runtime = Runtime,1158	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1159	CheckInherents = CheckInherents,1160);
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -10,7 +10,7 @@
 license = 'GPLv3'
 name = 'quartz-runtime'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.9.20'
+version = '0.9.21'
 
 [package.metadata.docs.rs]
 targets = ['x86_64-unknown-linux-gnu']
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -154,7 +154,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 920000,
+	spec_version: 921000,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -10,7 +10,7 @@
 license = 'GPLv3'
 name = 'unique-runtime'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.9.18'
+version = '0.9.21'
 
 [package.metadata.docs.rs]
 targets = ['x86_64-unknown-linux-gnu']
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -153,7 +153,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 920000,
+	spec_version: 921000,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,
modifiedtests/README.mddiffbeforeafterboth
--- a/tests/README.md
+++ b/tests/README.md
@@ -5,7 +5,7 @@
 1. Checkout polkadot in sibling folder with this project
 ```bash
 git clone https://github.com/paritytech/polkadot.git && cd polkadot
-git checkout release-v0.9.20
+git checkout release-v0.9.21
 ```
 
 2. Build with nightly-2021-11-11