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

difftreelog

Divide unique runtime: unique,quartz,opal

Daniel Shiposha2022-03-05parent: #d6336d8.patch.diff
in: master

18 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5194,6 +5194,82 @@
 checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
 
 [[package]]
+name = "opal-runtime"
+version = "0.1.0"
+dependencies = [
+ "cumulus-pallet-aura-ext",
+ "cumulus-pallet-dmp-queue",
+ "cumulus-pallet-parachain-system",
+ "cumulus-pallet-xcm",
+ "cumulus-pallet-xcmp-queue",
+ "cumulus-primitives-core",
+ "cumulus-primitives-timestamp",
+ "cumulus-primitives-utility",
+ "derivative",
+ "fp-rpc",
+ "fp-self-contained",
+ "frame-benchmarking",
+ "frame-executive",
+ "frame-support",
+ "frame-system",
+ "frame-system-benchmarking",
+ "frame-system-rpc-runtime-api",
+ "hex-literal",
+ "orml-vesting",
+ "pallet-aura",
+ "pallet-balances",
+ "pallet-base-fee",
+ "pallet-common",
+ "pallet-ethereum",
+ "pallet-evm",
+ "pallet-evm-coder-substrate",
+ "pallet-evm-contract-helpers",
+ "pallet-evm-migration",
+ "pallet-evm-transaction-payment",
+ "pallet-fungible",
+ "pallet-inflation",
+ "pallet-nonfungible",
+ "pallet-randomness-collective-flip",
+ "pallet-refungible",
+ "pallet-sudo",
+ "pallet-template-transaction-payment",
+ "pallet-timestamp",
+ "pallet-transaction-payment",
+ "pallet-transaction-payment-rpc-runtime-api",
+ "pallet-treasury",
+ "pallet-unique",
+ "pallet-unq-scheduler",
+ "pallet-xcm",
+ "parachain-info",
+ "parity-scale-codec",
+ "polkadot-parachain",
+ "scale-info",
+ "serde",
+ "smallvec",
+ "sp-api",
+ "sp-arithmetic",
+ "sp-block-builder",
+ "sp-consensus-aura",
+ "sp-core",
+ "sp-inherents",
+ "sp-io",
+ "sp-offchain",
+ "sp-runtime",
+ "sp-session",
+ "sp-std",
+ "sp-transaction-pool",
+ "sp-version",
+ "substrate-wasm-builder",
+ "unique-runtime-common",
+ "up-data-structs",
+ "up-evm-mapping",
+ "up-rpc",
+ "xcm",
+ "xcm-builder",
+ "xcm-executor",
+]
+
+[[package]]
 name = "opaque-debug"
 version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -8260,6 +8336,82 @@
 ]
 
 [[package]]
+name = "quartz-runtime"
+version = "0.1.0"
+dependencies = [
+ "cumulus-pallet-aura-ext",
+ "cumulus-pallet-dmp-queue",
+ "cumulus-pallet-parachain-system",
+ "cumulus-pallet-xcm",
+ "cumulus-pallet-xcmp-queue",
+ "cumulus-primitives-core",
+ "cumulus-primitives-timestamp",
+ "cumulus-primitives-utility",
+ "derivative",
+ "fp-rpc",
+ "fp-self-contained",
+ "frame-benchmarking",
+ "frame-executive",
+ "frame-support",
+ "frame-system",
+ "frame-system-benchmarking",
+ "frame-system-rpc-runtime-api",
+ "hex-literal",
+ "orml-vesting",
+ "pallet-aura",
+ "pallet-balances",
+ "pallet-base-fee",
+ "pallet-common",
+ "pallet-ethereum",
+ "pallet-evm",
+ "pallet-evm-coder-substrate",
+ "pallet-evm-contract-helpers",
+ "pallet-evm-migration",
+ "pallet-evm-transaction-payment",
+ "pallet-fungible",
+ "pallet-inflation",
+ "pallet-nonfungible",
+ "pallet-randomness-collective-flip",
+ "pallet-refungible",
+ "pallet-sudo",
+ "pallet-template-transaction-payment",
+ "pallet-timestamp",
+ "pallet-transaction-payment",
+ "pallet-transaction-payment-rpc-runtime-api",
+ "pallet-treasury",
+ "pallet-unique",
+ "pallet-unq-scheduler",
+ "pallet-xcm",
+ "parachain-info",
+ "parity-scale-codec",
+ "polkadot-parachain",
+ "scale-info",
+ "serde",
+ "smallvec",
+ "sp-api",
+ "sp-arithmetic",
+ "sp-block-builder",
+ "sp-consensus-aura",
+ "sp-core",
+ "sp-inherents",
+ "sp-io",
+ "sp-offchain",
+ "sp-runtime",
+ "sp-session",
+ "sp-std",
+ "sp-transaction-pool",
+ "sp-version",
+ "substrate-wasm-builder",
+ "unique-runtime-common",
+ "up-data-structs",
+ "up-evm-mapping",
+ "up-rpc",
+ "xcm",
+ "xcm-builder",
+ "xcm-executor",
+]
+
+[[package]]
 name = "quick-error"
 version = "1.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -11787,6 +11939,7 @@
  "jsonrpc-core",
  "jsonrpc-pubsub",
  "log",
+ "opal-runtime",
  "pallet-ethereum",
  "pallet-transaction-payment-rpc",
  "parity-scale-codec",
@@ -11796,6 +11949,7 @@
  "polkadot-primitives",
  "polkadot-service",
  "polkadot-test-service",
+ "quartz-runtime",
  "sc-basic-authorship",
  "sc-chain-spec",
  "sc-cli",
@@ -11849,10 +12003,12 @@
  "futures 0.3.21",
  "jsonrpc-core",
  "jsonrpc-pubsub",
+ "opal-runtime",
  "pallet-ethereum",
  "pallet-transaction-payment-rpc",
  "pallet-transaction-payment-rpc-runtime-api",
  "pallet-unique",
+ "quartz-runtime",
  "sc-client-api",
  "sc-consensus-aura",
  "sc-consensus-epochs",
@@ -11949,6 +12105,7 @@
  "sp-transaction-pool",
  "sp-version",
  "substrate-wasm-builder",
+ "unique-runtime-common",
  "up-data-structs",
  "up-evm-mapping",
  "up-rpc",
@@ -11958,6 +12115,18 @@
 ]
 
 [[package]]
+name = "unique-runtime-common"
+version = "0.1.0"
+dependencies = [
+ "frame-support",
+ "frame-system",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-runtime",
+]
+
+[[package]]
 name = "universal-hash"
 version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,7 +5,7 @@
     'pallets/*',
     'client/*',
     'primitives/*',
-    'runtime',
+    'runtime/*',
     'crates/*',
 ]
 [profile.release]
deletedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ /dev/null
@@ -1,409 +0,0 @@
-################################################################################
-# Package
-
-[package]
-authors = ['Unique Network <support@uniquenetwork.io>']
-build = 'build.rs'
-description = 'Unique Runtime'
-edition = '2021'
-homepage = 'https://unique.network'
-license = 'GPLv3'
-name = 'unique-runtime'
-repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.9.17'
-
-[package.metadata.docs.rs]
-targets = ['x86_64-unknown-linux-gnu']
-
-[features]
-default = ['std']
-runtime-benchmarks = [
-    'hex-literal',
-    'frame-benchmarking',
-    'frame-support/runtime-benchmarks',
-    'frame-system-benchmarking',
-    'frame-system/runtime-benchmarks',
-    'pallet-ethereum/runtime-benchmarks',
-    'pallet-evm-migration/runtime-benchmarks',
-    'pallet-evm-coder-substrate/runtime-benchmarks',
-    'pallet-balances/runtime-benchmarks',
-    'pallet-timestamp/runtime-benchmarks',
-    'pallet-common/runtime-benchmarks',
-    'pallet-fungible/runtime-benchmarks',
-    'pallet-refungible/runtime-benchmarks',
-    'pallet-nonfungible/runtime-benchmarks',
-    'pallet-unique/runtime-benchmarks',
-    'pallet-inflation/runtime-benchmarks',
-    'pallet-xcm/runtime-benchmarks',
-    'sp-runtime/runtime-benchmarks',
-    'xcm-builder/runtime-benchmarks',
-]
-std = [
-    'codec/std',
-    'cumulus-pallet-aura-ext/std',
-    'cumulus-pallet-parachain-system/std',
-    'cumulus-pallet-xcm/std',
-    'cumulus-pallet-xcmp-queue/std',
-    'cumulus-primitives-core/std',
-    'cumulus-primitives-utility/std',
-    'frame-executive/std',
-    'frame-support/std',
-    'frame-system/std',
-    'frame-system-rpc-runtime-api/std',
-    'pallet-aura/std',
-    'pallet-balances/std',
-    # 'pallet-contracts/std',
-    # 'pallet-contracts-primitives/std',
-    # 'pallet-contracts-rpc-runtime-api/std',
-    # 'pallet-contract-helpers/std',
-    'pallet-randomness-collective-flip/std',
-    'pallet-sudo/std',
-    'pallet-timestamp/std',
-    'pallet-transaction-payment/std',
-    'pallet-transaction-payment-rpc-runtime-api/std',
-    'pallet-treasury/std',
-    # 'pallet-vesting/std',
-    'pallet-evm/std',
-    'pallet-evm-migration/std',
-    'pallet-evm-contract-helpers/std',
-    'pallet-evm-transaction-payment/std',
-    'pallet-evm-coder-substrate/std',
-    'pallet-ethereum/std',
-    'pallet-base-fee/std',
-    'fp-rpc/std',
-    'up-rpc/std',
-    'up-evm-mapping/std',
-    'fp-self-contained/std',
-    'parachain-info/std',
-    'serde',
-    'pallet-inflation/std',
-    'pallet-common/std',
-    'pallet-fungible/std',
-    'pallet-refungible/std',
-    'pallet-nonfungible/std',
-    'pallet-unique/std',
-    'pallet-unq-scheduler/std',
-    'pallet-charge-transaction/std',
-    'up-data-structs/std',
-    'sp-api/std',
-    'sp-block-builder/std',
-    "sp-consensus-aura/std",
-    'sp-core/std',
-    'sp-inherents/std',
-    'sp-io/std',
-    'sp-offchain/std',
-    'sp-runtime/std',
-    'sp-session/std',
-    'sp-std/std',
-    'sp-transaction-pool/std',
-    'sp-version/std',
-    'xcm/std',
-    'xcm-builder/std',
-    'xcm-executor/std',
-
-    "orml-vesting/std",
-]
-limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
-
-################################################################################
-# Substrate Dependencies
-
-[dependencies.codec]
-default-features = false
-features = ['derive']
-package = 'parity-scale-codec'
-version = '2.3.0'
-
-[dependencies.frame-benchmarking]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-optional = true
-branch = 'polkadot-v0.9.17'
-
-[dependencies.frame-executive]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.frame-support]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.frame-system]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.frame-system-benchmarking]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-optional = true
-branch = 'polkadot-v0.9.17'
-
-[dependencies.frame-system-rpc-runtime-api]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.hex-literal]
-optional = true
-version = '0.3.3'
-
-[dependencies.serde]
-default-features = false
-features = ['derive']
-optional = true
-version = '1.0.130'
-
-[dependencies.pallet-aura]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.pallet-balances]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-# Contracts specific packages
-# [dependencies.pallet-contracts]
-# git = 'https://github.com/paritytech/substrate.git'
-# default-features = false
-# branch = 'polkadot-v0.9.17'
-# version = '4.0.0-dev'
-
-# [dependencies.pallet-contracts-primitives]
-# git = 'https://github.com/paritytech/substrate.git'
-# default-features = false
-# branch = 'polkadot-v0.9.17'
-# version = '4.0.0-dev'
-
-# [dependencies.pallet-contracts-rpc-runtime-api]
-# git = 'https://github.com/paritytech/substrate.git'
-# default-features = false
-# branch = 'polkadot-v0.9.17'
-# version = '4.0.0-dev'
-
-[dependencies.pallet-randomness-collective-flip]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.pallet-sudo]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.pallet-timestamp]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.pallet-transaction-payment]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.pallet-transaction-payment-rpc-runtime-api]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.pallet-treasury]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-# [dependencies.pallet-vesting]
-# default-features = false
-# git = 'https://github.com/paritytech/substrate.git'
-# branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-arithmetic]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-api]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-block-builder]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-core]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-consensus-aura]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-inherents]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-io]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-offchain]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-runtime]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-session]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-std]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-transaction-pool]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.sp-version]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.smallvec]
-version = '1.6.1'
-
-################################################################################
-# Cumulus dependencies
-
-[dependencies.parachain-info]
-default-features = false
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-
-[dependencies.cumulus-pallet-aura-ext]
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-default-features = false
-
-[dependencies.cumulus-pallet-parachain-system]
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-default-features = false
-
-[dependencies.cumulus-primitives-core]
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-default-features = false
-
-[dependencies.cumulus-pallet-xcm]
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-default-features = false
-
-[dependencies.cumulus-pallet-dmp-queue]
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-default-features = false
-
-[dependencies.cumulus-pallet-xcmp-queue]
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-default-features = false
-
-[dependencies.cumulus-primitives-utility]
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-default-features = false
-
-[dependencies.cumulus-primitives-timestamp]
-git = 'https://github.com/uniqueNetwork/cumulus.git'
-branch = 'polkadot-v0.9.17'
-default-features = false
-
-################################################################################
-# Polkadot dependencies
-
-[dependencies.polkadot-parachain]
-git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.17'
-default-features = false
-
-[dependencies.xcm]
-git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.17'
-default-features = false
-
-[dependencies.xcm-builder]
-git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.17'
-default-features = false
-
-[dependencies.xcm-executor]
-git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.17'
-default-features = false
-
-[dependencies.pallet-xcm]
-git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.17'
-default-features = false
-
-[dependencies.orml-vesting]
-git = 'https://github.com/UniqueNetwork/open-runtime-module-library'
-branch = 'unique-polkadot-v0.9.17'
-version = "0.4.1-dev"
-default-features = false
-
-################################################################################
-# local dependencies
-
-[dependencies]
-scale-info = { version = "1.0.0", default-features = false, features = [
-    "derive",
-] }
-derivative = "2.2.0"
-pallet-unique = { path = '../pallets/unique', default-features = false }
-up-rpc = { path = "../primitives/rpc", default-features = false }
-up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }
-pallet-inflation = { path = '../pallets/inflation', default-features = false }
-up-data-structs = { path = '../primitives/data-structs', default-features = false }
-pallet-common = { default-features = false, path = "../pallets/common" }
-pallet-fungible = { default-features = false, path = "../pallets/fungible" }
-pallet-refungible = { default-features = false, path = "../pallets/refungible" }
-pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }
-pallet-unq-scheduler = { path = '../pallets/scheduler', default-features = false }
-# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.17', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
-pallet-evm-migration = { path = '../pallets/evm-migration', default-features = false }
-pallet-evm-contract-helpers = { path = '../pallets/evm-contract-helpers', default-features = false }
-pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }
-pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }
-
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
-
-################################################################################
-# Build Dependencies
-
-[build-dependencies.substrate-wasm-builder]
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.17'
deletedruntime/build.rsdiffbeforeafterboth
--- a/runtime/build.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use substrate_wasm_builder::WasmBuilder;
-
-fn main() {
-	WasmBuilder::new()
-		.with_current_project()
-		.import_memory()
-		.export_heap_base()
-		.build()
-}
addedruntime/common/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/runtime/common/Cargo.toml
@@ -0,0 +1,55 @@
+[package]
+authors = ['Unique Network <support@uniquenetwork.io>']
+description = 'Unique Runtime Common'
+edition = '2021'
+homepage = 'https://unique.network'
+license = 'All Rights Reserved'
+name = 'unique-runtime-common'
+repository = 'https://github.com/UniqueNetwork/unique-chain'
+version = '0.1.0'
+
+[features]
+default = ['std']
+std = [
+    'sp-core/std',
+    'sp-runtime/std',
+    'codec/std',
+    'frame-support/std',
+    'frame-system/std',
+]
+runtime-benchmarks = [
+    'sp-runtime/runtime-benchmarks',
+    'frame-support/runtime-benchmarks',
+    'frame-system/runtime-benchmarks'
+]
+
+[dependencies.sp-core]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-runtime]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '2.3.0'
+
+[dependencies.scale-info]
+default-features = false
+features = ["derive"]
+version = "1.0.0"
+
+[dependencies.frame-support]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-system]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
addedruntime/common/src/constants.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/common/src/constants.rs
@@ -0,0 +1,30 @@
+use sp_runtime::Perbill;
+use frame_support::{
+    parameter_types, weights::{
+        Weight,
+        constants::WEIGHT_PER_SECOND
+    },
+};
+use crate::types::BlockNumber;
+
+pub const MILLISECS_PER_BLOCK: u64 = 12000;
+
+pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
+
+// These time units are defined in number of blocks.
+pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
+pub const HOURS: BlockNumber = MINUTES * 60;
+pub const DAYS: BlockNumber = HOURS * 24;
+
+/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.
+/// This is used to limit the maximal weight of a single extrinsic.
+pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
+/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used
+/// by  Operational  extrinsics.
+pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
+/// We allow for 2 seconds of compute with a 6 second average block time.
+pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;
+
+parameter_types! {
+	pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;
+}
addedruntime/common/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/common/src/lib.rs
@@ -0,0 +1,4 @@
+#![cfg_attr(not(feature = "std"), no_std)]
+
+pub mod types;
+pub mod constants;
addedruntime/common/src/types.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/common/src/types.rs
@@ -0,0 +1,42 @@
+use sp_runtime::{
+	traits::{
+		Verify, IdentifyAccount, BlakeTwo256,
+	},
+	generic, MultiSignature,
+};
+
+pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
+
+/// Opaque block header type.
+pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
+
+/// Opaque block type.
+pub type Block = generic::Block<Header, UncheckedExtrinsic>;
+
+pub type SessionHandlers = ();
+
+/// An index to a block.
+pub type BlockNumber = u32;
+
+/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
+pub type Signature = MultiSignature;
+
+/// Some way of identifying an account on the chain. We intentionally make it equivalent
+/// to the public key of our transaction signing scheme.
+pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
+
+/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
+/// never know...
+pub type AccountIndex = u32;
+
+/// Balance of an account.
+pub type Balance = u128;
+
+/// Index of a transaction in the chain.
+pub type Index = u32;
+
+/// A hash of some data used by the chain.
+pub type Hash = sp_core::H256;
+
+/// Digest item type.
+pub type DigestItem = generic::DigestItem;
addedruntime/opal/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/runtime/opal/Cargo.toml
@@ -0,0 +1,410 @@
+################################################################################
+# Package
+
+[package]
+authors = ['Unique Network <support@uniquenetwork.io>']
+build = 'build.rs'
+description = 'Opal Runtime'
+edition = '2021'
+homepage = 'https://unique.network'
+license = 'All Rights Reserved'
+name = 'opal-runtime'
+repository = 'https://github.com/UniqueNetwork/unique-chain'
+version = '0.1.0'
+
+[package.metadata.docs.rs]
+targets = ['x86_64-unknown-linux-gnu']
+
+[features]
+default = ['std']
+runtime-benchmarks = [
+    'hex-literal',
+    'frame-benchmarking',
+    'frame-support/runtime-benchmarks',
+    'frame-system-benchmarking',
+    'frame-system/runtime-benchmarks',
+    'pallet-ethereum/runtime-benchmarks',
+    'pallet-evm-migration/runtime-benchmarks',
+    'pallet-evm-coder-substrate/runtime-benchmarks',
+    'pallet-balances/runtime-benchmarks',
+    'pallet-timestamp/runtime-benchmarks',
+    'pallet-common/runtime-benchmarks',
+    'pallet-fungible/runtime-benchmarks',
+    'pallet-refungible/runtime-benchmarks',
+    'pallet-nonfungible/runtime-benchmarks',
+    'pallet-unique/runtime-benchmarks',
+    'pallet-inflation/runtime-benchmarks',
+    'pallet-xcm/runtime-benchmarks',
+    'sp-runtime/runtime-benchmarks',
+    'xcm-builder/runtime-benchmarks',
+]
+std = [
+    'codec/std',
+    'cumulus-pallet-aura-ext/std',
+    'cumulus-pallet-parachain-system/std',
+    'cumulus-pallet-xcm/std',
+    'cumulus-pallet-xcmp-queue/std',
+    'cumulus-primitives-core/std',
+    'cumulus-primitives-utility/std',
+    'frame-executive/std',
+    'frame-support/std',
+    'frame-system/std',
+    'frame-system-rpc-runtime-api/std',
+    'pallet-aura/std',
+    'pallet-balances/std',
+    # 'pallet-contracts/std',
+    # 'pallet-contracts-primitives/std',
+    # 'pallet-contracts-rpc-runtime-api/std',
+    # 'pallet-contract-helpers/std',
+    'pallet-randomness-collective-flip/std',
+    'pallet-sudo/std',
+    'pallet-timestamp/std',
+    'pallet-transaction-payment/std',
+    'pallet-transaction-payment-rpc-runtime-api/std',
+    'pallet-treasury/std',
+    # 'pallet-vesting/std',
+    'pallet-evm/std',
+    'pallet-evm-migration/std',
+    'pallet-evm-contract-helpers/std',
+    'pallet-evm-transaction-payment/std',
+    'pallet-evm-coder-substrate/std',
+    'pallet-ethereum/std',
+    'pallet-base-fee/std',
+    'fp-rpc/std',
+    'up-rpc/std',
+    'up-evm-mapping/std',
+    'fp-self-contained/std',
+    'parachain-info/std',
+    'serde',
+    'pallet-inflation/std',
+    'pallet-common/std',
+    'pallet-fungible/std',
+    'pallet-refungible/std',
+    'pallet-nonfungible/std',
+    'pallet-unique/std',
+    'pallet-unq-scheduler/std',
+    'pallet-charge-transaction/std',
+    'up-data-structs/std',
+    'sp-api/std',
+    'sp-block-builder/std',
+    "sp-consensus-aura/std",
+    'sp-core/std',
+    'sp-inherents/std',
+    'sp-io/std',
+    'sp-offchain/std',
+    'sp-runtime/std',
+    'sp-session/std',
+    'sp-std/std',
+    'sp-transaction-pool/std',
+    'sp-version/std',
+    'xcm/std',
+    'xcm-builder/std',
+    'xcm-executor/std',
+
+    "orml-vesting/std",
+]
+limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
+
+################################################################################
+# Substrate Dependencies
+
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '2.3.0'
+
+[dependencies.frame-benchmarking]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+optional = true
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-executive]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-support]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-system]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-system-benchmarking]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+optional = true
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-system-rpc-runtime-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.hex-literal]
+optional = true
+version = '0.3.3'
+
+[dependencies.serde]
+default-features = false
+features = ['derive']
+optional = true
+version = '1.0.130'
+
+[dependencies.pallet-aura]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-balances]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+# Contracts specific packages
+# [dependencies.pallet-contracts]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.16'
+# version = '4.0.0-dev'
+
+# [dependencies.pallet-contracts-primitives]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.16'
+# version = '4.0.0-dev'
+
+# [dependencies.pallet-contracts-rpc-runtime-api]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.16'
+# version = '4.0.0-dev'
+
+[dependencies.pallet-randomness-collective-flip]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-sudo]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-timestamp]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-transaction-payment]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-transaction-payment-rpc-runtime-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-treasury]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+# [dependencies.pallet-vesting]
+# default-features = false
+# git = 'https://github.com/paritytech/substrate.git'
+# branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-arithmetic]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-block-builder]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-core]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-consensus-aura]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-inherents]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-io]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-offchain]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-runtime]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-session]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-std]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-transaction-pool]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-version]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.smallvec]
+version = '1.6.1'
+
+################################################################################
+# Cumulus dependencies
+
+[dependencies.parachain-info]
+default-features = false
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.cumulus-pallet-aura-ext]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-pallet-parachain-system]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-primitives-core]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-pallet-xcm]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-pallet-dmp-queue]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-pallet-xcmp-queue]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-primitives-utility]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-primitives-timestamp]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+################################################################################
+# Polkadot dependencies
+
+[dependencies.polkadot-parachain]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.xcm]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.xcm-builder]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.xcm-executor]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.pallet-xcm]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.orml-vesting]
+git = 'https://github.com/UniqueNetwork/open-runtime-module-library'
+branch = 'unique-polkadot-v0.9.16'
+version = "0.4.1-dev"
+default-features = false
+
+################################################################################
+# local dependencies
+
+[dependencies]
+unique-runtime-common = { path = "../common", default-features = false }
+scale-info = { version = "1.0.0", default-features = false, features = [
+    "derive",
+] }
+derivative = "2.2.0"
+pallet-unique = { path = '../../pallets/unique', default-features = false }
+up-rpc = { path = "../../primitives/rpc", default-features = false }
+up-evm-mapping = { path = "../../primitives/evm-mapping", default-features = false }
+pallet-inflation = { path = '../../pallets/inflation', default-features = false }
+up-data-structs = { path = '../../primitives/data-structs', default-features = false }
+pallet-common = { default-features = false, path = "../../pallets/common" }
+pallet-fungible = { default-features = false, path = "../../pallets/fungible" }
+pallet-refungible = { default-features = false, path = "../../pallets/refungible" }
+pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
+pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
+pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.16', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
+pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
+pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
+pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
+pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
+
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+
+################################################################################
+# Build Dependencies
+
+[build-dependencies.substrate-wasm-builder]
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
addedruntime/opal/build.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/opal/build.rs
@@ -0,0 +1,25 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+use substrate_wasm_builder::WasmBuilder;
+
+fn main() {
+	WasmBuilder::new()
+		.with_current_project()
+		.import_memory()
+		.export_heap_base()
+		.build()
+}
addedruntime/opal/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/opal/src/lib.rs
@@ -0,0 +1,1547 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
+#![recursion_limit = "1024"]
+#![allow(clippy::from_over_into, clippy::identity_op)]
+#![allow(clippy::fn_to_numeric_cast_with_truncation)]
+// Make the WASM binary available.
+#[cfg(feature = "std")]
+include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
+
+use sp_api::impl_runtime_apis;
+use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};
+use sp_runtime::DispatchError;
+// #[cfg(any(feature = "std", test))]
+// pub use sp_runtime::BuildStorage;
+
+use sp_runtime::{
+	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
+	traits::{
+		AccountIdLookup, BlakeTwo256, Block as BlockT,
+		AccountIdConversion, Zero,
+	},
+	transaction_validity::{TransactionSource, TransactionValidity},
+	ApplyExtrinsicResult, RuntimeAppPublic,
+};
+
+use sp_std::prelude::*;
+
+#[cfg(feature = "std")]
+use sp_version::NativeVersion;
+use sp_version::RuntimeVersion;
+pub use pallet_transaction_payment::{
+	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,
+};
+// A few exports that help ease life for downstream crates.
+pub use pallet_balances::Call as BalancesCall;
+pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};
+pub use frame_support::{
+	construct_runtime, match_type,
+	dispatch::DispatchResult,
+	PalletId, parameter_types, StorageValue, ConsensusEngineId,
+	traits::{
+		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,
+		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,
+		OnUnbalanced, Randomness, FindAuthor,
+	},
+	weights::{
+		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
+		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,
+	},
+};
+use up_data_structs::*;
+// use pallet_contracts::weights::WeightInfo;
+// #[cfg(any(feature = "std", test))]
+use frame_system::{
+	self as frame_system, EnsureRoot, EnsureSigned,
+	limits::{BlockWeights, BlockLength},
+};
+use sp_arithmetic::{
+	traits::{BaseArithmetic, Unsigned},
+};
+use smallvec::smallvec;
+use codec::{Encode, Decode};
+use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};
+use fp_rpc::TransactionStatus;
+use sp_runtime::{
+	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},
+	transaction_validity::TransactionValidityError,
+	SaturatedConversion,
+};
+
+// pub use pallet_timestamp::Call as TimestampCall;
+pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
+
+// Polkadot imports
+use pallet_xcm::XcmPassthrough;
+use polkadot_parachain::primitives::Sibling;
+use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
+use xcm_builder::{
+	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
+	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
+	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
+	ParentIsPreset,
+};
+use xcm_executor::{Config, XcmExecutor, Assets};
+use sp_std::{marker::PhantomData};
+
+use xcm::latest::{
+	//	Xcm,
+	AssetId::{Concrete},
+	Fungibility::Fungible as XcmFungible,
+	MultiAsset,
+	Error as XcmError,
+};
+use xcm_executor::traits::{MatchesFungible, WeightTrader};
+//use xcm_executor::traits::MatchesFungible;
+use sp_runtime::traits::CheckedConversion;
+
+use unique_runtime_common::{
+	types::*,
+	constants::*,
+};
+
+// mod chain_extension;
+// use crate::chain_extension::{NFTExtension, Imbalance};
+
+pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+
+/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
+/// the specifics of the runtime. They can then be made to be agnostic over specific formats
+/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
+/// to even the core data structures.
+pub mod opaque {
+	use sp_std::prelude::*;
+	use sp_runtime::impl_opaque_keys;
+	use super::Aura;
+
+	pub use unique_runtime_common::types::*;
+	pub use super::CrossAccountId;
+
+	impl_opaque_keys! {
+		pub struct SessionKeys {
+			pub aura: Aura,
+		}
+	}
+}
+
+/// This runtime version.
+pub const VERSION: RuntimeVersion = RuntimeVersion {
+	spec_name: create_runtime_str!("opal"),
+	impl_name: create_runtime_str!("opal"),
+	authoring_version: 1,
+	spec_version: 917004,
+	impl_version: 0,
+	apis: RUNTIME_API_VERSIONS,
+	transaction_version: 1,
+	state_version: 0,
+};
+
+#[derive(codec::Encode, codec::Decode)]
+pub enum XCMPMessage<XAccountId, XBalance> {
+	/// Transfer tokens to the given account from the Parachain account.
+	TransferToken(XAccountId, XBalance),
+}
+
+/// The version information used to identify this runtime when compiled natively.
+#[cfg(feature = "std")]
+pub fn native_version() -> NativeVersion {
+	NativeVersion {
+		runtime_version: VERSION,
+		can_author_with: Default::default(),
+	}
+}
+
+type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
+
+pub struct DealWithFees;
+impl OnUnbalanced<NegativeImbalance> for DealWithFees {
+	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {
+		if let Some(fees) = fees_then_tips.next() {
+			// for fees, 100% to treasury
+			let mut split = fees.ration(100, 0);
+			if let Some(tips) = fees_then_tips.next() {
+				// for tips, if any, 100% to treasury
+				tips.ration_merge_into(100, 0, &mut split);
+			}
+			Treasury::on_unbalanced(split.0);
+			// Author::on_unbalanced(split.1);
+		}
+	}
+}
+
+parameter_types! {
+	pub const BlockHashCount: BlockNumber = 2400;
+	pub RuntimeBlockLength: BlockLength =
+		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
+	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
+	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
+	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
+		.base_block(BlockExecutionWeight::get())
+		.for_class(DispatchClass::all(), |weights| {
+			weights.base_extrinsic = ExtrinsicBaseWeight::get();
+		})
+		.for_class(DispatchClass::Normal, |weights| {
+			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
+		})
+		.for_class(DispatchClass::Operational, |weights| {
+			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
+			// Operational transactions have some extra reserved space, so that they
+			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
+			weights.reserved = Some(
+				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
+			);
+		})
+		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
+		.build_or_panic();
+	pub const Version: RuntimeVersion = VERSION;
+	pub const SS58Prefix: u8 = 42;
+}
+
+/*
+8880 - Unique
+8881 - Quartz
+8882 - Opal
+*/
+parameter_types! {
+	pub const ChainId: u64 = 8882;
+}
+
+pub struct FixedFee;
+impl FeeCalculator for FixedFee {
+	fn min_gas_price() -> U256 {
+		// Targeting 0.15 UNQ per transfer
+		1_018_751_825_264u64.into()
+	}
+}
+
+// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case
+// (contract, which only writes a lot of data),
+// approximating on top of our real store write weight
+parameter_types! {
+	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;
+	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;
+	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();
+}
+
+/// Limiting EVM execution to 50% of block for substrate users and management tasks
+/// EVM transaction consumes more weight than substrate's, so we can't rely on them being
+/// scheduled fairly
+const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);
+parameter_types! {
+	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());
+}
+
+pub enum FixedGasWeightMapping {}
+impl GasWeightMapping for FixedGasWeightMapping {
+	fn gas_to_weight(gas: u64) -> Weight {
+		gas.saturating_mul(WeightPerGas::get())
+	}
+	fn weight_to_gas(weight: Weight) -> u64 {
+		weight / WeightPerGas::get()
+	}
+}
+
+impl pallet_evm::Config for Runtime {
+	type BlockGasLimit = BlockGasLimit;
+	type FeeCalculator = FixedFee;
+	type GasWeightMapping = FixedGasWeightMapping;
+	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;
+	type CallOrigin = EnsureAddressTruncated;
+	type WithdrawOrigin = EnsureAddressTruncated;
+	type AddressMapping = HashedAddressMapping<Self::Hashing>;
+	type PrecompilesType = ();
+	type PrecompilesValue = ();
+	type Currency = Balances;
+	type Event = Event;
+	type OnMethodCall = (
+		pallet_evm_migration::OnMethodCall<Self>,
+		pallet_unique::UniqueErcSupport<Self>,
+		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
+	);
+	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
+	type ChainId = ChainId;
+	type Runner = pallet_evm::runner::stack::Runner<Self>;
+	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;
+	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;
+	type FindAuthor = EthereumFindAuthor<Aura>;
+}
+
+impl pallet_evm_migration::Config for Runtime {
+	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;
+}
+
+pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);
+impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {
+	fn find_author<'a, I>(digests: I) -> Option<H160>
+	where
+		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,
+	{
+		if let Some(author_index) = F::find_author(digests) {
+			let authority_id = Aura::authorities()[author_index as usize].clone();
+			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));
+		}
+		None
+	}
+}
+
+impl pallet_ethereum::Config for Runtime {
+	type Event = Event;
+	type StateRoot = pallet_ethereum::IntermediateStateRoot;
+}
+
+impl pallet_randomness_collective_flip::Config for Runtime {}
+
+impl frame_system::Config for Runtime {
+	/// The data to be stored in an account.
+	type AccountData = pallet_balances::AccountData<Balance>;
+	/// The identifier used to distinguish between accounts.
+	type AccountId = AccountId;
+	/// The basic call filter to use in dispatchable.
+	type BaseCallFilter = Everything;
+	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
+	type BlockHashCount = BlockHashCount;
+	/// The maximum length of a block (in bytes).
+	type BlockLength = RuntimeBlockLength;
+	/// The index type for blocks.
+	type BlockNumber = BlockNumber;
+	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.
+	type BlockWeights = RuntimeBlockWeights;
+	/// The aggregated dispatch type that is available for extrinsics.
+	type Call = Call;
+	/// The weight of database operations that the runtime can invoke.
+	type DbWeight = RocksDbWeight;
+	/// The ubiquitous event type.
+	type Event = Event;
+	/// The type for hashing blocks and tries.
+	type Hash = Hash;
+	/// The hashing algorithm used.
+	type Hashing = BlakeTwo256;
+	/// The header type.
+	type Header = generic::Header<BlockNumber, BlakeTwo256>;
+	/// The index type for storing how many extrinsics an account has signed.
+	type Index = Index;
+	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
+	type Lookup = AccountIdLookup<AccountId, ()>;
+	/// What to do if an account is fully reaped from the system.
+	type OnKilledAccount = ();
+	/// What to do if a new account is created.
+	type OnNewAccount = ();
+	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
+	/// The ubiquitous origin type.
+	type Origin = Origin;
+	/// This type is being generated by `construct_runtime!`.
+	type PalletInfo = PalletInfo;
+	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
+	type SS58Prefix = SS58Prefix;
+	/// Weight information for the extrinsics of this pallet.
+	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;
+	/// Version of the runtime.
+	type Version = Version;
+	type MaxConsumers = ConstU32<16>;
+}
+
+parameter_types! {
+	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
+}
+
+impl pallet_timestamp::Config for Runtime {
+	/// A timestamp: milliseconds since the unix epoch.
+	type Moment = u64;
+	type OnTimestampSet = ();
+	type MinimumPeriod = MinimumPeriod;
+	type WeightInfo = ();
+}
+
+parameter_types! {
+	// pub const ExistentialDeposit: u128 = 500;
+	pub const ExistentialDeposit: u128 = 0;
+	pub const MaxLocks: u32 = 50;
+}
+
+impl pallet_balances::Config for Runtime {
+	type MaxLocks = MaxLocks;
+	type MaxReserves = ();
+	type ReserveIdentifier = [u8; 8];
+	/// The type for recording an account's balance.
+	type Balance = Balance;
+	/// The ubiquitous event type.
+	type Event = Event;
+	type DustRemoval = Treasury;
+	type ExistentialDeposit = ExistentialDeposit;
+	type AccountStore = System;
+	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
+}
+
+pub const MICROUNIQUE: Balance = 1_000_000_000_000;
+pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;
+pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;
+pub const UNIQUE: Balance = 100 * CENTIUNIQUE;
+
+pub const fn deposit(items: u32, bytes: u32) -> Balance {
+	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE
+}
+
+/*
+parameter_types! {
+	pub TombstoneDeposit: Balance = deposit(
+		1,
+		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,
+	);
+	pub DepositPerContract: Balance = TombstoneDeposit::get();
+	pub const DepositPerStorageByte: Balance = deposit(0, 1);
+	pub const DepositPerStorageItem: Balance = deposit(1, 0);
+	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);
+	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;
+	pub const SignedClaimHandicap: u32 = 2;
+	pub const MaxDepth: u32 = 32;
+	pub const MaxValueSize: u32 = 16 * 1024;
+	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb
+	// The lazy deletion runs inside on_initialize.
+	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *
+		RuntimeBlockWeights::get().max_block;
+	// The weight needed for decoding the queue should be less or equal than a fifth
+	// of the overall weight dedicated to the lazy deletion.
+	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (
+			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -
+			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)
+		)) / 5) as u32;
+	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
+}
+
+impl pallet_contracts::Config for Runtime {
+	type Time = Timestamp;
+	type Randomness = RandomnessCollectiveFlip;
+	type Currency = Balances;
+	type Event = Event;
+	type RentPayment = ();
+	type SignedClaimHandicap = SignedClaimHandicap;
+	type TombstoneDeposit = TombstoneDeposit;
+	type DepositPerContract = DepositPerContract;
+	type DepositPerStorageByte = DepositPerStorageByte;
+	type DepositPerStorageItem = DepositPerStorageItem;
+	type RentFraction = RentFraction;
+	type SurchargeReward = SurchargeReward;
+	type WeightPrice = pallet_transaction_payment::Pallet<Self>;
+	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
+	type ChainExtension = NFTExtension;
+	type DeletionQueueDepth = DeletionQueueDepth;
+	type DeletionWeightLimit = DeletionWeightLimit;
+	type Schedule = Schedule;
+	type CallStack = [pallet_contracts::Frame<Self>; 31];
+}
+*/
+
+parameter_types! {
+	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer
+	/// This value increases the priority of `Operational` transactions by adding
+	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.
+	pub const OperationalFeeMultiplier: u8 = 5;
+}
+
+/// Linear implementor of `WeightToFeePolynomial`
+pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);
+
+impl<T> WeightToFeePolynomial for LinearFee<T>
+where
+	T: BaseArithmetic + From<u32> + Copy + Unsigned,
+{
+	type Balance = T;
+
+	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
+		smallvec!(WeightToFeeCoefficient {
+			// Targeting 0.1 Unique per NFT transfer
+			coeff_integer: 142_688_000u32.into(),
+			coeff_frac: Perbill::zero(),
+			negative: false,
+			degree: 1,
+		})
+	}
+}
+
+impl pallet_transaction_payment::Config for Runtime {
+	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;
+	type TransactionByteFee = TransactionByteFee;
+	type OperationalFeeMultiplier = OperationalFeeMultiplier;
+	type WeightToFee = LinearFee<Balance>;
+	type FeeMultiplierUpdate = ();
+}
+
+parameter_types! {
+	pub const ProposalBond: Permill = Permill::from_percent(5);
+	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;
+	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;
+	pub const SpendPeriod: BlockNumber = 5 * MINUTES;
+	pub const Burn: Permill = Permill::from_percent(0);
+	pub const TipCountdown: BlockNumber = 1 * DAYS;
+	pub const TipFindersFee: Percent = Percent::from_percent(20);
+	pub const TipReportDepositBase: Balance = 1 * UNIQUE;
+	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;
+	pub const BountyDepositBase: Balance = 1 * UNIQUE;
+	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;
+	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");
+	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;
+	pub const MaximumReasonLength: u32 = 16384;
+	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
+	pub const BountyValueMinimum: Balance = 5 * UNIQUE;
+	pub const MaxApprovals: u32 = 100;
+}
+
+impl pallet_treasury::Config for Runtime {
+	type PalletId = TreasuryModuleId;
+	type Currency = Balances;
+	type ApproveOrigin = EnsureRoot<AccountId>;
+	type RejectOrigin = EnsureRoot<AccountId>;
+	type Event = Event;
+	type OnSlash = ();
+	type ProposalBond = ProposalBond;
+	type ProposalBondMinimum = ProposalBondMinimum;
+	type ProposalBondMaximum = ProposalBondMaximum;
+	type SpendPeriod = SpendPeriod;
+	type Burn = Burn;
+	type BurnDestination = ();
+	type SpendFunds = ();
+	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;
+	type MaxApprovals = MaxApprovals;
+}
+
+impl pallet_sudo::Config for Runtime {
+	type Event = Event;
+	type Call = Call;
+}
+
+pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);
+
+impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider
+	for RelayChainBlockNumberProvider<T>
+{
+	type BlockNumber = BlockNumber;
+
+	fn current_block_number() -> Self::BlockNumber {
+		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()
+			.map(|d| d.relay_parent_number)
+			.unwrap_or_default()
+	}
+}
+
+parameter_types! {
+	pub const MinVestedTransfer: Balance = 10 * UNIQUE;
+	pub const MaxVestingSchedules: u32 = 28;
+}
+
+impl orml_vesting::Config for Runtime {
+	type Event = Event;
+	type Currency = pallet_balances::Pallet<Runtime>;
+	type MinVestedTransfer = MinVestedTransfer;
+	type VestedTransferOrigin = EnsureSigned<AccountId>;
+	type WeightInfo = ();
+	type MaxVestingSchedules = MaxVestingSchedules;
+	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
+}
+
+parameter_types! {
+	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
+	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
+}
+
+impl cumulus_pallet_parachain_system::Config for Runtime {
+	type Event = Event;
+	type SelfParaId = parachain_info::Pallet<Self>;
+	type OnSystemEvent = ();
+	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<
+	// 	MaxDownwardMessageWeight,
+	// 	XcmExecutor<XcmConfig>,
+	// 	Call,
+	// >;
+	type OutboundXcmpMessageSource = XcmpQueue;
+	type DmpMessageHandler = DmpQueue;
+	type ReservedDmpWeight = ReservedDmpWeight;
+	type ReservedXcmpWeight = ReservedXcmpWeight;
+	type XcmpMessageHandler = XcmpQueue;
+}
+
+impl parachain_info::Config for Runtime {}
+
+impl cumulus_pallet_aura_ext::Config for Runtime {}
+
+parameter_types! {
+	pub const RelayLocation: MultiLocation = MultiLocation::parent();
+	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
+	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
+	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
+}
+
+/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
+/// when determining ownership of accounts for asset transacting and when attempting to use XCM
+/// `Transact` in order to determine the dispatch Origin.
+pub type LocationToAccountId = (
+	// The parent (Relay-chain) origin converts to the default `AccountId`.
+	ParentIsPreset<AccountId>,
+	// Sibling parachain origins convert to AccountId via the `ParaId::into`.
+	SiblingParachainConvertsVia<Sibling, AccountId>,
+	// Straight up local `AccountId32` origins just alias directly to `AccountId`.
+	AccountId32Aliases<RelayNetwork, AccountId>,
+);
+
+pub struct OnlySelfCurrency;
+impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {
+	fn matches_fungible(a: &MultiAsset) -> Option<B> {
+		match (&a.id, &a.fun) {
+			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),
+			_ => None,
+		}
+	}
+}
+
+/// Means for transacting assets on this chain.
+pub type LocalAssetTransactor = CurrencyAdapter<
+	// Use this currency:
+	Balances,
+	// Use this currency when it is a fungible asset matching the given location or name:
+	OnlySelfCurrency,
+	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
+	LocationToAccountId,
+	// Our chain's account ID type (we can't get away without mentioning it explicitly):
+	AccountId,
+	// We don't track any teleports.
+	(),
+>;
+
+/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
+/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
+/// biases the kind of local `Origin` it will become.
+pub type XcmOriginToTransactDispatchOrigin = (
+	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
+	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
+	// foreign chains who want to have a local sovereign account on this chain which they control.
+	SovereignSignedViaLocation<LocationToAccountId, Origin>,
+	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when
+	// recognised.
+	RelayChainAsNative<RelayOrigin, Origin>,
+	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
+	// recognised.
+	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
+	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
+	// transaction from the Root origin.
+	ParentAsSuperuser<Origin>,
+	// Native signed account converter; this just converts an `AccountId32` origin into a normal
+	// `Origin::Signed` origin of the same 32-byte value.
+	SignedAccountId32AsNative<RelayNetwork, Origin>,
+	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
+	XcmPassthrough<Origin>,
+);
+
+parameter_types! {
+	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.
+	pub UnitWeightCost: Weight = 1_000_000;
+	// 1200 UNIQUEs buy 1 second of weight.
+	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);
+	pub const MaxInstructions: u32 = 100;
+	pub const MaxAuthorities: u32 = 100_000;
+}
+
+match_type! {
+	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
+		MultiLocation { parents: 1, interior: Here } |
+		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
+	};
+}
+
+pub type Barrier = (
+	TakeWeightCredit,
+	AllowTopLevelPaidExecutionFrom<Everything>,
+	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,
+	// ^^^ Parent & its unit plurality gets free execution
+);
+
+pub struct UsingOnlySelfCurrencyComponents<
+	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+	AssetId: Get<MultiLocation>,
+	AccountId,
+	Currency: CurrencyT<AccountId>,
+	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+>(
+	Weight,
+	Currency::Balance,
+	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,
+);
+impl<
+		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+		AssetId: Get<MultiLocation>,
+		AccountId,
+		Currency: CurrencyT<AccountId>,
+		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+	> WeightTrader
+	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>
+{
+	fn new() -> Self {
+		Self(0, Zero::zero(), PhantomData)
+	}
+
+	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {
+		let amount = WeightToFee::calc(&weight);
+		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;
+
+		// location to this parachain through relay chain
+		let option1: xcm::v1::AssetId = Concrete(MultiLocation {
+			parents: 1,
+			interior: X1(Parachain(ParachainInfo::parachain_id().into())),
+		});
+		// direct location
+		let option2: xcm::v1::AssetId = Concrete(MultiLocation {
+			parents: 0,
+			interior: Here,
+		});
+
+		let required = if payment.fungible.contains_key(&option1) {
+			(option1, u128_amount).into()
+		} else if payment.fungible.contains_key(&option2) {
+			(option2, u128_amount).into()
+		} else {
+			(Concrete(MultiLocation::default()), u128_amount).into()
+		};
+
+		let unused = payment
+			.checked_sub(required)
+			.map_err(|_| XcmError::TooExpensive)?;
+		self.0 = self.0.saturating_add(weight);
+		self.1 = self.1.saturating_add(amount);
+		Ok(unused)
+	}
+
+	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {
+		let weight = weight.min(self.0);
+		let amount = WeightToFee::calc(&weight);
+		self.0 -= weight;
+		self.1 = self.1.saturating_sub(amount);
+		let amount: u128 = amount.saturated_into();
+		if amount > 0 {
+			Some((AssetId::get(), amount).into())
+		} else {
+			None
+		}
+	}
+}
+impl<
+		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+		AssetId: Get<MultiLocation>,
+		AccountId,
+		Currency: CurrencyT<AccountId>,
+		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+	> Drop
+	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>
+{
+	fn drop(&mut self) {
+		OnUnbalanced::on_unbalanced(Currency::issue(self.1));
+	}
+}
+
+pub struct XcmConfig;
+impl Config for XcmConfig {
+	type Call = Call;
+	type XcmSender = XcmRouter;
+	// How to withdraw and deposit an asset.
+	type AssetTransactor = LocalAssetTransactor;
+	type OriginConverter = XcmOriginToTransactDispatchOrigin;
+	type IsReserve = NativeAsset;
+	type IsTeleporter = (); // Teleportation is disabled
+	type LocationInverter = LocationInverter<Ancestry>;
+	type Barrier = Barrier;
+	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
+	type Trader = UsingOnlySelfCurrencyComponents<
+		IdentityFee<Balance>,
+		RelayLocation,
+		AccountId,
+		Balances,
+		(),
+	>;
+	type ResponseHandler = (); // Don't handle responses for now.
+	type SubscriptionService = PolkadotXcm;
+
+	type AssetTrap = PolkadotXcm;
+	type AssetClaims = PolkadotXcm;
+}
+
+// parameter_types! {
+// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;
+// }
+
+/// No local origins on this chain are allowed to dispatch XCM sends/executions.
+pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);
+
+/// The means for routing XCM messages which are not for local execution into the right message
+/// queues.
+pub type XcmRouter = (
+	// Two routers - use UMP to communicate with the relay chain:
+	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,
+	// ..and XCMP to communicate with the sibling chains.
+	XcmpQueue,
+);
+
+impl pallet_evm_coder_substrate::Config for Runtime {
+	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;
+	type GasWeightMapping = FixedGasWeightMapping;
+}
+
+impl pallet_xcm::Config for Runtime {
+	type Event = Event;
+	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
+	type XcmRouter = XcmRouter;
+	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
+	type XcmExecuteFilter = Everything;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type XcmTeleportFilter = Everything;
+	type XcmReserveTransferFilter = Everything;
+	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
+	type LocationInverter = LocationInverter<Ancestry>;
+	type Origin = Origin;
+	type Call = Call;
+	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
+	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
+}
+
+impl cumulus_pallet_xcm::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+}
+
+impl cumulus_pallet_xcmp_queue::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type ChannelInfo = ParachainSystem;
+	type VersionWrapper = ();
+	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+	type ControllerOrigin = EnsureRoot<AccountId>;
+	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
+}
+
+impl cumulus_pallet_dmp_queue::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+}
+
+impl pallet_aura::Config for Runtime {
+	type AuthorityId = AuraId;
+	type DisabledValidators = ();
+	type MaxAuthorities = MaxAuthorities;
+}
+
+parameter_types! {
+	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();
+	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;
+}
+
+impl pallet_common::Config for Runtime {
+	type Event = Event;
+	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
+	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
+	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;
+
+	type Currency = Balances;
+	type CollectionCreationPrice = CollectionCreationPrice;
+	type TreasuryAccountId = TreasuryAccountId;
+}
+
+impl pallet_fungible::Config for Runtime {
+	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;
+}
+impl pallet_refungible::Config for Runtime {
+	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;
+}
+impl pallet_nonfungible::Config for Runtime {
+	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
+}
+
+impl pallet_unique::Config for Runtime {
+	type Event = Event;
+	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
+}
+
+parameter_types! {
+	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied
+}
+
+/// Used for the pallet inflation
+impl pallet_inflation::Config for Runtime {
+	type Currency = Balances;
+	type TreasuryAccountId = TreasuryAccountId;
+	type InflationBlockInterval = InflationBlockInterval;
+	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
+}
+
+// parameter_types! {
+// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
+// 		RuntimeBlockWeights::get().max_block;
+// 	pub const MaxScheduledPerBlock: u32 = 50;
+// }
+
+type EvmSponsorshipHandler = (
+	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,
+	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
+);
+type SponsorshipHandler = (
+	pallet_unique::UniqueSponsorshipHandler<Runtime>,
+	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
+	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
+);
+
+// impl pallet_unq_scheduler::Config for Runtime {
+// 	type Event = Event;
+// 	type Origin = Origin;
+// 	type PalletsOrigin = OriginCaller;
+// 	type Call = Call;
+// 	type MaximumWeight = MaximumSchedulerWeight;
+// 	type ScheduleOrigin = EnsureSigned<AccountId>;
+// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;
+// 	type SponsorshipHandler = SponsorshipHandler;
+// 	type WeightInfo = ();
+// }
+
+impl pallet_evm_transaction_payment::Config for Runtime {
+	type EvmSponsorshipHandler = EvmSponsorshipHandler;
+	type Currency = Balances;
+	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
+	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
+}
+
+impl pallet_charge_transaction::Config for Runtime {
+	type SponsorshipHandler = SponsorshipHandler;
+}
+
+// impl pallet_contract_helpers::Config for Runtime {
+//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
+// }
+
+parameter_types! {
+	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049
+	pub const HelpersContractAddress: H160 = H160([
+		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,
+	]);
+}
+
+impl pallet_evm_contract_helpers::Config for Runtime {
+	type ContractAddress = HelpersContractAddress;
+	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
+}
+
+construct_runtime!(
+	pub enum Runtime where
+		Block = Block,
+		NodeBlock = opaque::Block,
+		UncheckedExtrinsic = UncheckedExtrinsic
+	{
+		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,
+		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
+
+		Aura: pallet_aura::{Pallet, Config<T>} = 22,
+		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,
+
+		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
+		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,
+		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,
+		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,
+		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,
+		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,
+		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,
+		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,
+		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
+		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
+
+		// XCM helpers.
+		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,
+		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,
+		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,
+		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
+
+		// Unique Pallets
+		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
+		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
+		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+		// free = 63
+		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
+		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
+		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,
+		Fungible: pallet_fungible::{Pallet, Storage} = 67,
+		Refungible: pallet_refungible::{Pallet, Storage} = 68,
+		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
+
+		// Frontier
+		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,
+		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,
+
+		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,
+		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,
+		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,
+		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,
+	}
+);
+
+pub struct TransactionConverter;
+
+impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
+	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
+		UncheckedExtrinsic::new_unsigned(
+			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
+		)
+	}
+}
+
+impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {
+	fn convert_transaction(
+		&self,
+		transaction: pallet_ethereum::Transaction,
+	) -> opaque::UncheckedExtrinsic {
+		let extrinsic = UncheckedExtrinsic::new_unsigned(
+			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
+		);
+		let encoded = extrinsic.encode();
+		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])
+			.expect("Encoded extrinsic is always valid")
+	}
+}
+
+/// The address format for describing accounts.
+pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
+/// Block header type as expected by this runtime.
+pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
+/// Block type as expected by this runtime.
+pub type Block = generic::Block<Header, UncheckedExtrinsic>;
+/// A Block signed with a Justification
+pub type SignedBlock = generic::SignedBlock<Block>;
+/// BlockId type as expected by this runtime.
+pub type BlockId = generic::BlockId<Block>;
+/// The SignedExtension to the basic transaction logic.
+pub type SignedExtra = (
+	frame_system::CheckSpecVersion<Runtime>,
+	// system::CheckTxVersion<Runtime>,
+	frame_system::CheckGenesis<Runtime>,
+	frame_system::CheckEra<Runtime>,
+	frame_system::CheckNonce<Runtime>,
+	frame_system::CheckWeight<Runtime>,
+	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,
+	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,
+);
+/// Unchecked extrinsic type as expected by this runtime.
+pub type UncheckedExtrinsic =
+	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
+/// Extrinsic type that has already been checked.
+pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;
+/// Executive: handles dispatch to the various modules.
+pub type Executive = frame_executive::Executive<
+	Runtime,
+	Block,
+	frame_system::ChainContext<Runtime>,
+	Runtime,
+	AllPalletsReversedWithSystemFirst,
+>;
+
+impl_opaque_keys! {
+	pub struct SessionKeys {
+		pub aura: Aura,
+	}
+}
+
+impl fp_self_contained::SelfContainedCall for Call {
+	type SignedInfo = H160;
+
+	fn is_self_contained(&self) -> bool {
+		match self {
+			Call::Ethereum(call) => call.is_self_contained(),
+			_ => false,
+		}
+	}
+
+	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {
+		match self {
+			Call::Ethereum(call) => call.check_self_contained(),
+			_ => None,
+		}
+	}
+
+	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {
+		match self {
+			Call::Ethereum(call) => call.validate_self_contained(info),
+			_ => None,
+		}
+	}
+
+	fn pre_dispatch_self_contained(
+		&self,
+		info: &Self::SignedInfo,
+	) -> Option<Result<(), TransactionValidityError>> {
+		match self {
+			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),
+			_ => None,
+		}
+	}
+
+	fn apply_self_contained(
+		self,
+		info: Self::SignedInfo,
+	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {
+		match self {
+			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(
+				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),
+			)),
+			_ => None,
+		}
+	}
+}
+
+macro_rules! dispatch_unique_runtime {
+	($collection:ident.$method:ident($($name:ident),*)) => {{
+		use pallet_unique::dispatch::Dispatched;
+
+		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);
+		let dispatch = collection.as_dyn();
+
+		Ok(dispatch.$method($($name),*))
+	}};
+}
+impl_runtime_apis! {
+	impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>
+		for Runtime
+	{
+		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {
+			dispatch_unique_runtime!(collection.account_tokens(account))
+		}
+		fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {
+			dispatch_unique_runtime!(collection.token_exists(token))
+		}
+
+		fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {
+			dispatch_unique_runtime!(collection.token_owner(token))
+		}
+		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {
+			dispatch_unique_runtime!(collection.const_metadata(token))
+		}
+		fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {
+			dispatch_unique_runtime!(collection.variable_metadata(token))
+		}
+
+		fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {
+			dispatch_unique_runtime!(collection.collection_tokens())
+		}
+		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {
+			dispatch_unique_runtime!(collection.account_balance(account))
+		}
+		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {
+			dispatch_unique_runtime!(collection.balance(account, token))
+		}
+		fn allowance(
+			collection: CollectionId,
+			sender: CrossAccountId,
+			spender: CrossAccountId,
+			token: TokenId,
+		) -> Result<u128, DispatchError> {
+			dispatch_unique_runtime!(collection.allowance(sender, spender, token))
+		}
+
+		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {
+			<pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)
+				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))
+				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))
+		}
+		fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))
+		}
+		fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))
+		}
+		fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))
+		}
+		fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {
+			dispatch_unique_runtime!(collection.last_token_id())
+		}
+		fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {
+			Ok(<pallet_common::CollectionById<Runtime>>::get(collection))
+		}
+		fn collection_stats() -> Result<CollectionStats, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::collection_stats())
+		}
+	}
+
+	impl sp_api::Core<Block> for Runtime {
+		fn version() -> RuntimeVersion {
+			VERSION
+		}
+
+		fn execute_block(block: Block) {
+			Executive::execute_block(block)
+		}
+
+		fn initialize_block(header: &<Block as BlockT>::Header) {
+			Executive::initialize_block(header)
+		}
+	}
+
+	impl sp_api::Metadata<Block> for Runtime {
+		fn metadata() -> OpaqueMetadata {
+			OpaqueMetadata::new(Runtime::metadata().into())
+		}
+	}
+
+	impl sp_block_builder::BlockBuilder<Block> for Runtime {
+		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
+			Executive::apply_extrinsic(extrinsic)
+		}
+
+		fn finalize_block() -> <Block as BlockT>::Header {
+			Executive::finalize_block()
+		}
+
+		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
+			data.create_extrinsics()
+		}
+
+		fn check_inherents(
+			block: Block,
+			data: sp_inherents::InherentData,
+		) -> sp_inherents::CheckInherentsResult {
+			data.check_extrinsics(&block)
+		}
+
+		// fn random_seed() -> <Block as BlockT>::Hash {
+		//     RandomnessCollectiveFlip::random_seed().0
+		// }
+	}
+
+	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
+		fn validate_transaction(
+			source: TransactionSource,
+			tx: <Block as BlockT>::Extrinsic,
+			hash: <Block as BlockT>::Hash,
+		) -> TransactionValidity {
+			Executive::validate_transaction(source, tx, hash)
+		}
+	}
+
+	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
+		fn offchain_worker(header: &<Block as BlockT>::Header) {
+			Executive::offchain_worker(header)
+		}
+	}
+
+	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {
+		fn chain_id() -> u64 {
+			<Runtime as pallet_evm::Config>::ChainId::get()
+		}
+
+		fn account_basic(address: H160) -> EVMAccount {
+			EVM::account_basic(&address)
+		}
+
+		fn gas_price() -> U256 {
+			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()
+		}
+
+		fn account_code_at(address: H160) -> Vec<u8> {
+			EVM::account_codes(address)
+		}
+
+		fn author() -> H160 {
+			<pallet_evm::Pallet<Runtime>>::find_author()
+		}
+
+		fn storage_at(address: H160, index: U256) -> H256 {
+			let mut tmp = [0u8; 32];
+			index.to_big_endian(&mut tmp);
+			EVM::account_storages(address, H256::from_slice(&tmp[..]))
+		}
+
+		#[allow(clippy::redundant_closure)]
+		fn call(
+			from: H160,
+			to: H160,
+			data: Vec<u8>,
+			value: U256,
+			gas_limit: U256,
+			max_fee_per_gas: Option<U256>,
+			max_priority_fee_per_gas: Option<U256>,
+			nonce: Option<U256>,
+			estimate: bool,
+			access_list: Option<Vec<(H160, Vec<H256>)>>,
+		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
+			let config = if estimate {
+				let mut config = <Runtime as pallet_evm::Config>::config().clone();
+				config.estimate = true;
+				Some(config)
+			} else {
+				None
+			};
+
+			<Runtime as pallet_evm::Config>::Runner::call(
+				from,
+				to,
+				data,
+				value,
+				gas_limit.low_u64(),
+				max_fee_per_gas,
+				max_priority_fee_per_gas,
+				nonce,
+				access_list.unwrap_or_default(),
+				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
+			).map_err(|err| err.into())
+		}
+
+		#[allow(clippy::redundant_closure)]
+		fn create(
+			from: H160,
+			data: Vec<u8>,
+			value: U256,
+			gas_limit: U256,
+			max_fee_per_gas: Option<U256>,
+			max_priority_fee_per_gas: Option<U256>,
+			nonce: Option<U256>,
+			estimate: bool,
+			access_list: Option<Vec<(H160, Vec<H256>)>>,
+		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
+			let config = if estimate {
+				let mut config = <Runtime as pallet_evm::Config>::config().clone();
+				config.estimate = true;
+				Some(config)
+			} else {
+				None
+			};
+
+			<Runtime as pallet_evm::Config>::Runner::create(
+				from,
+				data,
+				value,
+				gas_limit.low_u64(),
+				max_fee_per_gas,
+				max_priority_fee_per_gas,
+				nonce,
+				access_list.unwrap_or_default(),
+				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
+			).map_err(|err| err.into())
+		}
+
+		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {
+			Ethereum::current_transaction_statuses()
+		}
+
+		fn current_block() -> Option<pallet_ethereum::Block> {
+			Ethereum::current_block()
+		}
+
+		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
+			Ethereum::current_receipts()
+		}
+
+		fn current_all() -> (
+			Option<pallet_ethereum::Block>,
+			Option<Vec<pallet_ethereum::Receipt>>,
+			Option<Vec<TransactionStatus>>
+		) {
+			(
+				Ethereum::current_block(),
+				Ethereum::current_receipts(),
+				Ethereum::current_transaction_statuses()
+			)
+		}
+
+		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {
+			xts.into_iter().filter_map(|xt| match xt.0.function {
+				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),
+				_ => None
+			}).collect()
+		}
+
+		fn elasticity() -> Option<Permill> {
+			None
+		}
+	}
+
+	impl sp_session::SessionKeys<Block> for Runtime {
+		fn decode_session_keys(
+			encoded: Vec<u8>,
+		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
+			SessionKeys::decode_into_raw_public_keys(&encoded)
+		}
+
+		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
+			SessionKeys::generate(seed)
+		}
+	}
+
+	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
+		fn slot_duration() -> sp_consensus_aura::SlotDuration {
+			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
+		}
+
+		fn authorities() -> Vec<AuraId> {
+			Aura::authorities().to_vec()
+		}
+	}
+
+	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
+		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
+			ParachainSystem::collect_collation_info(header)
+		}
+	}
+
+	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
+		fn account_nonce(account: AccountId) -> Index {
+			System::account_nonce(account)
+		}
+	}
+
+	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
+		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
+			TransactionPayment::query_info(uxt, len)
+		}
+		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {
+			TransactionPayment::query_fee_details(uxt, len)
+		}
+	}
+
+	/*
+	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
+		for Runtime
+	{
+		fn call(
+			origin: AccountId,
+			dest: AccountId,
+			value: Balance,
+			gas_limit: u64,
+			input_data: Vec<u8>,
+		) -> pallet_contracts_primitives::ContractExecResult {
+			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)
+		}
+
+		fn instantiate(
+			origin: AccountId,
+			endowment: Balance,
+			gas_limit: u64,
+			code: pallet_contracts_primitives::Code<Hash>,
+			data: Vec<u8>,
+			salt: Vec<u8>,
+		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>
+		{
+			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)
+		}
+
+		fn get_storage(
+			address: AccountId,
+			key: [u8; 32],
+		) -> pallet_contracts_primitives::GetStorageResult {
+			Contracts::get_storage(address, key)
+		}
+
+		fn rent_projection(
+			address: AccountId,
+		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {
+			Contracts::rent_projection(address)
+		}
+	}
+	*/
+
+	#[cfg(feature = "runtime-benchmarks")]
+	impl frame_benchmarking::Benchmark<Block> for Runtime {
+		fn benchmark_metadata(extra: bool) -> (
+			Vec<frame_benchmarking::BenchmarkList>,
+			Vec<frame_support::traits::StorageInfo>,
+		) {
+			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
+			use frame_support::traits::StorageInfoTrait;
+
+			let mut list = Vec::<BenchmarkList>::new();
+
+			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
+			list_benchmark!(list, extra, pallet_unique, Unique);
+			list_benchmark!(list, extra, pallet_inflation, Inflation);
+			list_benchmark!(list, extra, pallet_fungible, Fungible);
+			list_benchmark!(list, extra, pallet_refungible, Refungible);
+			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
+			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
+
+			let storage_info = AllPalletsReversedWithSystemFirst::storage_info();
+
+			return (list, storage_info)
+		}
+
+		fn dispatch_benchmark(
+			config: frame_benchmarking::BenchmarkConfig
+		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
+			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
+
+			let allowlist: Vec<TrackedStorageKey> = vec![
+				// Block Number
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
+				// Total Issuance
+				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
+				// Execution Phase
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
+				// Event Count
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
+				// System Events
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
+			];
+
+			let mut batches = Vec::<BenchmarkBatch>::new();
+			let params = (&config, &allowlist);
+
+			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
+			add_benchmark!(params, batches, pallet_unique, Unique);
+			add_benchmark!(params, batches, pallet_inflation, Inflation);
+			add_benchmark!(params, batches, pallet_fungible, Fungible);
+			add_benchmark!(params, batches, pallet_refungible, Refungible);
+			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
+			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
+
+			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
+			Ok(batches)
+		}
+	}
+}
+
+struct CheckInherents;
+
+impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
+	fn check_inherents(
+		block: &Block,
+		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
+	) -> sp_inherents::CheckInherentsResult {
+		let relay_chain_slot = relay_state_proof
+			.read_slot()
+			.expect("Could not read the relay chain slot from the proof");
+
+		let inherent_data =
+			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(
+				relay_chain_slot,
+				sp_std::time::Duration::from_secs(6),
+			)
+			.create_inherent_data()
+			.expect("Could not create the timestamp inherent data");
+
+		inherent_data.check_extrinsics(block)
+	}
+}
+
+cumulus_pallet_parachain_system::register_validate_block!(
+	Runtime = Runtime,
+	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
+	CheckInherents = CheckInherents,
+);
addedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/runtime/quartz/Cargo.toml
@@ -0,0 +1,410 @@
+################################################################################
+# Package
+
+[package]
+authors = ['Unique Network <support@uniquenetwork.io>']
+build = 'build.rs'
+description = 'Quartz Runtime'
+edition = '2021'
+homepage = 'https://unique.network'
+license = 'All Rights Reserved'
+name = 'quartz-runtime'
+repository = 'https://github.com/UniqueNetwork/unique-chain'
+version = '0.1.0'
+
+[package.metadata.docs.rs]
+targets = ['x86_64-unknown-linux-gnu']
+
+[features]
+default = ['std']
+runtime-benchmarks = [
+    'hex-literal',
+    'frame-benchmarking',
+    'frame-support/runtime-benchmarks',
+    'frame-system-benchmarking',
+    'frame-system/runtime-benchmarks',
+    'pallet-ethereum/runtime-benchmarks',
+    'pallet-evm-migration/runtime-benchmarks',
+    'pallet-evm-coder-substrate/runtime-benchmarks',
+    'pallet-balances/runtime-benchmarks',
+    'pallet-timestamp/runtime-benchmarks',
+    'pallet-common/runtime-benchmarks',
+    'pallet-fungible/runtime-benchmarks',
+    'pallet-refungible/runtime-benchmarks',
+    'pallet-nonfungible/runtime-benchmarks',
+    'pallet-unique/runtime-benchmarks',
+    'pallet-inflation/runtime-benchmarks',
+    'pallet-xcm/runtime-benchmarks',
+    'sp-runtime/runtime-benchmarks',
+    'xcm-builder/runtime-benchmarks',
+]
+std = [
+    'codec/std',
+    'cumulus-pallet-aura-ext/std',
+    'cumulus-pallet-parachain-system/std',
+    'cumulus-pallet-xcm/std',
+    'cumulus-pallet-xcmp-queue/std',
+    'cumulus-primitives-core/std',
+    'cumulus-primitives-utility/std',
+    'frame-executive/std',
+    'frame-support/std',
+    'frame-system/std',
+    'frame-system-rpc-runtime-api/std',
+    'pallet-aura/std',
+    'pallet-balances/std',
+    # 'pallet-contracts/std',
+    # 'pallet-contracts-primitives/std',
+    # 'pallet-contracts-rpc-runtime-api/std',
+    # 'pallet-contract-helpers/std',
+    'pallet-randomness-collective-flip/std',
+    'pallet-sudo/std',
+    'pallet-timestamp/std',
+    'pallet-transaction-payment/std',
+    'pallet-transaction-payment-rpc-runtime-api/std',
+    'pallet-treasury/std',
+    # 'pallet-vesting/std',
+    'pallet-evm/std',
+    'pallet-evm-migration/std',
+    'pallet-evm-contract-helpers/std',
+    'pallet-evm-transaction-payment/std',
+    'pallet-evm-coder-substrate/std',
+    'pallet-ethereum/std',
+    'pallet-base-fee/std',
+    'fp-rpc/std',
+    'up-rpc/std',
+    'up-evm-mapping/std',
+    'fp-self-contained/std',
+    'parachain-info/std',
+    'serde',
+    'pallet-inflation/std',
+    'pallet-common/std',
+    'pallet-fungible/std',
+    'pallet-refungible/std',
+    'pallet-nonfungible/std',
+    'pallet-unique/std',
+    'pallet-unq-scheduler/std',
+    'pallet-charge-transaction/std',
+    'up-data-structs/std',
+    'sp-api/std',
+    'sp-block-builder/std',
+    "sp-consensus-aura/std",
+    'sp-core/std',
+    'sp-inherents/std',
+    'sp-io/std',
+    'sp-offchain/std',
+    'sp-runtime/std',
+    'sp-session/std',
+    'sp-std/std',
+    'sp-transaction-pool/std',
+    'sp-version/std',
+    'xcm/std',
+    'xcm-builder/std',
+    'xcm-executor/std',
+
+    "orml-vesting/std",
+]
+limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
+
+################################################################################
+# Substrate Dependencies
+
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '2.3.0'
+
+[dependencies.frame-benchmarking]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+optional = true
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-executive]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-support]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-system]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-system-benchmarking]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+optional = true
+branch = 'polkadot-v0.9.16'
+
+[dependencies.frame-system-rpc-runtime-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.hex-literal]
+optional = true
+version = '0.3.3'
+
+[dependencies.serde]
+default-features = false
+features = ['derive']
+optional = true
+version = '1.0.130'
+
+[dependencies.pallet-aura]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-balances]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+# Contracts specific packages
+# [dependencies.pallet-contracts]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.16'
+# version = '4.0.0-dev'
+
+# [dependencies.pallet-contracts-primitives]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.16'
+# version = '4.0.0-dev'
+
+# [dependencies.pallet-contracts-rpc-runtime-api]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.16'
+# version = '4.0.0-dev'
+
+[dependencies.pallet-randomness-collective-flip]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-sudo]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-timestamp]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-transaction-payment]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-transaction-payment-rpc-runtime-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.pallet-treasury]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+# [dependencies.pallet-vesting]
+# default-features = false
+# git = 'https://github.com/paritytech/substrate.git'
+# branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-arithmetic]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-block-builder]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-core]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-consensus-aura]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-inherents]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-io]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-offchain]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-runtime]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-session]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-std]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-transaction-pool]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.sp-version]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.smallvec]
+version = '1.6.1'
+
+################################################################################
+# Cumulus dependencies
+
+[dependencies.parachain-info]
+default-features = false
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+
+[dependencies.cumulus-pallet-aura-ext]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-pallet-parachain-system]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-primitives-core]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-pallet-xcm]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-pallet-dmp-queue]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-pallet-xcmp-queue]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-primitives-utility]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+[dependencies.cumulus-primitives-timestamp]
+git = 'https://github.com/paritytech/cumulus.git'
+branch = 'polkadot-v0.9.16'
+default-features = false
+
+################################################################################
+# Polkadot dependencies
+
+[dependencies.polkadot-parachain]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.xcm]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.xcm-builder]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.xcm-executor]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.pallet-xcm]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.16'
+default-features = false
+
+[dependencies.orml-vesting]
+git = 'https://github.com/UniqueNetwork/open-runtime-module-library'
+branch = 'unique-polkadot-v0.9.16'
+version = "0.4.1-dev"
+default-features = false
+
+################################################################################
+# local dependencies
+
+[dependencies]
+unique-runtime-common = { path = "../common", default-features = false }
+scale-info = { version = "1.0.0", default-features = false, features = [
+    "derive",
+] }
+derivative = "2.2.0"
+pallet-unique = { path = '../../pallets/unique', default-features = false }
+up-rpc = { path = "../../primitives/rpc", default-features = false }
+up-evm-mapping = { path = "../../primitives/evm-mapping", default-features = false }
+pallet-inflation = { path = '../../pallets/inflation', default-features = false }
+up-data-structs = { path = '../../primitives/data-structs', default-features = false }
+pallet-common = { default-features = false, path = "../../pallets/common" }
+pallet-fungible = { default-features = false, path = "../../pallets/fungible" }
+pallet-refungible = { default-features = false, path = "../../pallets/refungible" }
+pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
+pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
+pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.16', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
+pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
+pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
+pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
+pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
+
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
+
+################################################################################
+# Build Dependencies
+
+[build-dependencies.substrate-wasm-builder]
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.16'
addedruntime/quartz/build.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/quartz/build.rs
@@ -0,0 +1,9 @@
+use substrate_wasm_builder::WasmBuilder;
+
+fn main() {
+	WasmBuilder::new()
+		.with_current_project()
+		.import_memory()
+		.export_heap_base()
+		.build()
+}
addedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/quartz/src/lib.rs
@@ -0,0 +1,1528 @@
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
+#![recursion_limit = "1024"]
+#![allow(clippy::from_over_into, clippy::identity_op)]
+#![allow(clippy::fn_to_numeric_cast_with_truncation)]
+// Make the WASM binary available.
+#[cfg(feature = "std")]
+include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
+
+use sp_api::impl_runtime_apis;
+use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};
+use sp_runtime::DispatchError;
+// #[cfg(any(feature = "std", test))]
+// pub use sp_runtime::BuildStorage;
+
+use sp_runtime::{
+	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
+	traits::{
+		AccountIdLookup, BlakeTwo256, Block as BlockT,
+		AccountIdConversion, Zero,
+	},
+	transaction_validity::{TransactionSource, TransactionValidity},
+	ApplyExtrinsicResult, RuntimeAppPublic,
+};
+
+use sp_std::prelude::*;
+
+#[cfg(feature = "std")]
+use sp_version::NativeVersion;
+use sp_version::RuntimeVersion;
+pub use pallet_transaction_payment::{
+	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,
+};
+// A few exports that help ease life for downstream crates.
+pub use pallet_balances::Call as BalancesCall;
+pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};
+pub use frame_support::{
+	construct_runtime, match_type,
+	dispatch::DispatchResult,
+	PalletId, parameter_types, StorageValue, ConsensusEngineId,
+	traits::{
+		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,
+		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,
+		OnUnbalanced, Randomness, FindAuthor,
+	},
+	weights::{
+		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
+		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,
+	},
+};
+use up_data_structs::*;
+// use pallet_contracts::weights::WeightInfo;
+// #[cfg(any(feature = "std", test))]
+use frame_system::{
+	self as frame_system, EnsureRoot, EnsureSigned,
+	limits::{BlockWeights, BlockLength},
+};
+use sp_arithmetic::{
+	traits::{BaseArithmetic, Unsigned},
+};
+use smallvec::smallvec;
+use codec::{Encode, Decode};
+use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};
+use fp_rpc::TransactionStatus;
+use sp_runtime::{
+	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},
+	transaction_validity::TransactionValidityError,
+	SaturatedConversion,
+};
+
+// pub use pallet_timestamp::Call as TimestampCall;
+pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
+
+// Polkadot imports
+use pallet_xcm::XcmPassthrough;
+use polkadot_parachain::primitives::Sibling;
+use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
+use xcm_builder::{
+	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
+	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
+	ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
+};
+use xcm_executor::{Config, XcmExecutor, Assets};
+use sp_std::{marker::PhantomData};
+
+use xcm::latest::{
+	//	Xcm,
+	AssetId::{Concrete},
+	Fungibility::Fungible as XcmFungible,
+	MultiAsset,
+	Error as XcmError,
+};
+use xcm_executor::traits::{MatchesFungible, WeightTrader};
+//use xcm_executor::traits::MatchesFungible;
+use sp_runtime::traits::CheckedConversion;
+
+use unique_runtime_common::{
+	types::*,
+	constants::*,
+};
+
+// mod chain_extension;
+// use crate::chain_extension::{NFTExtension, Imbalance};
+
+pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+
+/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
+/// the specifics of the runtime. They can then be made to be agnostic over specific formats
+/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
+/// to even the core data structures.
+pub mod opaque {
+	use sp_std::prelude::*;
+	use sp_runtime::impl_opaque_keys;
+	use super::Aura;
+
+	pub use unique_runtime_common::types::*;
+	pub use super::CrossAccountId;
+
+	impl_opaque_keys! {
+		pub struct SessionKeys {
+			pub aura: Aura,
+		}
+	}
+}
+
+/// This runtime version.
+pub const VERSION: RuntimeVersion = RuntimeVersion {
+	spec_name: create_runtime_str!("quartz"),
+	impl_name: create_runtime_str!("quartz"),
+	authoring_version: 1,
+	spec_version: 916001,
+	impl_version: 0,
+	apis: RUNTIME_API_VERSIONS,
+	transaction_version: 1,
+	state_version: 0,
+};
+
+#[derive(codec::Encode, codec::Decode)]
+pub enum XCMPMessage<XAccountId, XBalance> {
+	/// Transfer tokens to the given account from the Parachain account.
+	TransferToken(XAccountId, XBalance),
+}
+
+/// The version information used to identify this runtime when compiled natively.
+#[cfg(feature = "std")]
+pub fn native_version() -> NativeVersion {
+	NativeVersion {
+		runtime_version: VERSION,
+		can_author_with: Default::default(),
+	}
+}
+
+type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
+
+pub struct DealWithFees;
+impl OnUnbalanced<NegativeImbalance> for DealWithFees {
+	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {
+		if let Some(fees) = fees_then_tips.next() {
+			// for fees, 100% to treasury
+			let mut split = fees.ration(100, 0);
+			if let Some(tips) = fees_then_tips.next() {
+				// for tips, if any, 100% to treasury
+				tips.ration_merge_into(100, 0, &mut split);
+			}
+			Treasury::on_unbalanced(split.0);
+			// Author::on_unbalanced(split.1);
+		}
+	}
+}
+
+parameter_types! {
+	pub const BlockHashCount: BlockNumber = 2400;
+	pub RuntimeBlockLength: BlockLength =
+		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
+	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
+	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
+	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
+		.base_block(BlockExecutionWeight::get())
+		.for_class(DispatchClass::all(), |weights| {
+			weights.base_extrinsic = ExtrinsicBaseWeight::get();
+		})
+		.for_class(DispatchClass::Normal, |weights| {
+			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
+		})
+		.for_class(DispatchClass::Operational, |weights| {
+			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
+			// Operational transactions have some extra reserved space, so that they
+			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
+			weights.reserved = Some(
+				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
+			);
+		})
+		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
+		.build_or_panic();
+	pub const Version: RuntimeVersion = VERSION;
+	pub const SS58Prefix: u8 = 255;
+}
+
+parameter_types! {
+	pub const ChainId: u64 = 8888;
+}
+
+pub struct FixedFee;
+impl FeeCalculator for FixedFee {
+	fn min_gas_price() -> U256 {
+		// Targeting 0.15 UNQ per transfer
+		1_024_947_215_000u64.into()
+	}
+}
+
+// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case
+// (contract, which only writes a lot of data),
+// approximating on top of our real store write weight
+parameter_types! {
+	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;
+	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;
+	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();
+}
+
+/// Limiting EVM execution to 50% of block for substrate users and management tasks
+/// EVM transaction consumes more weight than substrate's, so we can't rely on them being
+/// scheduled fairly
+const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);
+parameter_types! {
+	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());
+}
+
+pub enum FixedGasWeightMapping {}
+impl GasWeightMapping for FixedGasWeightMapping {
+	fn gas_to_weight(gas: u64) -> Weight {
+		gas.saturating_mul(WeightPerGas::get())
+	}
+	fn weight_to_gas(weight: Weight) -> u64 {
+		weight / WeightPerGas::get()
+	}
+}
+
+impl pallet_evm::Config for Runtime {
+	type BlockGasLimit = BlockGasLimit;
+	type FeeCalculator = FixedFee;
+	type GasWeightMapping = FixedGasWeightMapping;
+	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;
+	type CallOrigin = EnsureAddressTruncated;
+	type WithdrawOrigin = EnsureAddressTruncated;
+	type AddressMapping = HashedAddressMapping<Self::Hashing>;
+	type PrecompilesType = ();
+	type PrecompilesValue = ();
+	type Currency = Balances;
+	type Event = Event;
+	type OnMethodCall = (
+		pallet_evm_migration::OnMethodCall<Self>,
+		pallet_unique::UniqueErcSupport<Self>,
+		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
+	);
+	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
+	type ChainId = ChainId;
+	type Runner = pallet_evm::runner::stack::Runner<Self>;
+	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;
+	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;
+	type FindAuthor = EthereumFindAuthor<Aura>;
+}
+
+impl pallet_evm_migration::Config for Runtime {
+	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;
+}
+
+pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);
+impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {
+	fn find_author<'a, I>(digests: I) -> Option<H160>
+	where
+		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,
+	{
+		if let Some(author_index) = F::find_author(digests) {
+			let authority_id = Aura::authorities()[author_index as usize].clone();
+			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));
+		}
+		None
+	}
+}
+
+impl pallet_ethereum::Config for Runtime {
+	type Event = Event;
+	type StateRoot = pallet_ethereum::IntermediateStateRoot;
+}
+
+impl pallet_randomness_collective_flip::Config for Runtime {}
+
+impl frame_system::Config for Runtime {
+	/// The data to be stored in an account.
+	type AccountData = pallet_balances::AccountData<Balance>;
+	/// The identifier used to distinguish between accounts.
+	type AccountId = AccountId;
+	/// The basic call filter to use in dispatchable.
+	type BaseCallFilter = Everything;
+	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
+	type BlockHashCount = BlockHashCount;
+	/// The maximum length of a block (in bytes).
+	type BlockLength = RuntimeBlockLength;
+	/// The index type for blocks.
+	type BlockNumber = BlockNumber;
+	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.
+	type BlockWeights = RuntimeBlockWeights;
+	/// The aggregated dispatch type that is available for extrinsics.
+	type Call = Call;
+	/// The weight of database operations that the runtime can invoke.
+	type DbWeight = RocksDbWeight;
+	/// The ubiquitous event type.
+	type Event = Event;
+	/// The type for hashing blocks and tries.
+	type Hash = Hash;
+	/// The hashing algorithm used.
+	type Hashing = BlakeTwo256;
+	/// The header type.
+	type Header = generic::Header<BlockNumber, BlakeTwo256>;
+	/// The index type for storing how many extrinsics an account has signed.
+	type Index = Index;
+	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
+	type Lookup = AccountIdLookup<AccountId, ()>;
+	/// What to do if an account is fully reaped from the system.
+	type OnKilledAccount = ();
+	/// What to do if a new account is created.
+	type OnNewAccount = ();
+	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
+	/// The ubiquitous origin type.
+	type Origin = Origin;
+	/// This type is being generated by `construct_runtime!`.
+	type PalletInfo = PalletInfo;
+	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
+	type SS58Prefix = SS58Prefix;
+	/// Weight information for the extrinsics of this pallet.
+	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;
+	/// Version of the runtime.
+	type Version = Version;
+	type MaxConsumers = ConstU32<16>;
+}
+
+parameter_types! {
+	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
+}
+
+impl pallet_timestamp::Config for Runtime {
+	/// A timestamp: milliseconds since the unix epoch.
+	type Moment = u64;
+	type OnTimestampSet = ();
+	type MinimumPeriod = MinimumPeriod;
+	type WeightInfo = ();
+}
+
+parameter_types! {
+	// pub const ExistentialDeposit: u128 = 500;
+	pub const ExistentialDeposit: u128 = 0;
+	pub const MaxLocks: u32 = 50;
+}
+
+impl pallet_balances::Config for Runtime {
+	type MaxLocks = MaxLocks;
+	type MaxReserves = ();
+	type ReserveIdentifier = [u8; 8];
+	/// The type for recording an account's balance.
+	type Balance = Balance;
+	/// The ubiquitous event type.
+	type Event = Event;
+	type DustRemoval = Treasury;
+	type ExistentialDeposit = ExistentialDeposit;
+	type AccountStore = System;
+	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
+}
+
+pub const MICROUNIQUE: Balance = 1_000_000_000_000;
+pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;
+pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;
+pub const UNIQUE: Balance = 100 * CENTIUNIQUE;
+
+pub const fn deposit(items: u32, bytes: u32) -> Balance {
+	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE
+}
+
+/*
+parameter_types! {
+	pub TombstoneDeposit: Balance = deposit(
+		1,
+		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,
+	);
+	pub DepositPerContract: Balance = TombstoneDeposit::get();
+	pub const DepositPerStorageByte: Balance = deposit(0, 1);
+	pub const DepositPerStorageItem: Balance = deposit(1, 0);
+	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);
+	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;
+	pub const SignedClaimHandicap: u32 = 2;
+	pub const MaxDepth: u32 = 32;
+	pub const MaxValueSize: u32 = 16 * 1024;
+	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb
+	// The lazy deletion runs inside on_initialize.
+	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *
+		RuntimeBlockWeights::get().max_block;
+	// The weight needed for decoding the queue should be less or equal than a fifth
+	// of the overall weight dedicated to the lazy deletion.
+	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (
+			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -
+			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)
+		)) / 5) as u32;
+	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
+}
+
+impl pallet_contracts::Config for Runtime {
+	type Time = Timestamp;
+	type Randomness = RandomnessCollectiveFlip;
+	type Currency = Balances;
+	type Event = Event;
+	type RentPayment = ();
+	type SignedClaimHandicap = SignedClaimHandicap;
+	type TombstoneDeposit = TombstoneDeposit;
+	type DepositPerContract = DepositPerContract;
+	type DepositPerStorageByte = DepositPerStorageByte;
+	type DepositPerStorageItem = DepositPerStorageItem;
+	type RentFraction = RentFraction;
+	type SurchargeReward = SurchargeReward;
+	type WeightPrice = pallet_transaction_payment::Pallet<Self>;
+	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
+	type ChainExtension = NFTExtension;
+	type DeletionQueueDepth = DeletionQueueDepth;
+	type DeletionWeightLimit = DeletionWeightLimit;
+	type Schedule = Schedule;
+	type CallStack = [pallet_contracts::Frame<Self>; 31];
+}
+*/
+
+parameter_types! {
+	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer
+	/// This value increases the priority of `Operational` transactions by adding
+	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.
+	pub const OperationalFeeMultiplier: u8 = 5;
+}
+
+/// Linear implementor of `WeightToFeePolynomial`
+pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);
+
+impl<T> WeightToFeePolynomial for LinearFee<T>
+where
+	T: BaseArithmetic + From<u32> + Copy + Unsigned,
+{
+	type Balance = T;
+
+	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
+		smallvec!(WeightToFeeCoefficient {
+			// Targeting 0.1 Unique per NFT transfer
+			coeff_integer: 142_688_000u32.into(),
+			coeff_frac: Perbill::zero(),
+			negative: false,
+			degree: 1,
+		})
+	}
+}
+
+impl pallet_transaction_payment::Config for Runtime {
+	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;
+	type TransactionByteFee = TransactionByteFee;
+	type OperationalFeeMultiplier = OperationalFeeMultiplier;
+	type WeightToFee = LinearFee<Balance>;
+	type FeeMultiplierUpdate = ();
+}
+
+parameter_types! {
+	pub const ProposalBond: Permill = Permill::from_percent(5);
+	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;
+	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;
+	pub const SpendPeriod: BlockNumber = 5 * MINUTES;
+	pub const Burn: Permill = Permill::from_percent(0);
+	pub const TipCountdown: BlockNumber = 1 * DAYS;
+	pub const TipFindersFee: Percent = Percent::from_percent(20);
+	pub const TipReportDepositBase: Balance = 1 * UNIQUE;
+	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;
+	pub const BountyDepositBase: Balance = 1 * UNIQUE;
+	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;
+	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");
+	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;
+	pub const MaximumReasonLength: u32 = 16384;
+	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
+	pub const BountyValueMinimum: Balance = 5 * UNIQUE;
+	pub const MaxApprovals: u32 = 100;
+}
+
+impl pallet_treasury::Config for Runtime {
+	type PalletId = TreasuryModuleId;
+	type Currency = Balances;
+	type ApproveOrigin = EnsureRoot<AccountId>;
+	type RejectOrigin = EnsureRoot<AccountId>;
+	type Event = Event;
+	type OnSlash = ();
+	type ProposalBond = ProposalBond;
+	type ProposalBondMinimum = ProposalBondMinimum;
+	type ProposalBondMaximum = ProposalBondMaximum;
+	type SpendPeriod = SpendPeriod;
+	type Burn = Burn;
+	type BurnDestination = ();
+	type SpendFunds = ();
+	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;
+	type MaxApprovals = MaxApprovals;
+}
+
+impl pallet_sudo::Config for Runtime {
+	type Event = Event;
+	type Call = Call;
+}
+
+pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);
+
+impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider
+	for RelayChainBlockNumberProvider<T>
+{
+	type BlockNumber = BlockNumber;
+
+	fn current_block_number() -> Self::BlockNumber {
+		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()
+			.map(|d| d.relay_parent_number)
+			.unwrap_or_default()
+	}
+}
+
+parameter_types! {
+	pub const MinVestedTransfer: Balance = 10 * UNIQUE;
+	pub const MaxVestingSchedules: u32 = 28;
+}
+
+impl orml_vesting::Config for Runtime {
+	type Event = Event;
+	type Currency = pallet_balances::Pallet<Runtime>;
+	type MinVestedTransfer = MinVestedTransfer;
+	type VestedTransferOrigin = EnsureSigned<AccountId>;
+	type WeightInfo = ();
+	type MaxVestingSchedules = MaxVestingSchedules;
+	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
+}
+
+parameter_types! {
+	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
+	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
+}
+
+impl cumulus_pallet_parachain_system::Config for Runtime {
+	type Event = Event;
+	type SelfParaId = parachain_info::Pallet<Self>;
+	type OnSystemEvent = ();
+	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<
+	// 	MaxDownwardMessageWeight,
+	// 	XcmExecutor<XcmConfig>,
+	// 	Call,
+	// >;
+	type OutboundXcmpMessageSource = XcmpQueue;
+	type DmpMessageHandler = DmpQueue;
+	type ReservedDmpWeight = ReservedDmpWeight;
+	type ReservedXcmpWeight = ReservedXcmpWeight;
+	type XcmpMessageHandler = XcmpQueue;
+}
+
+impl parachain_info::Config for Runtime {}
+
+impl cumulus_pallet_aura_ext::Config for Runtime {}
+
+parameter_types! {
+	pub const RelayLocation: MultiLocation = MultiLocation::parent();
+	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
+	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
+	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
+}
+
+/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
+/// when determining ownership of accounts for asset transacting and when attempting to use XCM
+/// `Transact` in order to determine the dispatch Origin.
+pub type LocationToAccountId = (
+	// The parent (Relay-chain) origin converts to the default `AccountId`.
+	ParentIsDefault<AccountId>,
+	// Sibling parachain origins convert to AccountId via the `ParaId::into`.
+	SiblingParachainConvertsVia<Sibling, AccountId>,
+	// Straight up local `AccountId32` origins just alias directly to `AccountId`.
+	AccountId32Aliases<RelayNetwork, AccountId>,
+);
+
+pub struct OnlySelfCurrency;
+impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {
+	fn matches_fungible(a: &MultiAsset) -> Option<B> {
+		match (&a.id, &a.fun) {
+			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),
+			_ => None,
+		}
+	}
+}
+
+/// Means for transacting assets on this chain.
+pub type LocalAssetTransactor = CurrencyAdapter<
+	// Use this currency:
+	Balances,
+	// Use this currency when it is a fungible asset matching the given location or name:
+	OnlySelfCurrency,
+	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
+	LocationToAccountId,
+	// Our chain's account ID type (we can't get away without mentioning it explicitly):
+	AccountId,
+	// We don't track any teleports.
+	(),
+>;
+
+/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
+/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
+/// biases the kind of local `Origin` it will become.
+pub type XcmOriginToTransactDispatchOrigin = (
+	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
+	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
+	// foreign chains who want to have a local sovereign account on this chain which they control.
+	SovereignSignedViaLocation<LocationToAccountId, Origin>,
+	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when
+	// recognised.
+	RelayChainAsNative<RelayOrigin, Origin>,
+	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
+	// recognised.
+	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
+	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
+	// transaction from the Root origin.
+	ParentAsSuperuser<Origin>,
+	// Native signed account converter; this just converts an `AccountId32` origin into a normal
+	// `Origin::Signed` origin of the same 32-byte value.
+	SignedAccountId32AsNative<RelayNetwork, Origin>,
+	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
+	XcmPassthrough<Origin>,
+);
+
+parameter_types! {
+	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.
+	pub UnitWeightCost: Weight = 1_000_000;
+	// 1200 UNIQUEs buy 1 second of weight.
+	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);
+	pub const MaxInstructions: u32 = 100;
+	pub const MaxAuthorities: u32 = 100_000;
+}
+
+match_type! {
+	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
+		MultiLocation { parents: 1, interior: Here } |
+		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
+	};
+}
+
+pub type Barrier = (
+	TakeWeightCredit,
+	AllowTopLevelPaidExecutionFrom<Everything>,
+	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,
+	// ^^^ Parent & its unit plurality gets free execution
+);
+
+pub struct UsingOnlySelfCurrencyComponents<
+	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+	AssetId: Get<MultiLocation>,
+	AccountId,
+	Currency: CurrencyT<AccountId>,
+	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+>(
+	Weight,
+	Currency::Balance,
+	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,
+);
+impl<
+		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+		AssetId: Get<MultiLocation>,
+		AccountId,
+		Currency: CurrencyT<AccountId>,
+		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+	> WeightTrader
+	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>
+{
+	fn new() -> Self {
+		Self(0, Zero::zero(), PhantomData)
+	}
+
+	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {
+		let amount = WeightToFee::calc(&weight);
+		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;
+
+		// location to this parachain through relay chain
+		let option1: xcm::v1::AssetId = Concrete(MultiLocation {
+			parents: 1,
+			interior: X1(Parachain(ParachainInfo::parachain_id().into())),
+		});
+		// direct location
+		let option2: xcm::v1::AssetId = Concrete(MultiLocation {
+			parents: 0,
+			interior: Here,
+		});
+
+		let required = if payment.fungible.contains_key(&option1) {
+			(option1, u128_amount).into()
+		} else if payment.fungible.contains_key(&option2) {
+			(option2, u128_amount).into()
+		} else {
+			(Concrete(MultiLocation::default()), u128_amount).into()
+		};
+
+		let unused = payment
+			.checked_sub(required)
+			.map_err(|_| XcmError::TooExpensive)?;
+		self.0 = self.0.saturating_add(weight);
+		self.1 = self.1.saturating_add(amount);
+		Ok(unused)
+	}
+
+	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {
+		let weight = weight.min(self.0);
+		let amount = WeightToFee::calc(&weight);
+		self.0 -= weight;
+		self.1 = self.1.saturating_sub(amount);
+		let amount: u128 = amount.saturated_into();
+		if amount > 0 {
+			Some((AssetId::get(), amount).into())
+		} else {
+			None
+		}
+	}
+}
+impl<
+		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+		AssetId: Get<MultiLocation>,
+		AccountId,
+		Currency: CurrencyT<AccountId>,
+		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+	> Drop
+	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>
+{
+	fn drop(&mut self) {
+		OnUnbalanced::on_unbalanced(Currency::issue(self.1));
+	}
+}
+
+pub struct XcmConfig;
+impl Config for XcmConfig {
+	type Call = Call;
+	type XcmSender = XcmRouter;
+	// How to withdraw and deposit an asset.
+	type AssetTransactor = LocalAssetTransactor;
+	type OriginConverter = XcmOriginToTransactDispatchOrigin;
+	type IsReserve = NativeAsset;
+	type IsTeleporter = (); // Teleportation is disabled
+	type LocationInverter = LocationInverter<Ancestry>;
+	type Barrier = Barrier;
+	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
+	type Trader = UsingOnlySelfCurrencyComponents<
+		IdentityFee<Balance>,
+		RelayLocation,
+		AccountId,
+		Balances,
+		(),
+	>;
+	type ResponseHandler = (); // Don't handle responses for now.
+	type SubscriptionService = PolkadotXcm;
+
+	type AssetTrap = PolkadotXcm;
+	type AssetClaims = PolkadotXcm;
+}
+
+// parameter_types! {
+// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;
+// }
+
+/// No local origins on this chain are allowed to dispatch XCM sends/executions.
+pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);
+
+/// The means for routing XCM messages which are not for local execution into the right message
+/// queues.
+pub type XcmRouter = (
+	// Two routers - use UMP to communicate with the relay chain:
+	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,
+	// ..and XCMP to communicate with the sibling chains.
+	XcmpQueue,
+);
+
+impl pallet_evm_coder_substrate::Config for Runtime {
+	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;
+	type GasWeightMapping = FixedGasWeightMapping;
+}
+
+impl pallet_xcm::Config for Runtime {
+	type Event = Event;
+	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
+	type XcmRouter = XcmRouter;
+	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
+	type XcmExecuteFilter = Everything;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type XcmTeleportFilter = Everything;
+	type XcmReserveTransferFilter = Everything;
+	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
+	type LocationInverter = LocationInverter<Ancestry>;
+	type Origin = Origin;
+	type Call = Call;
+	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
+	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
+}
+
+impl cumulus_pallet_xcm::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+}
+
+impl cumulus_pallet_xcmp_queue::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type ChannelInfo = ParachainSystem;
+	type VersionWrapper = ();
+	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+}
+
+impl cumulus_pallet_dmp_queue::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+}
+
+impl pallet_aura::Config for Runtime {
+	type AuthorityId = AuraId;
+	type DisabledValidators = ();
+	type MaxAuthorities = MaxAuthorities;
+}
+
+parameter_types! {
+	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();
+	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;
+}
+
+impl pallet_common::Config for Runtime {
+	type Event = Event;
+	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
+	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
+	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;
+
+	type Currency = Balances;
+	type CollectionCreationPrice = CollectionCreationPrice;
+	type TreasuryAccountId = TreasuryAccountId;
+}
+
+impl pallet_fungible::Config for Runtime {
+	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;
+}
+impl pallet_refungible::Config for Runtime {
+	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;
+}
+impl pallet_nonfungible::Config for Runtime {
+	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
+}
+
+impl pallet_unique::Config for Runtime {
+	type Event = Event;
+	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
+}
+
+parameter_types! {
+	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied
+}
+
+/// Used for the pallet inflation
+impl pallet_inflation::Config for Runtime {
+	type Currency = Balances;
+	type TreasuryAccountId = TreasuryAccountId;
+	type InflationBlockInterval = InflationBlockInterval;
+	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
+}
+
+// parameter_types! {
+// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
+// 		RuntimeBlockWeights::get().max_block;
+// 	pub const MaxScheduledPerBlock: u32 = 50;
+// }
+
+type EvmSponsorshipHandler = (
+	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,
+	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
+);
+type SponsorshipHandler = (
+	pallet_unique::UniqueSponsorshipHandler<Runtime>,
+	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
+	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
+);
+
+// impl pallet_unq_scheduler::Config for Runtime {
+// 	type Event = Event;
+// 	type Origin = Origin;
+// 	type PalletsOrigin = OriginCaller;
+// 	type Call = Call;
+// 	type MaximumWeight = MaximumSchedulerWeight;
+// 	type ScheduleOrigin = EnsureSigned<AccountId>;
+// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;
+// 	type SponsorshipHandler = SponsorshipHandler;
+// 	type WeightInfo = ();
+// }
+
+impl pallet_evm_transaction_payment::Config for Runtime {
+	type EvmSponsorshipHandler = EvmSponsorshipHandler;
+	type Currency = Balances;
+	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
+	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
+}
+
+impl pallet_charge_transaction::Config for Runtime {
+	type SponsorshipHandler = SponsorshipHandler;
+}
+
+// impl pallet_contract_helpers::Config for Runtime {
+//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
+// }
+
+parameter_types! {
+	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049
+	pub const HelpersContractAddress: H160 = H160([
+		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,
+	]);
+}
+
+impl pallet_evm_contract_helpers::Config for Runtime {
+	type ContractAddress = HelpersContractAddress;
+	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
+}
+
+construct_runtime!(
+	pub enum Runtime where
+		Block = Block,
+		NodeBlock = opaque::Block,
+		UncheckedExtrinsic = UncheckedExtrinsic
+	{
+		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,
+		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
+
+		Aura: pallet_aura::{Pallet, Config<T>} = 22,
+		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,
+
+		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
+		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,
+		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,
+		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,
+		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,
+		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,
+		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,
+		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,
+		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
+		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
+
+		// XCM helpers.
+		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,
+		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,
+		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,
+		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
+
+		// Unique Pallets
+		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
+		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
+		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+		// free = 63
+		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
+		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
+		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,
+		Fungible: pallet_fungible::{Pallet, Storage} = 67,
+		Refungible: pallet_refungible::{Pallet, Storage} = 68,
+		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
+
+		// Frontier
+		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,
+		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,
+
+		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,
+		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,
+		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,
+		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,
+	}
+);
+
+pub struct TransactionConverter;
+
+impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
+	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
+		UncheckedExtrinsic::new_unsigned(
+			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
+		)
+	}
+}
+
+impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {
+	fn convert_transaction(
+		&self,
+		transaction: pallet_ethereum::Transaction,
+	) -> opaque::UncheckedExtrinsic {
+		let extrinsic = UncheckedExtrinsic::new_unsigned(
+			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
+		);
+		let encoded = extrinsic.encode();
+		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])
+			.expect("Encoded extrinsic is always valid")
+	}
+}
+
+/// The address format for describing accounts.
+pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
+/// Block header type as expected by this runtime.
+pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
+/// Block type as expected by this runtime.
+pub type Block = generic::Block<Header, UncheckedExtrinsic>;
+/// A Block signed with a Justification
+pub type SignedBlock = generic::SignedBlock<Block>;
+/// BlockId type as expected by this runtime.
+pub type BlockId = generic::BlockId<Block>;
+/// The SignedExtension to the basic transaction logic.
+pub type SignedExtra = (
+	frame_system::CheckSpecVersion<Runtime>,
+	// system::CheckTxVersion<Runtime>,
+	frame_system::CheckGenesis<Runtime>,
+	frame_system::CheckEra<Runtime>,
+	frame_system::CheckNonce<Runtime>,
+	frame_system::CheckWeight<Runtime>,
+	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,
+	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,
+);
+/// Unchecked extrinsic type as expected by this runtime.
+pub type UncheckedExtrinsic =
+	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
+/// Extrinsic type that has already been checked.
+pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;
+/// Executive: handles dispatch to the various modules.
+pub type Executive = frame_executive::Executive<
+	Runtime,
+	Block,
+	frame_system::ChainContext<Runtime>,
+	Runtime,
+	AllPalletsReversedWithSystemFirst,
+>;
+
+impl_opaque_keys! {
+	pub struct SessionKeys {
+		pub aura: Aura,
+	}
+}
+
+impl fp_self_contained::SelfContainedCall for Call {
+	type SignedInfo = H160;
+
+	fn is_self_contained(&self) -> bool {
+		match self {
+			Call::Ethereum(call) => call.is_self_contained(),
+			_ => false,
+		}
+	}
+
+	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {
+		match self {
+			Call::Ethereum(call) => call.check_self_contained(),
+			_ => None,
+		}
+	}
+
+	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {
+		match self {
+			Call::Ethereum(call) => call.validate_self_contained(info),
+			_ => None,
+		}
+	}
+
+	fn pre_dispatch_self_contained(
+		&self,
+		info: &Self::SignedInfo,
+	) -> Option<Result<(), TransactionValidityError>> {
+		match self {
+			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),
+			_ => None,
+		}
+	}
+
+	fn apply_self_contained(
+		self,
+		info: Self::SignedInfo,
+	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {
+		match self {
+			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(
+				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),
+			)),
+			_ => None,
+		}
+	}
+}
+
+macro_rules! dispatch_unique_runtime {
+	($collection:ident.$method:ident($($name:ident),*)) => {{
+		use pallet_unique::dispatch::Dispatched;
+
+		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);
+		let dispatch = collection.as_dyn();
+
+		Ok(dispatch.$method($($name),*))
+	}};
+}
+impl_runtime_apis! {
+	impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>
+		for Runtime
+	{
+		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {
+			dispatch_unique_runtime!(collection.account_tokens(account))
+		}
+		fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {
+			dispatch_unique_runtime!(collection.token_exists(token))
+		}
+
+		fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {
+			dispatch_unique_runtime!(collection.token_owner(token))
+		}
+		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {
+			dispatch_unique_runtime!(collection.const_metadata(token))
+		}
+		fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {
+			dispatch_unique_runtime!(collection.variable_metadata(token))
+		}
+
+		fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {
+			dispatch_unique_runtime!(collection.collection_tokens())
+		}
+		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {
+			dispatch_unique_runtime!(collection.account_balance(account))
+		}
+		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {
+			dispatch_unique_runtime!(collection.balance(account, token))
+		}
+		fn allowance(
+			collection: CollectionId,
+			sender: CrossAccountId,
+			spender: CrossAccountId,
+			token: TokenId,
+		) -> Result<u128, DispatchError> {
+			dispatch_unique_runtime!(collection.allowance(sender, spender, token))
+		}
+
+		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {
+			<pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)
+				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))
+				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))
+		}
+		fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))
+		}
+		fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))
+		}
+		fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))
+		}
+		fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {
+			dispatch_unique_runtime!(collection.last_token_id())
+		}
+		fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {
+			Ok(<pallet_common::CollectionById<Runtime>>::get(collection))
+		}
+		fn collection_stats() -> Result<CollectionStats, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::collection_stats())
+		}
+	}
+
+	impl sp_api::Core<Block> for Runtime {
+		fn version() -> RuntimeVersion {
+			VERSION
+		}
+
+		fn execute_block(block: Block) {
+			Executive::execute_block(block)
+		}
+
+		fn initialize_block(header: &<Block as BlockT>::Header) {
+			Executive::initialize_block(header)
+		}
+	}
+
+	impl sp_api::Metadata<Block> for Runtime {
+		fn metadata() -> OpaqueMetadata {
+			OpaqueMetadata::new(Runtime::metadata().into())
+		}
+	}
+
+	impl sp_block_builder::BlockBuilder<Block> for Runtime {
+		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
+			Executive::apply_extrinsic(extrinsic)
+		}
+
+		fn finalize_block() -> <Block as BlockT>::Header {
+			Executive::finalize_block()
+		}
+
+		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
+			data.create_extrinsics()
+		}
+
+		fn check_inherents(
+			block: Block,
+			data: sp_inherents::InherentData,
+		) -> sp_inherents::CheckInherentsResult {
+			data.check_extrinsics(&block)
+		}
+
+		// fn random_seed() -> <Block as BlockT>::Hash {
+		//     RandomnessCollectiveFlip::random_seed().0
+		// }
+	}
+
+	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
+		fn validate_transaction(
+			source: TransactionSource,
+			tx: <Block as BlockT>::Extrinsic,
+			hash: <Block as BlockT>::Hash,
+		) -> TransactionValidity {
+			Executive::validate_transaction(source, tx, hash)
+		}
+	}
+
+	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
+		fn offchain_worker(header: &<Block as BlockT>::Header) {
+			Executive::offchain_worker(header)
+		}
+	}
+
+	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {
+		fn chain_id() -> u64 {
+			<Runtime as pallet_evm::Config>::ChainId::get()
+		}
+
+		fn account_basic(address: H160) -> EVMAccount {
+			EVM::account_basic(&address)
+		}
+
+		fn gas_price() -> U256 {
+			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()
+		}
+
+		fn account_code_at(address: H160) -> Vec<u8> {
+			EVM::account_codes(address)
+		}
+
+		fn author() -> H160 {
+			<pallet_evm::Pallet<Runtime>>::find_author()
+		}
+
+		fn storage_at(address: H160, index: U256) -> H256 {
+			let mut tmp = [0u8; 32];
+			index.to_big_endian(&mut tmp);
+			EVM::account_storages(address, H256::from_slice(&tmp[..]))
+		}
+
+		#[allow(clippy::redundant_closure)]
+		fn call(
+			from: H160,
+			to: H160,
+			data: Vec<u8>,
+			value: U256,
+			gas_limit: U256,
+			max_fee_per_gas: Option<U256>,
+			max_priority_fee_per_gas: Option<U256>,
+			nonce: Option<U256>,
+			estimate: bool,
+			access_list: Option<Vec<(H160, Vec<H256>)>>,
+		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
+			let config = if estimate {
+				let mut config = <Runtime as pallet_evm::Config>::config().clone();
+				config.estimate = true;
+				Some(config)
+			} else {
+				None
+			};
+
+			<Runtime as pallet_evm::Config>::Runner::call(
+				from,
+				to,
+				data,
+				value,
+				gas_limit.low_u64(),
+				max_fee_per_gas,
+				max_priority_fee_per_gas,
+				nonce,
+				access_list.unwrap_or_default(),
+				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
+			).map_err(|err| err.into())
+		}
+
+		#[allow(clippy::redundant_closure)]
+		fn create(
+			from: H160,
+			data: Vec<u8>,
+			value: U256,
+			gas_limit: U256,
+			max_fee_per_gas: Option<U256>,
+			max_priority_fee_per_gas: Option<U256>,
+			nonce: Option<U256>,
+			estimate: bool,
+			access_list: Option<Vec<(H160, Vec<H256>)>>,
+		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
+			let config = if estimate {
+				let mut config = <Runtime as pallet_evm::Config>::config().clone();
+				config.estimate = true;
+				Some(config)
+			} else {
+				None
+			};
+
+			<Runtime as pallet_evm::Config>::Runner::create(
+				from,
+				data,
+				value,
+				gas_limit.low_u64(),
+				max_fee_per_gas,
+				max_priority_fee_per_gas,
+				nonce,
+				access_list.unwrap_or_default(),
+				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
+			).map_err(|err| err.into())
+		}
+
+		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {
+			Ethereum::current_transaction_statuses()
+		}
+
+		fn current_block() -> Option<pallet_ethereum::Block> {
+			Ethereum::current_block()
+		}
+
+		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
+			Ethereum::current_receipts()
+		}
+
+		fn current_all() -> (
+			Option<pallet_ethereum::Block>,
+			Option<Vec<pallet_ethereum::Receipt>>,
+			Option<Vec<TransactionStatus>>
+		) {
+			(
+				Ethereum::current_block(),
+				Ethereum::current_receipts(),
+				Ethereum::current_transaction_statuses()
+			)
+		}
+
+		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {
+			xts.into_iter().filter_map(|xt| match xt.0.function {
+				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),
+				_ => None
+			}).collect()
+		}
+
+		fn elasticity() -> Option<Permill> {
+			None
+		}
+	}
+
+	impl sp_session::SessionKeys<Block> for Runtime {
+		fn decode_session_keys(
+			encoded: Vec<u8>,
+		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
+			SessionKeys::decode_into_raw_public_keys(&encoded)
+		}
+
+		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
+			SessionKeys::generate(seed)
+		}
+	}
+
+	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
+		fn slot_duration() -> sp_consensus_aura::SlotDuration {
+			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
+		}
+
+		fn authorities() -> Vec<AuraId> {
+			Aura::authorities().to_vec()
+		}
+	}
+
+	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
+		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
+			ParachainSystem::collect_collation_info(header)
+		}
+	}
+
+	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
+		fn account_nonce(account: AccountId) -> Index {
+			System::account_nonce(account)
+		}
+	}
+
+	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
+		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
+			TransactionPayment::query_info(uxt, len)
+		}
+		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {
+			TransactionPayment::query_fee_details(uxt, len)
+		}
+	}
+
+	/*
+	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
+		for Runtime
+	{
+		fn call(
+			origin: AccountId,
+			dest: AccountId,
+			value: Balance,
+			gas_limit: u64,
+			input_data: Vec<u8>,
+		) -> pallet_contracts_primitives::ContractExecResult {
+			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)
+		}
+
+		fn instantiate(
+			origin: AccountId,
+			endowment: Balance,
+			gas_limit: u64,
+			code: pallet_contracts_primitives::Code<Hash>,
+			data: Vec<u8>,
+			salt: Vec<u8>,
+		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>
+		{
+			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)
+		}
+
+		fn get_storage(
+			address: AccountId,
+			key: [u8; 32],
+		) -> pallet_contracts_primitives::GetStorageResult {
+			Contracts::get_storage(address, key)
+		}
+
+		fn rent_projection(
+			address: AccountId,
+		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {
+			Contracts::rent_projection(address)
+		}
+	}
+	*/
+
+	#[cfg(feature = "runtime-benchmarks")]
+	impl frame_benchmarking::Benchmark<Block> for Runtime {
+		fn benchmark_metadata(extra: bool) -> (
+			Vec<frame_benchmarking::BenchmarkList>,
+			Vec<frame_support::traits::StorageInfo>,
+		) {
+			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
+			use frame_support::traits::StorageInfoTrait;
+
+			let mut list = Vec::<BenchmarkList>::new();
+
+			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
+			list_benchmark!(list, extra, pallet_unique, Unique);
+			list_benchmark!(list, extra, pallet_inflation, Inflation);
+			list_benchmark!(list, extra, pallet_fungible, Fungible);
+			list_benchmark!(list, extra, pallet_refungible, Refungible);
+			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
+			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
+
+			let storage_info = AllPalletsReversedWithSystemFirst::storage_info();
+
+			return (list, storage_info)
+		}
+
+		fn dispatch_benchmark(
+			config: frame_benchmarking::BenchmarkConfig
+		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
+			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
+
+			let allowlist: Vec<TrackedStorageKey> = vec![
+				// Block Number
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
+				// Total Issuance
+				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
+				// Execution Phase
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
+				// Event Count
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
+				// System Events
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
+			];
+
+			let mut batches = Vec::<BenchmarkBatch>::new();
+			let params = (&config, &allowlist);
+
+			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
+			add_benchmark!(params, batches, pallet_unique, Unique);
+			add_benchmark!(params, batches, pallet_inflation, Inflation);
+			add_benchmark!(params, batches, pallet_fungible, Fungible);
+			add_benchmark!(params, batches, pallet_refungible, Refungible);
+			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
+			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
+
+			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
+			Ok(batches)
+		}
+	}
+}
+
+struct CheckInherents;
+
+impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
+	fn check_inherents(
+		block: &Block,
+		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
+	) -> sp_inherents::CheckInherentsResult {
+		let relay_chain_slot = relay_state_proof
+			.read_slot()
+			.expect("Could not read the relay chain slot from the proof");
+
+		let inherent_data =
+			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(
+				relay_chain_slot,
+				sp_std::time::Duration::from_secs(6),
+			)
+			.create_inherent_data()
+			.expect("Could not create the timestamp inherent data");
+
+		inherent_data.check_extrinsics(block)
+	}
+}
+
+cumulus_pallet_parachain_system::register_validate_block!(
+	Runtime = Runtime,
+	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
+	CheckInherents = CheckInherents,
+);
deletedruntime/src/lib.rsdiffbeforeafterboth
before · runtime/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::{37		AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify,38		AccountIdConversion, Zero,39	},40	transaction_validity::{TransactionSource, TransactionValidity},41	ApplyExtrinsicResult, MultiSignature, RuntimeAppPublic,42};4344use sp_std::prelude::*;4546#[cfg(feature = "std")]47use sp_version::NativeVersion;48use sp_version::RuntimeVersion;49pub use pallet_transaction_payment::{50	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,51};52// A few exports that help ease life for downstream crates.53pub use pallet_balances::Call as BalancesCall;54pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};55pub use frame_support::{56	construct_runtime, match_type,57	dispatch::DispatchResult,58	PalletId, parameter_types, StorageValue, ConsensusEngineId,59	traits::{60		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,61		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,62		OnUnbalanced, Randomness, FindAuthor,63	},64	weights::{65		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},66		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,67		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,68	},69};70use up_data_structs::*;71// use pallet_contracts::weights::WeightInfo;72// #[cfg(any(feature = "std", test))]73use frame_system::{74	self as frame_system, EnsureRoot, EnsureSigned,75	limits::{BlockWeights, BlockLength},76};77use sp_arithmetic::{78	traits::{BaseArithmetic, Unsigned},79};80use smallvec::smallvec;81use codec::{Encode, Decode};82use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};83use fp_rpc::TransactionStatus;84use sp_runtime::{85	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},86	transaction_validity::TransactionValidityError,87	SaturatedConversion,88};8990// pub use pallet_timestamp::Call as TimestampCall;91pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;9293// Polkadot imports94use pallet_xcm::XcmPassthrough;95use polkadot_parachain::primitives::Sibling;96use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};97use xcm_builder::{98	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,99	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,100	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,101	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,102	ParentIsPreset,103};104use xcm_executor::{Config, XcmExecutor, Assets};105use sp_std::{marker::PhantomData};106107use xcm::latest::{108	//	Xcm,109	AssetId::{Concrete},110	Fungibility::Fungible as XcmFungible,111	MultiAsset,112	Error as XcmError,113};114use xcm_executor::traits::{MatchesFungible, WeightTrader};115//use xcm_executor::traits::MatchesFungible;116use sp_runtime::traits::CheckedConversion;117118// mod chain_extension;119// use crate::chain_extension::{NFTExtension, Imbalance};120121/// An index to a block.122pub type BlockNumber = u32;123124/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.125pub type Signature = MultiSignature;126127/// Some way of identifying an account on the chain. We intentionally make it equivalent128/// to the public key of our transaction signing scheme.129pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;130131pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;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 super::*;155156	pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;157158	/// Opaque block type.159	pub type Block = generic::Block<Header, UncheckedExtrinsic>;160161	pub type SessionHandlers = ();162163	impl_opaque_keys! {164		pub struct SessionKeys {165			pub aura: Aura,166		}167	}168}169170/// This runtime version.171pub const VERSION: RuntimeVersion = RuntimeVersion {172	spec_name: create_runtime_str!("opal"),173	impl_name: create_runtime_str!("opal"),174	authoring_version: 1,175	spec_version: 917004,176	impl_version: 0,177	apis: RUNTIME_API_VERSIONS,178	transaction_version: 1,179	state_version: 0,180};181182pub const MILLISECS_PER_BLOCK: u64 = 12000;183184pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;185186// These time units are defined in number of blocks.187pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);188pub const HOURS: BlockNumber = MINUTES * 60;189pub const DAYS: BlockNumber = HOURS * 24;190191parameter_types! {192	pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;193}194195#[derive(codec::Encode, codec::Decode)]196pub enum XCMPMessage<XAccountId, XBalance> {197	/// Transfer tokens to the given account from the Parachain account.198	TransferToken(XAccountId, XBalance),199}200201/// The version information used to identify this runtime when compiled natively.202#[cfg(feature = "std")]203pub fn native_version() -> NativeVersion {204	NativeVersion {205		runtime_version: VERSION,206		can_author_with: Default::default(),207	}208}209210type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;211212pub struct DealWithFees;213impl OnUnbalanced<NegativeImbalance> for DealWithFees {214	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {215		if let Some(fees) = fees_then_tips.next() {216			// for fees, 100% to treasury217			let mut split = fees.ration(100, 0);218			if let Some(tips) = fees_then_tips.next() {219				// for tips, if any, 100% to treasury220				tips.ration_merge_into(100, 0, &mut split);221			}222			Treasury::on_unbalanced(split.0);223			// Author::on_unbalanced(split.1);224		}225	}226}227228/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.229/// This is used to limit the maximal weight of a single extrinsic.230const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);231/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used232/// by  Operational  extrinsics.233const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);234/// We allow for 2 seconds of compute with a 6 second average block time.235const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;236237parameter_types! {238	pub const BlockHashCount: BlockNumber = 2400;239	pub RuntimeBlockLength: BlockLength =240		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);241	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);242	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;243	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()244		.base_block(BlockExecutionWeight::get())245		.for_class(DispatchClass::all(), |weights| {246			weights.base_extrinsic = ExtrinsicBaseWeight::get();247		})248		.for_class(DispatchClass::Normal, |weights| {249			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);250		})251		.for_class(DispatchClass::Operational, |weights| {252			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);253			// Operational transactions have some extra reserved space, so that they254			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.255			weights.reserved = Some(256				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT257			);258		})259		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)260		.build_or_panic();261	pub const Version: RuntimeVersion = VERSION;262	pub const SS58Prefix: u8 = 42;263}264265/*2668880 - Unique2678881 - Quartz2688882 - Opal269*/270parameter_types! {271	pub const ChainId: u64 = 8882;272}273274pub struct FixedFee;275impl FeeCalculator for FixedFee {276	fn min_gas_price() -> U256 {277		// Targeting 0.15 UNQ per transfer278		1_018_751_825_264u64.into()279	}280}281282// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case283// (contract, which only writes a lot of data),284// approximating on top of our real store write weight285parameter_types! {286	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;287	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;288	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();289}290291/// Limiting EVM execution to 50% of block for substrate users and management tasks292/// EVM transaction consumes more weight than substrate's, so we can't rely on them being293/// scheduled fairly294const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);295parameter_types! {296	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());297}298299pub enum FixedGasWeightMapping {}300impl GasWeightMapping for FixedGasWeightMapping {301	fn gas_to_weight(gas: u64) -> Weight {302		gas.saturating_mul(WeightPerGas::get())303	}304	fn weight_to_gas(weight: Weight) -> u64 {305		weight / WeightPerGas::get()306	}307}308309impl pallet_evm::Config for Runtime {310	type BlockGasLimit = BlockGasLimit;311	type FeeCalculator = FixedFee;312	type GasWeightMapping = FixedGasWeightMapping;313	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;314	type CallOrigin = EnsureAddressTruncated;315	type WithdrawOrigin = EnsureAddressTruncated;316	type AddressMapping = HashedAddressMapping<Self::Hashing>;317	type PrecompilesType = ();318	type PrecompilesValue = ();319	type Currency = Balances;320	type Event = Event;321	type OnMethodCall = (322		pallet_evm_migration::OnMethodCall<Self>,323		pallet_unique::UniqueErcSupport<Self>,324		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,325	);326	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;327	type ChainId = ChainId;328	type Runner = pallet_evm::runner::stack::Runner<Self>;329	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;330	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;331	type FindAuthor = EthereumFindAuthor<Aura>;332}333334impl pallet_evm_migration::Config for Runtime {335	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;336}337338pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);339impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {340	fn find_author<'a, I>(digests: I) -> Option<H160>341	where342		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,343	{344		if let Some(author_index) = F::find_author(digests) {345			let authority_id = Aura::authorities()[author_index as usize].clone();346			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));347		}348		None349	}350}351352impl pallet_ethereum::Config for Runtime {353	type Event = Event;354	type StateRoot = pallet_ethereum::IntermediateStateRoot;355}356357impl pallet_randomness_collective_flip::Config for Runtime {}358359impl frame_system::Config for Runtime {360	/// The data to be stored in an account.361	type AccountData = pallet_balances::AccountData<Balance>;362	/// The identifier used to distinguish between accounts.363	type AccountId = AccountId;364	/// The basic call filter to use in dispatchable.365	type BaseCallFilter = Everything;366	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).367	type BlockHashCount = BlockHashCount;368	/// The maximum length of a block (in bytes).369	type BlockLength = RuntimeBlockLength;370	/// The index type for blocks.371	type BlockNumber = BlockNumber;372	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.373	type BlockWeights = RuntimeBlockWeights;374	/// The aggregated dispatch type that is available for extrinsics.375	type Call = Call;376	/// The weight of database operations that the runtime can invoke.377	type DbWeight = RocksDbWeight;378	/// The ubiquitous event type.379	type Event = Event;380	/// The type for hashing blocks and tries.381	type Hash = Hash;382	/// The hashing algorithm used.383	type Hashing = BlakeTwo256;384	/// The header type.385	type Header = generic::Header<BlockNumber, BlakeTwo256>;386	/// The index type for storing how many extrinsics an account has signed.387	type Index = Index;388	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.389	type Lookup = AccountIdLookup<AccountId, ()>;390	/// What to do if an account is fully reaped from the system.391	type OnKilledAccount = ();392	/// What to do if a new account is created.393	type OnNewAccount = ();394	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;395	/// The ubiquitous origin type.396	type Origin = Origin;397	/// This type is being generated by `construct_runtime!`.398	type PalletInfo = PalletInfo;399	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.400	type SS58Prefix = SS58Prefix;401	/// Weight information for the extrinsics of this pallet.402	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;403	/// Version of the runtime.404	type Version = Version;405	type MaxConsumers = ConstU32<16>;406}407408parameter_types! {409	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;410}411412impl pallet_timestamp::Config for Runtime {413	/// A timestamp: milliseconds since the unix epoch.414	type Moment = u64;415	type OnTimestampSet = ();416	type MinimumPeriod = MinimumPeriod;417	type WeightInfo = ();418}419420parameter_types! {421	// pub const ExistentialDeposit: u128 = 500;422	pub const ExistentialDeposit: u128 = 0;423	pub const MaxLocks: u32 = 50;424}425426impl pallet_balances::Config for Runtime {427	type MaxLocks = MaxLocks;428	type MaxReserves = ();429	type ReserveIdentifier = [u8; 8];430	/// The type for recording an account's balance.431	type Balance = Balance;432	/// The ubiquitous event type.433	type Event = Event;434	type DustRemoval = Treasury;435	type ExistentialDeposit = ExistentialDeposit;436	type AccountStore = System;437	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;438}439440pub const MICROUNIQUE: Balance = 1_000_000_000_000;441pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;442pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;443pub const UNIQUE: Balance = 100 * CENTIUNIQUE;444445pub const fn deposit(items: u32, bytes: u32) -> Balance {446	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE447}448449/*450parameter_types! {451	pub TombstoneDeposit: Balance = deposit(452		1,453		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,454	);455	pub DepositPerContract: Balance = TombstoneDeposit::get();456	pub const DepositPerStorageByte: Balance = deposit(0, 1);457	pub const DepositPerStorageItem: Balance = deposit(1, 0);458	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);459	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;460	pub const SignedClaimHandicap: u32 = 2;461	pub const MaxDepth: u32 = 32;462	pub const MaxValueSize: u32 = 16 * 1024;463	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb464	// The lazy deletion runs inside on_initialize.465	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *466		RuntimeBlockWeights::get().max_block;467	// The weight needed for decoding the queue should be less or equal than a fifth468	// of the overall weight dedicated to the lazy deletion.469	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (470			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -471			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)472		)) / 5) as u32;473	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();474}475476impl pallet_contracts::Config for Runtime {477	type Time = Timestamp;478	type Randomness = RandomnessCollectiveFlip;479	type Currency = Balances;480	type Event = Event;481	type RentPayment = ();482	type SignedClaimHandicap = SignedClaimHandicap;483	type TombstoneDeposit = TombstoneDeposit;484	type DepositPerContract = DepositPerContract;485	type DepositPerStorageByte = DepositPerStorageByte;486	type DepositPerStorageItem = DepositPerStorageItem;487	type RentFraction = RentFraction;488	type SurchargeReward = SurchargeReward;489	type WeightPrice = pallet_transaction_payment::Pallet<Self>;490	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;491	type ChainExtension = NFTExtension;492	type DeletionQueueDepth = DeletionQueueDepth;493	type DeletionWeightLimit = DeletionWeightLimit;494	type Schedule = Schedule;495	type CallStack = [pallet_contracts::Frame<Self>; 31];496}497*/498499parameter_types! {500	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer501	/// This value increases the priority of `Operational` transactions by adding502	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.503	pub const OperationalFeeMultiplier: u8 = 5;504}505506/// Linear implementor of `WeightToFeePolynomial`507pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);508509impl<T> WeightToFeePolynomial for LinearFee<T>510where511	T: BaseArithmetic + From<u32> + Copy + Unsigned,512{513	type Balance = T;514515	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {516		smallvec!(WeightToFeeCoefficient {517			// Targeting 0.1 Unique per NFT transfer518			coeff_integer: 142_688_000u32.into(),519			coeff_frac: Perbill::zero(),520			negative: false,521			degree: 1,522		})523	}524}525526impl pallet_transaction_payment::Config for Runtime {527	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;528	type TransactionByteFee = TransactionByteFee;529	type OperationalFeeMultiplier = OperationalFeeMultiplier;530	type WeightToFee = LinearFee<Balance>;531	type FeeMultiplierUpdate = ();532}533534parameter_types! {535	pub const ProposalBond: Permill = Permill::from_percent(5);536	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;537	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;538	pub const SpendPeriod: BlockNumber = 5 * MINUTES;539	pub const Burn: Permill = Permill::from_percent(0);540	pub const TipCountdown: BlockNumber = 1 * DAYS;541	pub const TipFindersFee: Percent = Percent::from_percent(20);542	pub const TipReportDepositBase: Balance = 1 * UNIQUE;543	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;544	pub const BountyDepositBase: Balance = 1 * UNIQUE;545	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;546	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");547	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;548	pub const MaximumReasonLength: u32 = 16384;549	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);550	pub const BountyValueMinimum: Balance = 5 * UNIQUE;551	pub const MaxApprovals: u32 = 100;552}553554impl pallet_treasury::Config for Runtime {555	type PalletId = TreasuryModuleId;556	type Currency = Balances;557	type ApproveOrigin = EnsureRoot<AccountId>;558	type RejectOrigin = EnsureRoot<AccountId>;559	type Event = Event;560	type OnSlash = ();561	type ProposalBond = ProposalBond;562	type ProposalBondMinimum = ProposalBondMinimum;563	type ProposalBondMaximum = ProposalBondMaximum;564	type SpendPeriod = SpendPeriod;565	type Burn = Burn;566	type BurnDestination = ();567	type SpendFunds = ();568	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;569	type MaxApprovals = MaxApprovals;570}571572impl pallet_sudo::Config for Runtime {573	type Event = Event;574	type Call = Call;575}576577pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);578579impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider580	for RelayChainBlockNumberProvider<T>581{582	type BlockNumber = BlockNumber;583584	fn current_block_number() -> Self::BlockNumber {585		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()586			.map(|d| d.relay_parent_number)587			.unwrap_or_default()588	}589}590591parameter_types! {592	pub const MinVestedTransfer: Balance = 10 * UNIQUE;593	pub const MaxVestingSchedules: u32 = 28;594}595596impl orml_vesting::Config for Runtime {597	type Event = Event;598	type Currency = pallet_balances::Pallet<Runtime>;599	type MinVestedTransfer = MinVestedTransfer;600	type VestedTransferOrigin = EnsureSigned<AccountId>;601	type WeightInfo = ();602	type MaxVestingSchedules = MaxVestingSchedules;603	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;604}605606parameter_types! {607	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;608	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;609}610611impl cumulus_pallet_parachain_system::Config for Runtime {612	type Event = Event;613	type SelfParaId = parachain_info::Pallet<Self>;614	type OnSystemEvent = ();615	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<616	// 	MaxDownwardMessageWeight,617	// 	XcmExecutor<XcmConfig>,618	// 	Call,619	// >;620	type OutboundXcmpMessageSource = XcmpQueue;621	type DmpMessageHandler = DmpQueue;622	type ReservedDmpWeight = ReservedDmpWeight;623	type ReservedXcmpWeight = ReservedXcmpWeight;624	type XcmpMessageHandler = XcmpQueue;625}626627impl parachain_info::Config for Runtime {}628629impl cumulus_pallet_aura_ext::Config for Runtime {}630631parameter_types! {632	pub const RelayLocation: MultiLocation = MultiLocation::parent();633	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;634	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();635	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();636}637638/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used639/// when determining ownership of accounts for asset transacting and when attempting to use XCM640/// `Transact` in order to determine the dispatch Origin.641pub type LocationToAccountId = (642	// The parent (Relay-chain) origin converts to the default `AccountId`.643	ParentIsPreset<AccountId>,644	// Sibling parachain origins convert to AccountId via the `ParaId::into`.645	SiblingParachainConvertsVia<Sibling, AccountId>,646	// Straight up local `AccountId32` origins just alias directly to `AccountId`.647	AccountId32Aliases<RelayNetwork, AccountId>,648);649650pub struct OnlySelfCurrency;651impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {652	fn matches_fungible(a: &MultiAsset) -> Option<B> {653		match (&a.id, &a.fun) {654			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),655			_ => None,656		}657	}658}659660/// Means for transacting assets on this chain.661pub type LocalAssetTransactor = CurrencyAdapter<662	// Use this currency:663	Balances,664	// Use this currency when it is a fungible asset matching the given location or name:665	OnlySelfCurrency,666	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:667	LocationToAccountId,668	// Our chain's account ID type (we can't get away without mentioning it explicitly):669	AccountId,670	// We don't track any teleports.671	(),672>;673674/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,675/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can676/// biases the kind of local `Origin` it will become.677pub type XcmOriginToTransactDispatchOrigin = (678	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location679	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for680	// foreign chains who want to have a local sovereign account on this chain which they control.681	SovereignSignedViaLocation<LocationToAccountId, Origin>,682	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when683	// recognised.684	RelayChainAsNative<RelayOrigin, Origin>,685	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when686	// recognised.687	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,688	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a689	// transaction from the Root origin.690	ParentAsSuperuser<Origin>,691	// Native signed account converter; this just converts an `AccountId32` origin into a normal692	// `Origin::Signed` origin of the same 32-byte value.693	SignedAccountId32AsNative<RelayNetwork, Origin>,694	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.695	XcmPassthrough<Origin>,696);697698parameter_types! {699	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.700	pub UnitWeightCost: Weight = 1_000_000;701	// 1200 UNIQUEs buy 1 second of weight.702	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);703	pub const MaxInstructions: u32 = 100;704	pub const MaxAuthorities: u32 = 100_000;705}706707match_type! {708	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {709		MultiLocation { parents: 1, interior: Here } |710		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }711	};712}713714pub type Barrier = (715	TakeWeightCredit,716	AllowTopLevelPaidExecutionFrom<Everything>,717	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,718	// ^^^ Parent & its unit plurality gets free execution719);720721pub struct UsingOnlySelfCurrencyComponents<722	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,723	AssetId: Get<MultiLocation>,724	AccountId,725	Currency: CurrencyT<AccountId>,726	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,727>(728	Weight,729	Currency::Balance,730	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,731);732impl<733		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,734		AssetId: Get<MultiLocation>,735		AccountId,736		Currency: CurrencyT<AccountId>,737		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,738	> WeightTrader739	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>740{741	fn new() -> Self {742		Self(0, Zero::zero(), PhantomData)743	}744745	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {746		let amount = WeightToFee::calc(&weight);747		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;748749		// location to this parachain through relay chain750		let option1: xcm::v1::AssetId = Concrete(MultiLocation {751			parents: 1,752			interior: X1(Parachain(ParachainInfo::parachain_id().into())),753		});754		// direct location755		let option2: xcm::v1::AssetId = Concrete(MultiLocation {756			parents: 0,757			interior: Here,758		});759760		let required = if payment.fungible.contains_key(&option1) {761			(option1, u128_amount).into()762		} else if payment.fungible.contains_key(&option2) {763			(option2, u128_amount).into()764		} else {765			(Concrete(MultiLocation::default()), u128_amount).into()766		};767768		let unused = payment769			.checked_sub(required)770			.map_err(|_| XcmError::TooExpensive)?;771		self.0 = self.0.saturating_add(weight);772		self.1 = self.1.saturating_add(amount);773		Ok(unused)774	}775776	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {777		let weight = weight.min(self.0);778		let amount = WeightToFee::calc(&weight);779		self.0 -= weight;780		self.1 = self.1.saturating_sub(amount);781		let amount: u128 = amount.saturated_into();782		if amount > 0 {783			Some((AssetId::get(), amount).into())784		} else {785			None786		}787	}788}789impl<790		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,791		AssetId: Get<MultiLocation>,792		AccountId,793		Currency: CurrencyT<AccountId>,794		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,795	> Drop796	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>797{798	fn drop(&mut self) {799		OnUnbalanced::on_unbalanced(Currency::issue(self.1));800	}801}802803pub struct XcmConfig;804impl Config for XcmConfig {805	type Call = Call;806	type XcmSender = XcmRouter;807	// How to withdraw and deposit an asset.808	type AssetTransactor = LocalAssetTransactor;809	type OriginConverter = XcmOriginToTransactDispatchOrigin;810	type IsReserve = NativeAsset;811	type IsTeleporter = (); // Teleportation is disabled812	type LocationInverter = LocationInverter<Ancestry>;813	type Barrier = Barrier;814	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;815	type Trader = UsingOnlySelfCurrencyComponents<816		IdentityFee<Balance>,817		RelayLocation,818		AccountId,819		Balances,820		(),821	>;822	type ResponseHandler = (); // Don't handle responses for now.823	type SubscriptionService = PolkadotXcm;824825	type AssetTrap = PolkadotXcm;826	type AssetClaims = PolkadotXcm;827}828829// parameter_types! {830// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;831// }832833/// No local origins on this chain are allowed to dispatch XCM sends/executions.834pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);835836/// The means for routing XCM messages which are not for local execution into the right message837/// queues.838pub type XcmRouter = (839	// Two routers - use UMP to communicate with the relay chain:840	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,841	// ..and XCMP to communicate with the sibling chains.842	XcmpQueue,843);844845impl pallet_evm_coder_substrate::Config for Runtime {846	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;847	type GasWeightMapping = FixedGasWeightMapping;848}849850impl pallet_xcm::Config for Runtime {851	type Event = Event;852	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;853	type XcmRouter = XcmRouter;854	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;855	type XcmExecuteFilter = Everything;856	type XcmExecutor = XcmExecutor<XcmConfig>;857	type XcmTeleportFilter = Everything;858	type XcmReserveTransferFilter = Everything;859	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;860	type LocationInverter = LocationInverter<Ancestry>;861	type Origin = Origin;862	type Call = Call;863	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;864	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;865}866867impl cumulus_pallet_xcm::Config for Runtime {868	type Event = Event;869	type XcmExecutor = XcmExecutor<XcmConfig>;870}871872impl cumulus_pallet_xcmp_queue::Config for Runtime {873	type Event = Event;874	type XcmExecutor = XcmExecutor<XcmConfig>;875	type ChannelInfo = ParachainSystem;876	type VersionWrapper = ();877	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;878	type ControllerOrigin = EnsureRoot<AccountId>;879	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;880}881882impl cumulus_pallet_dmp_queue::Config for Runtime {883	type Event = Event;884	type XcmExecutor = XcmExecutor<XcmConfig>;885	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;886}887888impl pallet_aura::Config for Runtime {889	type AuthorityId = AuraId;890	type DisabledValidators = ();891	type MaxAuthorities = MaxAuthorities;892}893894parameter_types! {895	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();896	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;897}898899impl pallet_common::Config for Runtime {900	type Event = Event;901	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;902	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;903	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;904905	type Currency = Balances;906	type CollectionCreationPrice = CollectionCreationPrice;907	type TreasuryAccountId = TreasuryAccountId;908}909910impl pallet_fungible::Config for Runtime {911	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;912}913impl pallet_refungible::Config for Runtime {914	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;915}916impl pallet_nonfungible::Config for Runtime {917	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;918}919920impl pallet_unique::Config for Runtime {921	type Event = Event;922	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;923}924925parameter_types! {926	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied927}928929/// Used for the pallet inflation930impl pallet_inflation::Config for Runtime {931	type Currency = Balances;932	type TreasuryAccountId = TreasuryAccountId;933	type InflationBlockInterval = InflationBlockInterval;934	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;935}936937// parameter_types! {938// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *939// 		RuntimeBlockWeights::get().max_block;940// 	pub const MaxScheduledPerBlock: u32 = 50;941// }942943type EvmSponsorshipHandler = (944	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,945	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,946);947type SponsorshipHandler = (948	pallet_unique::UniqueSponsorshipHandler<Runtime>,949	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,950	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,951);952953// impl pallet_unq_scheduler::Config for Runtime {954// 	type Event = Event;955// 	type Origin = Origin;956// 	type PalletsOrigin = OriginCaller;957// 	type Call = Call;958// 	type MaximumWeight = MaximumSchedulerWeight;959// 	type ScheduleOrigin = EnsureSigned<AccountId>;960// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;961// 	type SponsorshipHandler = SponsorshipHandler;962// 	type WeightInfo = ();963// }964965impl pallet_evm_transaction_payment::Config for Runtime {966	type EvmSponsorshipHandler = EvmSponsorshipHandler;967	type Currency = Balances;968	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;969	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;970}971972impl pallet_charge_transaction::Config for Runtime {973	type SponsorshipHandler = SponsorshipHandler;974}975976// impl pallet_contract_helpers::Config for Runtime {977//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;978// }979980parameter_types! {981	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049982	pub const HelpersContractAddress: H160 = H160([983		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,984	]);985}986987impl pallet_evm_contract_helpers::Config for Runtime {988	type ContractAddress = HelpersContractAddress;989	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;990}991992construct_runtime!(993	pub enum Runtime where994		Block = Block,995		NodeBlock = opaque::Block,996		UncheckedExtrinsic = UncheckedExtrinsic997	{998		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,999		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,10001001		Aura: pallet_aura::{Pallet, Config<T>} = 22,1002		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,10031004		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,1005		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,1006		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,1007		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,1008		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,1009		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,1010		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,1011		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,1012		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,1013		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,10141015		// XCM helpers.1016		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,1017		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,1018		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,1019		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,10201021		// Unique Pallets1022		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,1023		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,1024		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,1025		// free = 631026		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,1027		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,1028		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,1029		Fungible: pallet_fungible::{Pallet, Storage} = 67,1030		Refungible: pallet_refungible::{Pallet, Storage} = 68,1031		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,10321033		// Frontier1034		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,1035		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,10361037		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,1038		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,1039		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,1040		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,1041	}1042);10431044pub struct TransactionConverter;10451046impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {1047	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {1048		UncheckedExtrinsic::new_unsigned(1049			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1050		)1051	}1052}10531054impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1055	fn convert_transaction(1056		&self,1057		transaction: pallet_ethereum::Transaction,1058	) -> opaque::UncheckedExtrinsic {1059		let extrinsic = UncheckedExtrinsic::new_unsigned(1060			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1061		);1062		let encoded = extrinsic.encode();1063		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1064			.expect("Encoded extrinsic is always valid")1065	}1066}10671068/// The address format for describing accounts.1069pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1070/// Block header type as expected by this runtime.1071pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1072/// Block type as expected by this runtime.1073pub type Block = generic::Block<Header, UncheckedExtrinsic>;1074/// A Block signed with a Justification1075pub type SignedBlock = generic::SignedBlock<Block>;1076/// BlockId type as expected by this runtime.1077pub type BlockId = generic::BlockId<Block>;1078/// The SignedExtension to the basic transaction logic.1079pub type SignedExtra = (1080	frame_system::CheckSpecVersion<Runtime>,1081	// system::CheckTxVersion<Runtime>,1082	frame_system::CheckGenesis<Runtime>,1083	frame_system::CheckEra<Runtime>,1084	frame_system::CheckNonce<Runtime>,1085	frame_system::CheckWeight<Runtime>,1086	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1087	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,1088);1089/// Unchecked extrinsic type as expected by this runtime.1090pub type UncheckedExtrinsic =1091	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1092/// Extrinsic type that has already been checked.1093pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1094/// Executive: handles dispatch to the various modules.1095pub type Executive = frame_executive::Executive<1096	Runtime,1097	Block,1098	frame_system::ChainContext<Runtime>,1099	Runtime,1100	AllPalletsReversedWithSystemFirst,1101>;11021103impl_opaque_keys! {1104	pub struct SessionKeys {1105		pub aura: Aura,1106	}1107}11081109impl fp_self_contained::SelfContainedCall for Call {1110	type SignedInfo = H160;11111112	fn is_self_contained(&self) -> bool {1113		match self {1114			Call::Ethereum(call) => call.is_self_contained(),1115			_ => false,1116		}1117	}11181119	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1120		match self {1121			Call::Ethereum(call) => call.check_self_contained(),1122			_ => None,1123		}1124	}11251126	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1127		match self {1128			Call::Ethereum(call) => call.validate_self_contained(info),1129			_ => None,1130		}1131	}11321133	fn pre_dispatch_self_contained(1134		&self,1135		info: &Self::SignedInfo,1136	) -> Option<Result<(), TransactionValidityError>> {1137		match self {1138			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1139			_ => None,1140		}1141	}11421143	fn apply_self_contained(1144		self,1145		info: Self::SignedInfo,1146	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1147		match self {1148			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1149				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1150			)),1151			_ => None,1152		}1153	}1154}11551156macro_rules! dispatch_unique_runtime {1157	($collection:ident.$method:ident($($name:ident),*)) => {{1158		use pallet_unique::dispatch::Dispatched;11591160		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1161		let dispatch = collection.as_dyn();11621163		Ok(dispatch.$method($($name),*))1164	}};1165}1166impl_runtime_apis! {1167	impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1168		for Runtime1169	{1170		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1171			dispatch_unique_runtime!(collection.account_tokens(account))1172		}1173		fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1174			dispatch_unique_runtime!(collection.token_exists(token))1175		}11761177		fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1178			dispatch_unique_runtime!(collection.token_owner(token))1179		}1180		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1181			dispatch_unique_runtime!(collection.const_metadata(token))1182		}1183		fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1184			dispatch_unique_runtime!(collection.variable_metadata(token))1185		}11861187		fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1188			dispatch_unique_runtime!(collection.collection_tokens())1189		}1190		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1191			dispatch_unique_runtime!(collection.account_balance(account))1192		}1193		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1194			dispatch_unique_runtime!(collection.balance(account, token))1195		}1196		fn allowance(1197			collection: CollectionId,1198			sender: CrossAccountId,1199			spender: CrossAccountId,1200			token: TokenId,1201		) -> Result<u128, DispatchError> {1202			dispatch_unique_runtime!(collection.allowance(sender, spender, token))1203		}12041205		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1206			<pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1207				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1208				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1209		}1210		fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1211			Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1212		}1213		fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1214			Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1215		}1216		fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1217			Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1218		}1219		fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1220			dispatch_unique_runtime!(collection.last_token_id())1221		}1222		fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1223			Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1224		}1225		fn collection_stats() -> Result<CollectionStats, DispatchError> {1226			Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1227		}1228	}12291230	impl sp_api::Core<Block> for Runtime {1231		fn version() -> RuntimeVersion {1232			VERSION1233		}12341235		fn execute_block(block: Block) {1236			Executive::execute_block(block)1237		}12381239		fn initialize_block(header: &<Block as BlockT>::Header) {1240			Executive::initialize_block(header)1241		}1242	}12431244	impl sp_api::Metadata<Block> for Runtime {1245		fn metadata() -> OpaqueMetadata {1246			OpaqueMetadata::new(Runtime::metadata().into())1247		}1248	}12491250	impl sp_block_builder::BlockBuilder<Block> for Runtime {1251		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1252			Executive::apply_extrinsic(extrinsic)1253		}12541255		fn finalize_block() -> <Block as BlockT>::Header {1256			Executive::finalize_block()1257		}12581259		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1260			data.create_extrinsics()1261		}12621263		fn check_inherents(1264			block: Block,1265			data: sp_inherents::InherentData,1266		) -> sp_inherents::CheckInherentsResult {1267			data.check_extrinsics(&block)1268		}12691270		// fn random_seed() -> <Block as BlockT>::Hash {1271		//     RandomnessCollectiveFlip::random_seed().01272		// }1273	}12741275	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1276		fn validate_transaction(1277			source: TransactionSource,1278			tx: <Block as BlockT>::Extrinsic,1279			hash: <Block as BlockT>::Hash,1280		) -> TransactionValidity {1281			Executive::validate_transaction(source, tx, hash)1282		}1283	}12841285	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1286		fn offchain_worker(header: &<Block as BlockT>::Header) {1287			Executive::offchain_worker(header)1288		}1289	}12901291	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1292		fn chain_id() -> u64 {1293			<Runtime as pallet_evm::Config>::ChainId::get()1294		}12951296		fn account_basic(address: H160) -> EVMAccount {1297			EVM::account_basic(&address)1298		}12991300		fn gas_price() -> U256 {1301			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1302		}13031304		fn account_code_at(address: H160) -> Vec<u8> {1305			EVM::account_codes(address)1306		}13071308		fn author() -> H160 {1309			<pallet_evm::Pallet<Runtime>>::find_author()1310		}13111312		fn storage_at(address: H160, index: U256) -> H256 {1313			let mut tmp = [0u8; 32];1314			index.to_big_endian(&mut tmp);1315			EVM::account_storages(address, H256::from_slice(&tmp[..]))1316		}13171318		#[allow(clippy::redundant_closure)]1319		fn call(1320			from: H160,1321			to: H160,1322			data: Vec<u8>,1323			value: U256,1324			gas_limit: U256,1325			max_fee_per_gas: Option<U256>,1326			max_priority_fee_per_gas: Option<U256>,1327			nonce: Option<U256>,1328			estimate: bool,1329			access_list: Option<Vec<(H160, Vec<H256>)>>,1330		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1331			let config = if estimate {1332				let mut config = <Runtime as pallet_evm::Config>::config().clone();1333				config.estimate = true;1334				Some(config)1335			} else {1336				None1337			};13381339			<Runtime as pallet_evm::Config>::Runner::call(1340				from,1341				to,1342				data,1343				value,1344				gas_limit.low_u64(),1345				max_fee_per_gas,1346				max_priority_fee_per_gas,1347				nonce,1348				access_list.unwrap_or_default(),1349				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1350			).map_err(|err| err.into())1351		}13521353		#[allow(clippy::redundant_closure)]1354		fn create(1355			from: H160,1356			data: Vec<u8>,1357			value: U256,1358			gas_limit: U256,1359			max_fee_per_gas: Option<U256>,1360			max_priority_fee_per_gas: Option<U256>,1361			nonce: Option<U256>,1362			estimate: bool,1363			access_list: Option<Vec<(H160, Vec<H256>)>>,1364		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1365			let config = if estimate {1366				let mut config = <Runtime as pallet_evm::Config>::config().clone();1367				config.estimate = true;1368				Some(config)1369			} else {1370				None1371			};13721373			<Runtime as pallet_evm::Config>::Runner::create(1374				from,1375				data,1376				value,1377				gas_limit.low_u64(),1378				max_fee_per_gas,1379				max_priority_fee_per_gas,1380				nonce,1381				access_list.unwrap_or_default(),1382				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1383			).map_err(|err| err.into())1384		}13851386		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1387			Ethereum::current_transaction_statuses()1388		}13891390		fn current_block() -> Option<pallet_ethereum::Block> {1391			Ethereum::current_block()1392		}13931394		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1395			Ethereum::current_receipts()1396		}13971398		fn current_all() -> (1399			Option<pallet_ethereum::Block>,1400			Option<Vec<pallet_ethereum::Receipt>>,1401			Option<Vec<TransactionStatus>>1402		) {1403			(1404				Ethereum::current_block(),1405				Ethereum::current_receipts(),1406				Ethereum::current_transaction_statuses()1407			)1408		}14091410		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1411			xts.into_iter().filter_map(|xt| match xt.0.function {1412				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1413				_ => None1414			}).collect()1415		}14161417		fn elasticity() -> Option<Permill> {1418			None1419		}1420	}14211422	impl sp_session::SessionKeys<Block> for Runtime {1423		fn decode_session_keys(1424			encoded: Vec<u8>,1425		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1426			SessionKeys::decode_into_raw_public_keys(&encoded)1427		}14281429		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1430			SessionKeys::generate(seed)1431		}1432	}14331434	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1435		fn slot_duration() -> sp_consensus_aura::SlotDuration {1436			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1437		}14381439		fn authorities() -> Vec<AuraId> {1440			Aura::authorities().to_vec()1441		}1442	}14431444	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1445		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1446			ParachainSystem::collect_collation_info(header)1447		}1448	}14491450	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1451		fn account_nonce(account: AccountId) -> Index {1452			System::account_nonce(account)1453		}1454	}14551456	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1457		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1458			TransactionPayment::query_info(uxt, len)1459		}1460		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1461			TransactionPayment::query_fee_details(uxt, len)1462		}1463	}14641465	/*1466	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1467		for Runtime1468	{1469		fn call(1470			origin: AccountId,1471			dest: AccountId,1472			value: Balance,1473			gas_limit: u64,1474			input_data: Vec<u8>,1475		) -> pallet_contracts_primitives::ContractExecResult {1476			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1477		}14781479		fn instantiate(1480			origin: AccountId,1481			endowment: Balance,1482			gas_limit: u64,1483			code: pallet_contracts_primitives::Code<Hash>,1484			data: Vec<u8>,1485			salt: Vec<u8>,1486		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1487		{1488			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1489		}14901491		fn get_storage(1492			address: AccountId,1493			key: [u8; 32],1494		) -> pallet_contracts_primitives::GetStorageResult {1495			Contracts::get_storage(address, key)1496		}14971498		fn rent_projection(1499			address: AccountId,1500		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1501			Contracts::rent_projection(address)1502		}1503	}1504	*/15051506	#[cfg(feature = "runtime-benchmarks")]1507	impl frame_benchmarking::Benchmark<Block> for Runtime {1508		fn benchmark_metadata(extra: bool) -> (1509			Vec<frame_benchmarking::BenchmarkList>,1510			Vec<frame_support::traits::StorageInfo>,1511		) {1512			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1513			use frame_support::traits::StorageInfoTrait;15141515			let mut list = Vec::<BenchmarkList>::new();15161517			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1518			list_benchmark!(list, extra, pallet_unique, Unique);1519			list_benchmark!(list, extra, pallet_inflation, Inflation);1520			list_benchmark!(list, extra, pallet_fungible, Fungible);1521			list_benchmark!(list, extra, pallet_refungible, Refungible);1522			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1523			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);15241525			let storage_info = AllPalletsReversedWithSystemFirst::storage_info();15261527			return (list, storage_info)1528		}15291530		fn dispatch_benchmark(1531			config: frame_benchmarking::BenchmarkConfig1532		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1533			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};15341535			let allowlist: Vec<TrackedStorageKey> = vec![1536				// Block Number1537				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1538				// Total Issuance1539				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1540				// Execution Phase1541				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1542				// Event Count1543				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1544				// System Events1545				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1546			];15471548			let mut batches = Vec::<BenchmarkBatch>::new();1549			let params = (&config, &allowlist);15501551			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1552			add_benchmark!(params, batches, pallet_unique, Unique);1553			add_benchmark!(params, batches, pallet_inflation, Inflation);1554			add_benchmark!(params, batches, pallet_fungible, Fungible);1555			add_benchmark!(params, batches, pallet_refungible, Refungible);1556			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1557			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);15581559			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1560			Ok(batches)1561		}1562	}1563}15641565struct CheckInherents;15661567impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1568	fn check_inherents(1569		block: &Block,1570		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1571	) -> sp_inherents::CheckInherentsResult {1572		let relay_chain_slot = relay_state_proof1573			.read_slot()1574			.expect("Could not read the relay chain slot from the proof");15751576		let inherent_data =1577			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1578				relay_chain_slot,1579				sp_std::time::Duration::from_secs(6),1580			)1581			.create_inherent_data()1582			.expect("Could not create the timestamp inherent data");15831584		inherent_data.check_extrinsics(block)1585	}1586}15871588cumulus_pallet_parachain_system::register_validate_block!(1589	Runtime = Runtime,1590	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1591	CheckInherents = CheckInherents,1592);
addedruntime/unique/Cargo.tomldiffbeforeafterboth
--- /dev/null
+++ b/runtime/unique/Cargo.toml
@@ -0,0 +1,409 @@
+################################################################################
+# Package
+
+[package]
+authors = ['Unique Network <support@uniquenetwork.io>']
+build = 'build.rs'
+description = 'Unique Runtime'
+edition = '2021'
+homepage = 'https://unique.network'
+license = 'GPLv3'
+name = 'unique-runtime'
+repository = 'https://github.com/UniqueNetwork/unique-chain'
+version = '0.9.17'
+
+[package.metadata.docs.rs]
+targets = ['x86_64-unknown-linux-gnu']
+
+[features]
+default = ['std']
+runtime-benchmarks = [
+    'hex-literal',
+    'frame-benchmarking',
+    'frame-support/runtime-benchmarks',
+    'frame-system-benchmarking',
+    'frame-system/runtime-benchmarks',
+    'pallet-ethereum/runtime-benchmarks',
+    'pallet-evm-migration/runtime-benchmarks',
+    'pallet-evm-coder-substrate/runtime-benchmarks',
+    'pallet-balances/runtime-benchmarks',
+    'pallet-timestamp/runtime-benchmarks',
+    'pallet-common/runtime-benchmarks',
+    'pallet-fungible/runtime-benchmarks',
+    'pallet-refungible/runtime-benchmarks',
+    'pallet-nonfungible/runtime-benchmarks',
+    'pallet-unique/runtime-benchmarks',
+    'pallet-inflation/runtime-benchmarks',
+    'pallet-xcm/runtime-benchmarks',
+    'sp-runtime/runtime-benchmarks',
+    'xcm-builder/runtime-benchmarks',
+]
+std = [
+    'codec/std',
+    'cumulus-pallet-aura-ext/std',
+    'cumulus-pallet-parachain-system/std',
+    'cumulus-pallet-xcm/std',
+    'cumulus-pallet-xcmp-queue/std',
+    'cumulus-primitives-core/std',
+    'cumulus-primitives-utility/std',
+    'frame-executive/std',
+    'frame-support/std',
+    'frame-system/std',
+    'frame-system-rpc-runtime-api/std',
+    'pallet-aura/std',
+    'pallet-balances/std',
+    # 'pallet-contracts/std',
+    # 'pallet-contracts-primitives/std',
+    # 'pallet-contracts-rpc-runtime-api/std',
+    # 'pallet-contract-helpers/std',
+    'pallet-randomness-collective-flip/std',
+    'pallet-sudo/std',
+    'pallet-timestamp/std',
+    'pallet-transaction-payment/std',
+    'pallet-transaction-payment-rpc-runtime-api/std',
+    'pallet-treasury/std',
+    # 'pallet-vesting/std',
+    'pallet-evm/std',
+    'pallet-evm-migration/std',
+    'pallet-evm-contract-helpers/std',
+    'pallet-evm-transaction-payment/std',
+    'pallet-evm-coder-substrate/std',
+    'pallet-ethereum/std',
+    'pallet-base-fee/std',
+    'fp-rpc/std',
+    'up-rpc/std',
+    'up-evm-mapping/std',
+    'fp-self-contained/std',
+    'parachain-info/std',
+    'serde',
+    'pallet-inflation/std',
+    'pallet-common/std',
+    'pallet-fungible/std',
+    'pallet-refungible/std',
+    'pallet-nonfungible/std',
+    'pallet-unique/std',
+    'pallet-unq-scheduler/std',
+    'pallet-charge-transaction/std',
+    'up-data-structs/std',
+    'sp-api/std',
+    'sp-block-builder/std',
+    "sp-consensus-aura/std",
+    'sp-core/std',
+    'sp-inherents/std',
+    'sp-io/std',
+    'sp-offchain/std',
+    'sp-runtime/std',
+    'sp-session/std',
+    'sp-std/std',
+    'sp-transaction-pool/std',
+    'sp-version/std',
+    'xcm/std',
+    'xcm-builder/std',
+    'xcm-executor/std',
+
+    "orml-vesting/std",
+]
+limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']
+
+################################################################################
+# Substrate Dependencies
+
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '2.3.0'
+
+[dependencies.frame-benchmarking]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+optional = true
+branch = 'polkadot-v0.9.17'
+
+[dependencies.frame-executive]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.frame-support]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.frame-system]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.frame-system-benchmarking]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+optional = true
+branch = 'polkadot-v0.9.17'
+
+[dependencies.frame-system-rpc-runtime-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.hex-literal]
+optional = true
+version = '0.3.3'
+
+[dependencies.serde]
+default-features = false
+features = ['derive']
+optional = true
+version = '1.0.130'
+
+[dependencies.pallet-aura]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.pallet-balances]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+# Contracts specific packages
+# [dependencies.pallet-contracts]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.17'
+# version = '4.0.0-dev'
+
+# [dependencies.pallet-contracts-primitives]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.17'
+# version = '4.0.0-dev'
+
+# [dependencies.pallet-contracts-rpc-runtime-api]
+# git = 'https://github.com/paritytech/substrate.git'
+# default-features = false
+# branch = 'polkadot-v0.9.17'
+# version = '4.0.0-dev'
+
+[dependencies.pallet-randomness-collective-flip]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.pallet-sudo]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.pallet-timestamp]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.pallet-transaction-payment]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.pallet-transaction-payment-rpc-runtime-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.pallet-treasury]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+# [dependencies.pallet-vesting]
+# default-features = false
+# git = 'https://github.com/paritytech/substrate.git'
+# branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-arithmetic]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-api]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-block-builder]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-core]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-consensus-aura]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-inherents]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-io]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-offchain]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-runtime]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-session]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-std]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-transaction-pool]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.sp-version]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.smallvec]
+version = '1.6.1'
+
+################################################################################
+# Cumulus dependencies
+
+[dependencies.parachain-info]
+default-features = false
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.cumulus-pallet-aura-ext]
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+default-features = false
+
+[dependencies.cumulus-pallet-parachain-system]
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+default-features = false
+
+[dependencies.cumulus-primitives-core]
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+default-features = false
+
+[dependencies.cumulus-pallet-xcm]
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+default-features = false
+
+[dependencies.cumulus-pallet-dmp-queue]
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+default-features = false
+
+[dependencies.cumulus-pallet-xcmp-queue]
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+default-features = false
+
+[dependencies.cumulus-primitives-utility]
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+default-features = false
+
+[dependencies.cumulus-primitives-timestamp]
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
+default-features = false
+
+################################################################################
+# Polkadot dependencies
+
+[dependencies.polkadot-parachain]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.17'
+default-features = false
+
+[dependencies.xcm]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.17'
+default-features = false
+
+[dependencies.xcm-builder]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.17'
+default-features = false
+
+[dependencies.xcm-executor]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.17'
+default-features = false
+
+[dependencies.pallet-xcm]
+git = 'https://github.com/paritytech/polkadot'
+branch = 'release-v0.9.17'
+default-features = false
+
+[dependencies.orml-vesting]
+git = 'https://github.com/UniqueNetwork/open-runtime-module-library'
+branch = 'unique-polkadot-v0.9.17'
+version = "0.4.1-dev"
+default-features = false
+
+################################################################################
+# local dependencies
+
+[dependencies]
+unique-runtime-common = { path = "../common", default-features = false }
+scale-info = { version = "1.0.0", default-features = false, features = [
+    "derive",
+] }
+derivative = "2.2.0"
+pallet-unique = { path = '../../pallets/unique', default-features = false }
+up-rpc = { path = "../../primitives/rpc", default-features = false }
+up-evm-mapping = { path = "../../primitives/evm-mapping", default-features = false }
+pallet-inflation = { path = '../../pallets/inflation', default-features = false }
+up-data-structs = { path = '../../primitives/data-structs', default-features = false }
+pallet-common = { default-features = false, path = "../../pallets/common" }
+pallet-fungible = { default-features = false, path = "../../pallets/fungible" }
+pallet-refungible = { default-features = false, path = "../../pallets/refungible" }
+pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
+pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
+pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.17', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
+pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
+pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
+pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
+pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+
+################################################################################
+# Build Dependencies
+
+[build-dependencies.substrate-wasm-builder]
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
addedruntime/unique/build.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/unique/build.rs
@@ -0,0 +1,9 @@
+use substrate_wasm_builder::WasmBuilder;
+
+fn main() {
+	WasmBuilder::new()
+		.with_current_project()
+		.import_memory()
+		.export_heap_base()
+		.build()
+}
addedruntime/unique/src/lib.rsdiffbeforeafterboth
--- /dev/null
+++ b/runtime/unique/src/lib.rs
@@ -0,0 +1,1528 @@
+//
+// This file is subject to the terms and conditions defined in
+// file 'LICENSE', which is part of this source code package.
+//
+
+//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
+#![recursion_limit = "1024"]
+#![allow(clippy::from_over_into, clippy::identity_op)]
+#![allow(clippy::fn_to_numeric_cast_with_truncation)]
+// Make the WASM binary available.
+#[cfg(feature = "std")]
+include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
+
+use sp_api::impl_runtime_apis;
+use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};
+use sp_runtime::DispatchError;
+// #[cfg(any(feature = "std", test))]
+// pub use sp_runtime::BuildStorage;
+
+use sp_runtime::{
+	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
+	traits::{
+		AccountIdLookup, BlakeTwo256, Block as BlockT,
+		AccountIdConversion, Zero,
+	},
+	transaction_validity::{TransactionSource, TransactionValidity},
+	ApplyExtrinsicResult, RuntimeAppPublic,
+};
+
+use sp_std::prelude::*;
+
+#[cfg(feature = "std")]
+use sp_version::NativeVersion;
+use sp_version::RuntimeVersion;
+pub use pallet_transaction_payment::{
+	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,
+};
+// A few exports that help ease life for downstream crates.
+pub use pallet_balances::Call as BalancesCall;
+pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};
+pub use frame_support::{
+	construct_runtime, match_type,
+	dispatch::DispatchResult,
+	PalletId, parameter_types, StorageValue, ConsensusEngineId,
+	traits::{
+		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,
+		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,
+		OnUnbalanced, Randomness, FindAuthor,
+	},
+	weights::{
+		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
+		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,
+	},
+};
+use up_data_structs::*;
+// use pallet_contracts::weights::WeightInfo;
+// #[cfg(any(feature = "std", test))]
+use frame_system::{
+	self as frame_system, EnsureRoot, EnsureSigned,
+	limits::{BlockWeights, BlockLength},
+};
+use sp_arithmetic::{
+	traits::{BaseArithmetic, Unsigned},
+};
+use smallvec::smallvec;
+use codec::{Encode, Decode};
+use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};
+use fp_rpc::TransactionStatus;
+use sp_runtime::{
+	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},
+	transaction_validity::TransactionValidityError,
+	SaturatedConversion,
+};
+
+// pub use pallet_timestamp::Call as TimestampCall;
+pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
+
+// Polkadot imports
+use pallet_xcm::XcmPassthrough;
+use polkadot_parachain::primitives::Sibling;
+use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};
+use xcm_builder::{
+	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
+	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
+	ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
+};
+use xcm_executor::{Config, XcmExecutor, Assets};
+use sp_std::{marker::PhantomData};
+
+use xcm::latest::{
+	//	Xcm,
+	AssetId::{Concrete},
+	Fungibility::Fungible as XcmFungible,
+	MultiAsset,
+	Error as XcmError,
+};
+use xcm_executor::traits::{MatchesFungible, WeightTrader};
+//use xcm_executor::traits::MatchesFungible;
+use sp_runtime::traits::CheckedConversion;
+
+use unique_runtime_common::{
+	types::*,
+	constants::*,
+};
+
+// mod chain_extension;
+// use crate::chain_extension::{NFTExtension, Imbalance};
+
+pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+
+/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
+/// the specifics of the runtime. They can then be made to be agnostic over specific formats
+/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
+/// to even the core data structures.
+pub mod opaque {
+	use sp_std::prelude::*;
+	use sp_runtime::impl_opaque_keys;
+	use super::Aura;
+
+	pub use unique_runtime_common::types::*;
+	pub use super::CrossAccountId;
+
+	impl_opaque_keys! {
+		pub struct SessionKeys {
+			pub aura: Aura,
+		}
+	}
+}
+
+/// This runtime version.
+pub const VERSION: RuntimeVersion = RuntimeVersion {
+	spec_name: create_runtime_str!("quartz"),
+	impl_name: create_runtime_str!("quartz"),
+	authoring_version: 1,
+	spec_version: 916001,
+	impl_version: 0,
+	apis: RUNTIME_API_VERSIONS,
+	transaction_version: 1,
+	state_version: 0,
+};
+
+#[derive(codec::Encode, codec::Decode)]
+pub enum XCMPMessage<XAccountId, XBalance> {
+	/// Transfer tokens to the given account from the Parachain account.
+	TransferToken(XAccountId, XBalance),
+}
+
+/// The version information used to identify this runtime when compiled natively.
+#[cfg(feature = "std")]
+pub fn native_version() -> NativeVersion {
+	NativeVersion {
+		runtime_version: VERSION,
+		can_author_with: Default::default(),
+	}
+}
+
+type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
+
+pub struct DealWithFees;
+impl OnUnbalanced<NegativeImbalance> for DealWithFees {
+	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {
+		if let Some(fees) = fees_then_tips.next() {
+			// for fees, 100% to treasury
+			let mut split = fees.ration(100, 0);
+			if let Some(tips) = fees_then_tips.next() {
+				// for tips, if any, 100% to treasury
+				tips.ration_merge_into(100, 0, &mut split);
+			}
+			Treasury::on_unbalanced(split.0);
+			// Author::on_unbalanced(split.1);
+		}
+	}
+}
+
+parameter_types! {
+	pub const BlockHashCount: BlockNumber = 2400;
+	pub RuntimeBlockLength: BlockLength =
+		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
+	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
+	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
+	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
+		.base_block(BlockExecutionWeight::get())
+		.for_class(DispatchClass::all(), |weights| {
+			weights.base_extrinsic = ExtrinsicBaseWeight::get();
+		})
+		.for_class(DispatchClass::Normal, |weights| {
+			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
+		})
+		.for_class(DispatchClass::Operational, |weights| {
+			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
+			// Operational transactions have some extra reserved space, so that they
+			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
+			weights.reserved = Some(
+				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
+			);
+		})
+		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
+		.build_or_panic();
+	pub const Version: RuntimeVersion = VERSION;
+	pub const SS58Prefix: u8 = 255;
+}
+
+parameter_types! {
+	pub const ChainId: u64 = 8888;
+}
+
+pub struct FixedFee;
+impl FeeCalculator for FixedFee {
+	fn min_gas_price() -> U256 {
+		// Targeting 0.15 UNQ per transfer
+		1_024_947_215_000u64.into()
+	}
+}
+
+// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case
+// (contract, which only writes a lot of data),
+// approximating on top of our real store write weight
+parameter_types! {
+	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;
+	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;
+	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();
+}
+
+/// Limiting EVM execution to 50% of block for substrate users and management tasks
+/// EVM transaction consumes more weight than substrate's, so we can't rely on them being
+/// scheduled fairly
+const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);
+parameter_types! {
+	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());
+}
+
+pub enum FixedGasWeightMapping {}
+impl GasWeightMapping for FixedGasWeightMapping {
+	fn gas_to_weight(gas: u64) -> Weight {
+		gas.saturating_mul(WeightPerGas::get())
+	}
+	fn weight_to_gas(weight: Weight) -> u64 {
+		weight / WeightPerGas::get()
+	}
+}
+
+impl pallet_evm::Config for Runtime {
+	type BlockGasLimit = BlockGasLimit;
+	type FeeCalculator = FixedFee;
+	type GasWeightMapping = FixedGasWeightMapping;
+	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;
+	type CallOrigin = EnsureAddressTruncated;
+	type WithdrawOrigin = EnsureAddressTruncated;
+	type AddressMapping = HashedAddressMapping<Self::Hashing>;
+	type PrecompilesType = ();
+	type PrecompilesValue = ();
+	type Currency = Balances;
+	type Event = Event;
+	type OnMethodCall = (
+		pallet_evm_migration::OnMethodCall<Self>,
+		pallet_unique::UniqueErcSupport<Self>,
+		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,
+	);
+	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;
+	type ChainId = ChainId;
+	type Runner = pallet_evm::runner::stack::Runner<Self>;
+	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;
+	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;
+	type FindAuthor = EthereumFindAuthor<Aura>;
+}
+
+impl pallet_evm_migration::Config for Runtime {
+	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;
+}
+
+pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);
+impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {
+	fn find_author<'a, I>(digests: I) -> Option<H160>
+	where
+		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,
+	{
+		if let Some(author_index) = F::find_author(digests) {
+			let authority_id = Aura::authorities()[author_index as usize].clone();
+			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));
+		}
+		None
+	}
+}
+
+impl pallet_ethereum::Config for Runtime {
+	type Event = Event;
+	type StateRoot = pallet_ethereum::IntermediateStateRoot;
+}
+
+impl pallet_randomness_collective_flip::Config for Runtime {}
+
+impl frame_system::Config for Runtime {
+	/// The data to be stored in an account.
+	type AccountData = pallet_balances::AccountData<Balance>;
+	/// The identifier used to distinguish between accounts.
+	type AccountId = AccountId;
+	/// The basic call filter to use in dispatchable.
+	type BaseCallFilter = Everything;
+	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
+	type BlockHashCount = BlockHashCount;
+	/// The maximum length of a block (in bytes).
+	type BlockLength = RuntimeBlockLength;
+	/// The index type for blocks.
+	type BlockNumber = BlockNumber;
+	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.
+	type BlockWeights = RuntimeBlockWeights;
+	/// The aggregated dispatch type that is available for extrinsics.
+	type Call = Call;
+	/// The weight of database operations that the runtime can invoke.
+	type DbWeight = RocksDbWeight;
+	/// The ubiquitous event type.
+	type Event = Event;
+	/// The type for hashing blocks and tries.
+	type Hash = Hash;
+	/// The hashing algorithm used.
+	type Hashing = BlakeTwo256;
+	/// The header type.
+	type Header = generic::Header<BlockNumber, BlakeTwo256>;
+	/// The index type for storing how many extrinsics an account has signed.
+	type Index = Index;
+	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
+	type Lookup = AccountIdLookup<AccountId, ()>;
+	/// What to do if an account is fully reaped from the system.
+	type OnKilledAccount = ();
+	/// What to do if a new account is created.
+	type OnNewAccount = ();
+	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
+	/// The ubiquitous origin type.
+	type Origin = Origin;
+	/// This type is being generated by `construct_runtime!`.
+	type PalletInfo = PalletInfo;
+	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
+	type SS58Prefix = SS58Prefix;
+	/// Weight information for the extrinsics of this pallet.
+	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;
+	/// Version of the runtime.
+	type Version = Version;
+	type MaxConsumers = ConstU32<16>;
+}
+
+parameter_types! {
+	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
+}
+
+impl pallet_timestamp::Config for Runtime {
+	/// A timestamp: milliseconds since the unix epoch.
+	type Moment = u64;
+	type OnTimestampSet = ();
+	type MinimumPeriod = MinimumPeriod;
+	type WeightInfo = ();
+}
+
+parameter_types! {
+	// pub const ExistentialDeposit: u128 = 500;
+	pub const ExistentialDeposit: u128 = 0;
+	pub const MaxLocks: u32 = 50;
+}
+
+impl pallet_balances::Config for Runtime {
+	type MaxLocks = MaxLocks;
+	type MaxReserves = ();
+	type ReserveIdentifier = [u8; 8];
+	/// The type for recording an account's balance.
+	type Balance = Balance;
+	/// The ubiquitous event type.
+	type Event = Event;
+	type DustRemoval = Treasury;
+	type ExistentialDeposit = ExistentialDeposit;
+	type AccountStore = System;
+	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
+}
+
+pub const MICROUNIQUE: Balance = 1_000_000_000_000;
+pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;
+pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;
+pub const UNIQUE: Balance = 100 * CENTIUNIQUE;
+
+pub const fn deposit(items: u32, bytes: u32) -> Balance {
+	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE
+}
+
+/*
+parameter_types! {
+	pub TombstoneDeposit: Balance = deposit(
+		1,
+		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,
+	);
+	pub DepositPerContract: Balance = TombstoneDeposit::get();
+	pub const DepositPerStorageByte: Balance = deposit(0, 1);
+	pub const DepositPerStorageItem: Balance = deposit(1, 0);
+	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);
+	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;
+	pub const SignedClaimHandicap: u32 = 2;
+	pub const MaxDepth: u32 = 32;
+	pub const MaxValueSize: u32 = 16 * 1024;
+	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb
+	// The lazy deletion runs inside on_initialize.
+	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *
+		RuntimeBlockWeights::get().max_block;
+	// The weight needed for decoding the queue should be less or equal than a fifth
+	// of the overall weight dedicated to the lazy deletion.
+	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (
+			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -
+			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)
+		)) / 5) as u32;
+	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
+}
+
+impl pallet_contracts::Config for Runtime {
+	type Time = Timestamp;
+	type Randomness = RandomnessCollectiveFlip;
+	type Currency = Balances;
+	type Event = Event;
+	type RentPayment = ();
+	type SignedClaimHandicap = SignedClaimHandicap;
+	type TombstoneDeposit = TombstoneDeposit;
+	type DepositPerContract = DepositPerContract;
+	type DepositPerStorageByte = DepositPerStorageByte;
+	type DepositPerStorageItem = DepositPerStorageItem;
+	type RentFraction = RentFraction;
+	type SurchargeReward = SurchargeReward;
+	type WeightPrice = pallet_transaction_payment::Pallet<Self>;
+	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
+	type ChainExtension = NFTExtension;
+	type DeletionQueueDepth = DeletionQueueDepth;
+	type DeletionWeightLimit = DeletionWeightLimit;
+	type Schedule = Schedule;
+	type CallStack = [pallet_contracts::Frame<Self>; 31];
+}
+*/
+
+parameter_types! {
+	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer
+	/// This value increases the priority of `Operational` transactions by adding
+	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.
+	pub const OperationalFeeMultiplier: u8 = 5;
+}
+
+/// Linear implementor of `WeightToFeePolynomial`
+pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);
+
+impl<T> WeightToFeePolynomial for LinearFee<T>
+where
+	T: BaseArithmetic + From<u32> + Copy + Unsigned,
+{
+	type Balance = T;
+
+	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
+		smallvec!(WeightToFeeCoefficient {
+			// Targeting 0.1 Unique per NFT transfer
+			coeff_integer: 142_688_000u32.into(),
+			coeff_frac: Perbill::zero(),
+			negative: false,
+			degree: 1,
+		})
+	}
+}
+
+impl pallet_transaction_payment::Config for Runtime {
+	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;
+	type TransactionByteFee = TransactionByteFee;
+	type OperationalFeeMultiplier = OperationalFeeMultiplier;
+	type WeightToFee = LinearFee<Balance>;
+	type FeeMultiplierUpdate = ();
+}
+
+parameter_types! {
+	pub const ProposalBond: Permill = Permill::from_percent(5);
+	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;
+	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;
+	pub const SpendPeriod: BlockNumber = 5 * MINUTES;
+	pub const Burn: Permill = Permill::from_percent(0);
+	pub const TipCountdown: BlockNumber = 1 * DAYS;
+	pub const TipFindersFee: Percent = Percent::from_percent(20);
+	pub const TipReportDepositBase: Balance = 1 * UNIQUE;
+	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;
+	pub const BountyDepositBase: Balance = 1 * UNIQUE;
+	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;
+	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");
+	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;
+	pub const MaximumReasonLength: u32 = 16384;
+	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
+	pub const BountyValueMinimum: Balance = 5 * UNIQUE;
+	pub const MaxApprovals: u32 = 100;
+}
+
+impl pallet_treasury::Config for Runtime {
+	type PalletId = TreasuryModuleId;
+	type Currency = Balances;
+	type ApproveOrigin = EnsureRoot<AccountId>;
+	type RejectOrigin = EnsureRoot<AccountId>;
+	type Event = Event;
+	type OnSlash = ();
+	type ProposalBond = ProposalBond;
+	type ProposalBondMinimum = ProposalBondMinimum;
+	type ProposalBondMaximum = ProposalBondMaximum;
+	type SpendPeriod = SpendPeriod;
+	type Burn = Burn;
+	type BurnDestination = ();
+	type SpendFunds = ();
+	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;
+	type MaxApprovals = MaxApprovals;
+}
+
+impl pallet_sudo::Config for Runtime {
+	type Event = Event;
+	type Call = Call;
+}
+
+pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);
+
+impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider
+	for RelayChainBlockNumberProvider<T>
+{
+	type BlockNumber = BlockNumber;
+
+	fn current_block_number() -> Self::BlockNumber {
+		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()
+			.map(|d| d.relay_parent_number)
+			.unwrap_or_default()
+	}
+}
+
+parameter_types! {
+	pub const MinVestedTransfer: Balance = 10 * UNIQUE;
+	pub const MaxVestingSchedules: u32 = 28;
+}
+
+impl orml_vesting::Config for Runtime {
+	type Event = Event;
+	type Currency = pallet_balances::Pallet<Runtime>;
+	type MinVestedTransfer = MinVestedTransfer;
+	type VestedTransferOrigin = EnsureSigned<AccountId>;
+	type WeightInfo = ();
+	type MaxVestingSchedules = MaxVestingSchedules;
+	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
+}
+
+parameter_types! {
+	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
+	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
+}
+
+impl cumulus_pallet_parachain_system::Config for Runtime {
+	type Event = Event;
+	type SelfParaId = parachain_info::Pallet<Self>;
+	type OnSystemEvent = ();
+	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<
+	// 	MaxDownwardMessageWeight,
+	// 	XcmExecutor<XcmConfig>,
+	// 	Call,
+	// >;
+	type OutboundXcmpMessageSource = XcmpQueue;
+	type DmpMessageHandler = DmpQueue;
+	type ReservedDmpWeight = ReservedDmpWeight;
+	type ReservedXcmpWeight = ReservedXcmpWeight;
+	type XcmpMessageHandler = XcmpQueue;
+}
+
+impl parachain_info::Config for Runtime {}
+
+impl cumulus_pallet_aura_ext::Config for Runtime {}
+
+parameter_types! {
+	pub const RelayLocation: MultiLocation = MultiLocation::parent();
+	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
+	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
+	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
+}
+
+/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
+/// when determining ownership of accounts for asset transacting and when attempting to use XCM
+/// `Transact` in order to determine the dispatch Origin.
+pub type LocationToAccountId = (
+	// The parent (Relay-chain) origin converts to the default `AccountId`.
+	ParentIsDefault<AccountId>,
+	// Sibling parachain origins convert to AccountId via the `ParaId::into`.
+	SiblingParachainConvertsVia<Sibling, AccountId>,
+	// Straight up local `AccountId32` origins just alias directly to `AccountId`.
+	AccountId32Aliases<RelayNetwork, AccountId>,
+);
+
+pub struct OnlySelfCurrency;
+impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {
+	fn matches_fungible(a: &MultiAsset) -> Option<B> {
+		match (&a.id, &a.fun) {
+			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),
+			_ => None,
+		}
+	}
+}
+
+/// Means for transacting assets on this chain.
+pub type LocalAssetTransactor = CurrencyAdapter<
+	// Use this currency:
+	Balances,
+	// Use this currency when it is a fungible asset matching the given location or name:
+	OnlySelfCurrency,
+	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
+	LocationToAccountId,
+	// Our chain's account ID type (we can't get away without mentioning it explicitly):
+	AccountId,
+	// We don't track any teleports.
+	(),
+>;
+
+/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
+/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
+/// biases the kind of local `Origin` it will become.
+pub type XcmOriginToTransactDispatchOrigin = (
+	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
+	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
+	// foreign chains who want to have a local sovereign account on this chain which they control.
+	SovereignSignedViaLocation<LocationToAccountId, Origin>,
+	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when
+	// recognised.
+	RelayChainAsNative<RelayOrigin, Origin>,
+	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
+	// recognised.
+	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
+	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
+	// transaction from the Root origin.
+	ParentAsSuperuser<Origin>,
+	// Native signed account converter; this just converts an `AccountId32` origin into a normal
+	// `Origin::Signed` origin of the same 32-byte value.
+	SignedAccountId32AsNative<RelayNetwork, Origin>,
+	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
+	XcmPassthrough<Origin>,
+);
+
+parameter_types! {
+	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.
+	pub UnitWeightCost: Weight = 1_000_000;
+	// 1200 UNIQUEs buy 1 second of weight.
+	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);
+	pub const MaxInstructions: u32 = 100;
+	pub const MaxAuthorities: u32 = 100_000;
+}
+
+match_type! {
+	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
+		MultiLocation { parents: 1, interior: Here } |
+		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }
+	};
+}
+
+pub type Barrier = (
+	TakeWeightCredit,
+	AllowTopLevelPaidExecutionFrom<Everything>,
+	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,
+	// ^^^ Parent & its unit plurality gets free execution
+);
+
+pub struct UsingOnlySelfCurrencyComponents<
+	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+	AssetId: Get<MultiLocation>,
+	AccountId,
+	Currency: CurrencyT<AccountId>,
+	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+>(
+	Weight,
+	Currency::Balance,
+	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,
+);
+impl<
+		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+		AssetId: Get<MultiLocation>,
+		AccountId,
+		Currency: CurrencyT<AccountId>,
+		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+	> WeightTrader
+	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>
+{
+	fn new() -> Self {
+		Self(0, Zero::zero(), PhantomData)
+	}
+
+	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {
+		let amount = WeightToFee::calc(&weight);
+		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;
+
+		// location to this parachain through relay chain
+		let option1: xcm::v1::AssetId = Concrete(MultiLocation {
+			parents: 1,
+			interior: X1(Parachain(ParachainInfo::parachain_id().into())),
+		});
+		// direct location
+		let option2: xcm::v1::AssetId = Concrete(MultiLocation {
+			parents: 0,
+			interior: Here,
+		});
+
+		let required = if payment.fungible.contains_key(&option1) {
+			(option1, u128_amount).into()
+		} else if payment.fungible.contains_key(&option2) {
+			(option2, u128_amount).into()
+		} else {
+			(Concrete(MultiLocation::default()), u128_amount).into()
+		};
+
+		let unused = payment
+			.checked_sub(required)
+			.map_err(|_| XcmError::TooExpensive)?;
+		self.0 = self.0.saturating_add(weight);
+		self.1 = self.1.saturating_add(amount);
+		Ok(unused)
+	}
+
+	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {
+		let weight = weight.min(self.0);
+		let amount = WeightToFee::calc(&weight);
+		self.0 -= weight;
+		self.1 = self.1.saturating_sub(amount);
+		let amount: u128 = amount.saturated_into();
+		if amount > 0 {
+			Some((AssetId::get(), amount).into())
+		} else {
+			None
+		}
+	}
+}
+impl<
+		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,
+		AssetId: Get<MultiLocation>,
+		AccountId,
+		Currency: CurrencyT<AccountId>,
+		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
+	> Drop
+	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>
+{
+	fn drop(&mut self) {
+		OnUnbalanced::on_unbalanced(Currency::issue(self.1));
+	}
+}
+
+pub struct XcmConfig;
+impl Config for XcmConfig {
+	type Call = Call;
+	type XcmSender = XcmRouter;
+	// How to withdraw and deposit an asset.
+	type AssetTransactor = LocalAssetTransactor;
+	type OriginConverter = XcmOriginToTransactDispatchOrigin;
+	type IsReserve = NativeAsset;
+	type IsTeleporter = (); // Teleportation is disabled
+	type LocationInverter = LocationInverter<Ancestry>;
+	type Barrier = Barrier;
+	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
+	type Trader = UsingOnlySelfCurrencyComponents<
+		IdentityFee<Balance>,
+		RelayLocation,
+		AccountId,
+		Balances,
+		(),
+	>;
+	type ResponseHandler = (); // Don't handle responses for now.
+	type SubscriptionService = PolkadotXcm;
+
+	type AssetTrap = PolkadotXcm;
+	type AssetClaims = PolkadotXcm;
+}
+
+// parameter_types! {
+// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;
+// }
+
+/// No local origins on this chain are allowed to dispatch XCM sends/executions.
+pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);
+
+/// The means for routing XCM messages which are not for local execution into the right message
+/// queues.
+pub type XcmRouter = (
+	// Two routers - use UMP to communicate with the relay chain:
+	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,
+	// ..and XCMP to communicate with the sibling chains.
+	XcmpQueue,
+);
+
+impl pallet_evm_coder_substrate::Config for Runtime {
+	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;
+	type GasWeightMapping = FixedGasWeightMapping;
+}
+
+impl pallet_xcm::Config for Runtime {
+	type Event = Event;
+	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
+	type XcmRouter = XcmRouter;
+	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
+	type XcmExecuteFilter = Everything;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type XcmTeleportFilter = Everything;
+	type XcmReserveTransferFilter = Everything;
+	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
+	type LocationInverter = LocationInverter<Ancestry>;
+	type Origin = Origin;
+	type Call = Call;
+	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
+	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
+}
+
+impl cumulus_pallet_xcm::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+}
+
+impl cumulus_pallet_xcmp_queue::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type ChannelInfo = ParachainSystem;
+	type VersionWrapper = ();
+	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+}
+
+impl cumulus_pallet_dmp_queue::Config for Runtime {
+	type Event = Event;
+	type XcmExecutor = XcmExecutor<XcmConfig>;
+	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+}
+
+impl pallet_aura::Config for Runtime {
+	type AuthorityId = AuraId;
+	type DisabledValidators = ();
+	type MaxAuthorities = MaxAuthorities;
+}
+
+parameter_types! {
+	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();
+	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;
+}
+
+impl pallet_common::Config for Runtime {
+	type Event = Event;
+	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
+	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
+	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;
+
+	type Currency = Balances;
+	type CollectionCreationPrice = CollectionCreationPrice;
+	type TreasuryAccountId = TreasuryAccountId;
+}
+
+impl pallet_fungible::Config for Runtime {
+	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;
+}
+impl pallet_refungible::Config for Runtime {
+	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;
+}
+impl pallet_nonfungible::Config for Runtime {
+	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;
+}
+
+impl pallet_unique::Config for Runtime {
+	type Event = Event;
+	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
+}
+
+parameter_types! {
+	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied
+}
+
+/// Used for the pallet inflation
+impl pallet_inflation::Config for Runtime {
+	type Currency = Balances;
+	type TreasuryAccountId = TreasuryAccountId;
+	type InflationBlockInterval = InflationBlockInterval;
+	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
+}
+
+// parameter_types! {
+// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
+// 		RuntimeBlockWeights::get().max_block;
+// 	pub const MaxScheduledPerBlock: u32 = 50;
+// }
+
+type EvmSponsorshipHandler = (
+	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,
+	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,
+);
+type SponsorshipHandler = (
+	pallet_unique::UniqueSponsorshipHandler<Runtime>,
+	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,
+	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,
+);
+
+// impl pallet_unq_scheduler::Config for Runtime {
+// 	type Event = Event;
+// 	type Origin = Origin;
+// 	type PalletsOrigin = OriginCaller;
+// 	type Call = Call;
+// 	type MaximumWeight = MaximumSchedulerWeight;
+// 	type ScheduleOrigin = EnsureSigned<AccountId>;
+// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;
+// 	type SponsorshipHandler = SponsorshipHandler;
+// 	type WeightInfo = ();
+// }
+
+impl pallet_evm_transaction_payment::Config for Runtime {
+	type EvmSponsorshipHandler = EvmSponsorshipHandler;
+	type Currency = Balances;
+	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;
+	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;
+}
+
+impl pallet_charge_transaction::Config for Runtime {
+	type SponsorshipHandler = SponsorshipHandler;
+}
+
+// impl pallet_contract_helpers::Config for Runtime {
+//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
+// }
+
+parameter_types! {
+	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049
+	pub const HelpersContractAddress: H160 = H160([
+		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,
+	]);
+}
+
+impl pallet_evm_contract_helpers::Config for Runtime {
+	type ContractAddress = HelpersContractAddress;
+	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;
+}
+
+construct_runtime!(
+	pub enum Runtime where
+		Block = Block,
+		NodeBlock = opaque::Block,
+		UncheckedExtrinsic = UncheckedExtrinsic
+	{
+		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,
+		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
+
+		Aura: pallet_aura::{Pallet, Config<T>} = 22,
+		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,
+
+		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
+		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,
+		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,
+		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,
+		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,
+		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,
+		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,
+		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,
+		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
+		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
+
+		// XCM helpers.
+		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,
+		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,
+		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,
+		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
+
+		// Unique Pallets
+		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
+		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
+		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+		// free = 63
+		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
+		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
+		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,
+		Fungible: pallet_fungible::{Pallet, Storage} = 67,
+		Refungible: pallet_refungible::{Pallet, Storage} = 68,
+		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,
+
+		// Frontier
+		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,
+		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,
+
+		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,
+		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,
+		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,
+		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,
+	}
+);
+
+pub struct TransactionConverter;
+
+impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
+	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
+		UncheckedExtrinsic::new_unsigned(
+			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
+		)
+	}
+}
+
+impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {
+	fn convert_transaction(
+		&self,
+		transaction: pallet_ethereum::Transaction,
+	) -> opaque::UncheckedExtrinsic {
+		let extrinsic = UncheckedExtrinsic::new_unsigned(
+			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
+		);
+		let encoded = extrinsic.encode();
+		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])
+			.expect("Encoded extrinsic is always valid")
+	}
+}
+
+/// The address format for describing accounts.
+pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
+/// Block header type as expected by this runtime.
+pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
+/// Block type as expected by this runtime.
+pub type Block = generic::Block<Header, UncheckedExtrinsic>;
+/// A Block signed with a Justification
+pub type SignedBlock = generic::SignedBlock<Block>;
+/// BlockId type as expected by this runtime.
+pub type BlockId = generic::BlockId<Block>;
+/// The SignedExtension to the basic transaction logic.
+pub type SignedExtra = (
+	frame_system::CheckSpecVersion<Runtime>,
+	// system::CheckTxVersion<Runtime>,
+	frame_system::CheckGenesis<Runtime>,
+	frame_system::CheckEra<Runtime>,
+	frame_system::CheckNonce<Runtime>,
+	frame_system::CheckWeight<Runtime>,
+	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,
+	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,
+);
+/// Unchecked extrinsic type as expected by this runtime.
+pub type UncheckedExtrinsic =
+	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
+/// Extrinsic type that has already been checked.
+pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;
+/// Executive: handles dispatch to the various modules.
+pub type Executive = frame_executive::Executive<
+	Runtime,
+	Block,
+	frame_system::ChainContext<Runtime>,
+	Runtime,
+	AllPalletsReversedWithSystemFirst,
+>;
+
+impl_opaque_keys! {
+	pub struct SessionKeys {
+		pub aura: Aura,
+	}
+}
+
+impl fp_self_contained::SelfContainedCall for Call {
+	type SignedInfo = H160;
+
+	fn is_self_contained(&self) -> bool {
+		match self {
+			Call::Ethereum(call) => call.is_self_contained(),
+			_ => false,
+		}
+	}
+
+	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {
+		match self {
+			Call::Ethereum(call) => call.check_self_contained(),
+			_ => None,
+		}
+	}
+
+	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {
+		match self {
+			Call::Ethereum(call) => call.validate_self_contained(info),
+			_ => None,
+		}
+	}
+
+	fn pre_dispatch_self_contained(
+		&self,
+		info: &Self::SignedInfo,
+	) -> Option<Result<(), TransactionValidityError>> {
+		match self {
+			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),
+			_ => None,
+		}
+	}
+
+	fn apply_self_contained(
+		self,
+		info: Self::SignedInfo,
+	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {
+		match self {
+			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(
+				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),
+			)),
+			_ => None,
+		}
+	}
+}
+
+macro_rules! dispatch_unique_runtime {
+	($collection:ident.$method:ident($($name:ident),*)) => {{
+		use pallet_unique::dispatch::Dispatched;
+
+		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);
+		let dispatch = collection.as_dyn();
+
+		Ok(dispatch.$method($($name),*))
+	}};
+}
+impl_runtime_apis! {
+	impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>
+		for Runtime
+	{
+		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {
+			dispatch_unique_runtime!(collection.account_tokens(account))
+		}
+		fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {
+			dispatch_unique_runtime!(collection.token_exists(token))
+		}
+
+		fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {
+			dispatch_unique_runtime!(collection.token_owner(token))
+		}
+		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {
+			dispatch_unique_runtime!(collection.const_metadata(token))
+		}
+		fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {
+			dispatch_unique_runtime!(collection.variable_metadata(token))
+		}
+
+		fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {
+			dispatch_unique_runtime!(collection.collection_tokens())
+		}
+		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {
+			dispatch_unique_runtime!(collection.account_balance(account))
+		}
+		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {
+			dispatch_unique_runtime!(collection.balance(account, token))
+		}
+		fn allowance(
+			collection: CollectionId,
+			sender: CrossAccountId,
+			spender: CrossAccountId,
+			token: TokenId,
+		) -> Result<u128, DispatchError> {
+			dispatch_unique_runtime!(collection.allowance(sender, spender, token))
+		}
+
+		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {
+			<pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)
+				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))
+				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))
+		}
+		fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))
+		}
+		fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))
+		}
+		fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))
+		}
+		fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {
+			dispatch_unique_runtime!(collection.last_token_id())
+		}
+		fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {
+			Ok(<pallet_common::CollectionById<Runtime>>::get(collection))
+		}
+		fn collection_stats() -> Result<CollectionStats, DispatchError> {
+			Ok(<pallet_common::Pallet<Runtime>>::collection_stats())
+		}
+	}
+
+	impl sp_api::Core<Block> for Runtime {
+		fn version() -> RuntimeVersion {
+			VERSION
+		}
+
+		fn execute_block(block: Block) {
+			Executive::execute_block(block)
+		}
+
+		fn initialize_block(header: &<Block as BlockT>::Header) {
+			Executive::initialize_block(header)
+		}
+	}
+
+	impl sp_api::Metadata<Block> for Runtime {
+		fn metadata() -> OpaqueMetadata {
+			OpaqueMetadata::new(Runtime::metadata().into())
+		}
+	}
+
+	impl sp_block_builder::BlockBuilder<Block> for Runtime {
+		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
+			Executive::apply_extrinsic(extrinsic)
+		}
+
+		fn finalize_block() -> <Block as BlockT>::Header {
+			Executive::finalize_block()
+		}
+
+		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
+			data.create_extrinsics()
+		}
+
+		fn check_inherents(
+			block: Block,
+			data: sp_inherents::InherentData,
+		) -> sp_inherents::CheckInherentsResult {
+			data.check_extrinsics(&block)
+		}
+
+		// fn random_seed() -> <Block as BlockT>::Hash {
+		//     RandomnessCollectiveFlip::random_seed().0
+		// }
+	}
+
+	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
+		fn validate_transaction(
+			source: TransactionSource,
+			tx: <Block as BlockT>::Extrinsic,
+			hash: <Block as BlockT>::Hash,
+		) -> TransactionValidity {
+			Executive::validate_transaction(source, tx, hash)
+		}
+	}
+
+	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
+		fn offchain_worker(header: &<Block as BlockT>::Header) {
+			Executive::offchain_worker(header)
+		}
+	}
+
+	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {
+		fn chain_id() -> u64 {
+			<Runtime as pallet_evm::Config>::ChainId::get()
+		}
+
+		fn account_basic(address: H160) -> EVMAccount {
+			EVM::account_basic(&address)
+		}
+
+		fn gas_price() -> U256 {
+			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()
+		}
+
+		fn account_code_at(address: H160) -> Vec<u8> {
+			EVM::account_codes(address)
+		}
+
+		fn author() -> H160 {
+			<pallet_evm::Pallet<Runtime>>::find_author()
+		}
+
+		fn storage_at(address: H160, index: U256) -> H256 {
+			let mut tmp = [0u8; 32];
+			index.to_big_endian(&mut tmp);
+			EVM::account_storages(address, H256::from_slice(&tmp[..]))
+		}
+
+		#[allow(clippy::redundant_closure)]
+		fn call(
+			from: H160,
+			to: H160,
+			data: Vec<u8>,
+			value: U256,
+			gas_limit: U256,
+			max_fee_per_gas: Option<U256>,
+			max_priority_fee_per_gas: Option<U256>,
+			nonce: Option<U256>,
+			estimate: bool,
+			access_list: Option<Vec<(H160, Vec<H256>)>>,
+		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {
+			let config = if estimate {
+				let mut config = <Runtime as pallet_evm::Config>::config().clone();
+				config.estimate = true;
+				Some(config)
+			} else {
+				None
+			};
+
+			<Runtime as pallet_evm::Config>::Runner::call(
+				from,
+				to,
+				data,
+				value,
+				gas_limit.low_u64(),
+				max_fee_per_gas,
+				max_priority_fee_per_gas,
+				nonce,
+				access_list.unwrap_or_default(),
+				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
+			).map_err(|err| err.into())
+		}
+
+		#[allow(clippy::redundant_closure)]
+		fn create(
+			from: H160,
+			data: Vec<u8>,
+			value: U256,
+			gas_limit: U256,
+			max_fee_per_gas: Option<U256>,
+			max_priority_fee_per_gas: Option<U256>,
+			nonce: Option<U256>,
+			estimate: bool,
+			access_list: Option<Vec<(H160, Vec<H256>)>>,
+		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {
+			let config = if estimate {
+				let mut config = <Runtime as pallet_evm::Config>::config().clone();
+				config.estimate = true;
+				Some(config)
+			} else {
+				None
+			};
+
+			<Runtime as pallet_evm::Config>::Runner::create(
+				from,
+				data,
+				value,
+				gas_limit.low_u64(),
+				max_fee_per_gas,
+				max_priority_fee_per_gas,
+				nonce,
+				access_list.unwrap_or_default(),
+				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),
+			).map_err(|err| err.into())
+		}
+
+		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {
+			Ethereum::current_transaction_statuses()
+		}
+
+		fn current_block() -> Option<pallet_ethereum::Block> {
+			Ethereum::current_block()
+		}
+
+		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {
+			Ethereum::current_receipts()
+		}
+
+		fn current_all() -> (
+			Option<pallet_ethereum::Block>,
+			Option<Vec<pallet_ethereum::Receipt>>,
+			Option<Vec<TransactionStatus>>
+		) {
+			(
+				Ethereum::current_block(),
+				Ethereum::current_receipts(),
+				Ethereum::current_transaction_statuses()
+			)
+		}
+
+		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {
+			xts.into_iter().filter_map(|xt| match xt.0.function {
+				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),
+				_ => None
+			}).collect()
+		}
+
+		fn elasticity() -> Option<Permill> {
+			None
+		}
+	}
+
+	impl sp_session::SessionKeys<Block> for Runtime {
+		fn decode_session_keys(
+			encoded: Vec<u8>,
+		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
+			SessionKeys::decode_into_raw_public_keys(&encoded)
+		}
+
+		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
+			SessionKeys::generate(seed)
+		}
+	}
+
+	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
+		fn slot_duration() -> sp_consensus_aura::SlotDuration {
+			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
+		}
+
+		fn authorities() -> Vec<AuraId> {
+			Aura::authorities().to_vec()
+		}
+	}
+
+	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
+		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
+			ParachainSystem::collect_collation_info(header)
+		}
+	}
+
+	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
+		fn account_nonce(account: AccountId) -> Index {
+			System::account_nonce(account)
+		}
+	}
+
+	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
+		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
+			TransactionPayment::query_info(uxt, len)
+		}
+		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {
+			TransactionPayment::query_fee_details(uxt, len)
+		}
+	}
+
+	/*
+	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>
+		for Runtime
+	{
+		fn call(
+			origin: AccountId,
+			dest: AccountId,
+			value: Balance,
+			gas_limit: u64,
+			input_data: Vec<u8>,
+		) -> pallet_contracts_primitives::ContractExecResult {
+			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)
+		}
+
+		fn instantiate(
+			origin: AccountId,
+			endowment: Balance,
+			gas_limit: u64,
+			code: pallet_contracts_primitives::Code<Hash>,
+			data: Vec<u8>,
+			salt: Vec<u8>,
+		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>
+		{
+			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)
+		}
+
+		fn get_storage(
+			address: AccountId,
+			key: [u8; 32],
+		) -> pallet_contracts_primitives::GetStorageResult {
+			Contracts::get_storage(address, key)
+		}
+
+		fn rent_projection(
+			address: AccountId,
+		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {
+			Contracts::rent_projection(address)
+		}
+	}
+	*/
+
+	#[cfg(feature = "runtime-benchmarks")]
+	impl frame_benchmarking::Benchmark<Block> for Runtime {
+		fn benchmark_metadata(extra: bool) -> (
+			Vec<frame_benchmarking::BenchmarkList>,
+			Vec<frame_support::traits::StorageInfo>,
+		) {
+			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
+			use frame_support::traits::StorageInfoTrait;
+
+			let mut list = Vec::<BenchmarkList>::new();
+
+			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
+			list_benchmark!(list, extra, pallet_unique, Unique);
+			list_benchmark!(list, extra, pallet_inflation, Inflation);
+			list_benchmark!(list, extra, pallet_fungible, Fungible);
+			list_benchmark!(list, extra, pallet_refungible, Refungible);
+			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
+			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
+
+			let storage_info = AllPalletsReversedWithSystemFirst::storage_info();
+
+			return (list, storage_info)
+		}
+
+		fn dispatch_benchmark(
+			config: frame_benchmarking::BenchmarkConfig
+		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
+			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
+
+			let allowlist: Vec<TrackedStorageKey> = vec![
+				// Block Number
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
+				// Total Issuance
+				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
+				// Execution Phase
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
+				// Event Count
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
+				// System Events
+				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
+			];
+
+			let mut batches = Vec::<BenchmarkBatch>::new();
+			let params = (&config, &allowlist);
+
+			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
+			add_benchmark!(params, batches, pallet_unique, Unique);
+			add_benchmark!(params, batches, pallet_inflation, Inflation);
+			add_benchmark!(params, batches, pallet_fungible, Fungible);
+			add_benchmark!(params, batches, pallet_refungible, Refungible);
+			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
+			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
+
+			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
+			Ok(batches)
+		}
+	}
+}
+
+struct CheckInherents;
+
+impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
+	fn check_inherents(
+		block: &Block,
+		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
+	) -> sp_inherents::CheckInherentsResult {
+		let relay_chain_slot = relay_state_proof
+			.read_slot()
+			.expect("Could not read the relay chain slot from the proof");
+
+		let inherent_data =
+			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(
+				relay_chain_slot,
+				sp_std::time::Duration::from_secs(6),
+			)
+			.create_inherent_data()
+			.expect("Could not create the timestamp inherent data");
+
+		inherent_data.check_extrinsics(block)
+	}
+}
+
+cumulus_pallet_parachain_system::register_validate_block!(
+	Runtime = Runtime,
+	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
+	CheckInherents = CheckInherents,
+);