difftreelog
Fix after rebase
in: master
7 files changed
runtime/common/Cargo.tomldiffbeforeafterboth--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -26,12 +26,12 @@
[dependencies.sp-core]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-runtime]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.codec]
default-features = false
@@ -47,9 +47,9 @@
[dependencies.frame-support]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-system]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -7,7 +7,7 @@
description = 'Opal Runtime'
edition = '2021'
homepage = 'https://unique.network'
-license = 'All Rights Reserved'
+license = 'GPLv3'
name = 'opal-runtime'
repository = 'https://github.com/UniqueNetwork/unique-chain'
version = '0.1.0'
@@ -100,6 +100,7 @@
'xcm/std',
'xcm-builder/std',
'xcm-executor/std',
+ 'unique-runtime-common/std',
"orml-vesting/std",
]
@@ -118,33 +119,33 @@
default-features = false
git = 'https://github.com/paritytech/substrate.git'
optional = true
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-executive]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-support]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-system]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-system-benchmarking]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
optional = true
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-system-rpc-runtime-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.hex-literal]
optional = true
@@ -159,131 +160,131 @@
[dependencies.pallet-aura]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-balances]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
# Contracts specific packages
# [dependencies.pallet-contracts]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
# version = '4.0.0-dev'
# [dependencies.pallet-contracts-primitives]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
# version = '4.0.0-dev'
# [dependencies.pallet-contracts-rpc-runtime-api]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
# version = '4.0.0-dev'
[dependencies.pallet-randomness-collective-flip]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-sudo]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-timestamp]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-transaction-payment]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-transaction-payment-rpc-runtime-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-treasury]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
# [dependencies.pallet-vesting]
# default-features = false
# git = 'https://github.com/paritytech/substrate.git'
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
[dependencies.sp-arithmetic]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-block-builder]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-core]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-consensus-aura]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-inherents]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-io]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-offchain]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-runtime]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-session]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-std]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-transaction-pool]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-version]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.smallvec]
version = '1.6.1'
@@ -293,47 +294,47 @@
[dependencies.parachain-info]
default-features = false
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
[dependencies.cumulus-pallet-aura-ext]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-pallet-parachain-system]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-primitives-core]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-pallet-xcm]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-pallet-dmp-queue]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-pallet-xcmp-queue]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-primitives-utility]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-primitives-timestamp]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
################################################################################
@@ -341,32 +342,32 @@
[dependencies.polkadot-parachain]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.xcm]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.xcm-builder]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.xcm-executor]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.pallet-xcm]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.orml-vesting]
git = 'https://github.com/UniqueNetwork/open-runtime-module-library'
-branch = 'unique-polkadot-v0.9.16'
+branch = 'unique-polkadot-v0.9.17'
version = "0.4.1-dev"
default-features = false
@@ -390,21 +391,20 @@
pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.16', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
+pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.17', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-
################################################################################
# Build Dependencies
[build-dependencies.substrate-wasm-builder]
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -114,10 +114,7 @@
use unique_runtime_common::{types::*, constants::*};
-// mod chain_extension;
-// use crate::chain_extension::{NFTExtension, Imbalance};
-
-pub const RUNTIME_NAME: &'static str = "Opal";
+pub const RUNTIME_NAME: &str = "Opal";
pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -7,7 +7,7 @@
description = 'Quartz Runtime'
edition = '2021'
homepage = 'https://unique.network'
-license = 'All Rights Reserved'
+license = 'GPLv3'
name = 'quartz-runtime'
repository = 'https://github.com/UniqueNetwork/unique-chain'
version = '0.1.0'
@@ -100,6 +100,7 @@
'xcm/std',
'xcm-builder/std',
'xcm-executor/std',
+ 'unique-runtime-common/std',
"orml-vesting/std",
]
@@ -118,33 +119,33 @@
default-features = false
git = 'https://github.com/paritytech/substrate.git'
optional = true
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-executive]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-support]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-system]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-system-benchmarking]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
optional = true
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.frame-system-rpc-runtime-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.hex-literal]
optional = true
@@ -159,131 +160,131 @@
[dependencies.pallet-aura]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-balances]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
# Contracts specific packages
# [dependencies.pallet-contracts]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
# version = '4.0.0-dev'
# [dependencies.pallet-contracts-primitives]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
# version = '4.0.0-dev'
# [dependencies.pallet-contracts-rpc-runtime-api]
# git = 'https://github.com/paritytech/substrate.git'
# default-features = false
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
# version = '4.0.0-dev'
[dependencies.pallet-randomness-collective-flip]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-sudo]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-timestamp]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-transaction-payment]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-transaction-payment-rpc-runtime-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.pallet-treasury]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
# [dependencies.pallet-vesting]
# default-features = false
# git = 'https://github.com/paritytech/substrate.git'
-# branch = 'polkadot-v0.9.16'
+# branch = 'polkadot-v0.9.17'
[dependencies.sp-arithmetic]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-block-builder]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-core]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-consensus-aura]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-inherents]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-io]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-offchain]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-runtime]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-session]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-std]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-transaction-pool]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.sp-version]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
[dependencies.smallvec]
version = '1.6.1'
@@ -293,47 +294,47 @@
[dependencies.parachain-info]
default-features = false
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
[dependencies.cumulus-pallet-aura-ext]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-pallet-parachain-system]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-primitives-core]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-pallet-xcm]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-pallet-dmp-queue]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-pallet-xcmp-queue]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-primitives-utility]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
[dependencies.cumulus-primitives-timestamp]
-git = 'https://github.com/paritytech/cumulus.git'
-branch = 'polkadot-v0.9.16'
+git = 'https://github.com/uniqueNetwork/cumulus.git'
+branch = 'polkadot-v0.9.17'
default-features = false
################################################################################
@@ -341,32 +342,32 @@
[dependencies.polkadot-parachain]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.xcm]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.xcm-builder]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.xcm-executor]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.pallet-xcm]
git = 'https://github.com/paritytech/polkadot'
-branch = 'release-v0.9.16'
+branch = 'release-v0.9.17'
default-features = false
[dependencies.orml-vesting]
git = 'https://github.com/UniqueNetwork/open-runtime-module-library'
-branch = 'unique-polkadot-v0.9.16'
+branch = 'unique-polkadot-v0.9.17'
version = "0.4.1-dev"
default-features = false
@@ -390,21 +391,20 @@
pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
-pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.16', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
+pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.17', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }
pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
pallet-evm-contract-helpers = { path = '../../pallets/evm-contract-helpers', default-features = false }
pallet-evm-transaction-payment = { path = '../../pallets/evm-transaction-payment', default-features = false }
pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.17" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-pallet-base-fee = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.16" }
-
################################################################################
# Build Dependencies
[build-dependencies.substrate-wasm-builder]
git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.16'
+branch = 'polkadot-v0.9.17'
runtime/quartz/src/lib.rsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.78#![cfg_attr(not(feature = "std"), no_std)]9// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.10#![recursion_limit = "1024"]11#![allow(clippy::from_over_into, clippy::identity_op)]12#![allow(clippy::fn_to_numeric_cast_with_truncation)]13// Make the WASM binary available.14#[cfg(feature = "std")]15include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));1617use sp_api::impl_runtime_apis;18use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};19use sp_runtime::DispatchError;20// #[cfg(any(feature = "std", test))]21// pub use sp_runtime::BuildStorage;2223use sp_runtime::{24 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,25 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},26 transaction_validity::{TransactionSource, TransactionValidity},27 ApplyExtrinsicResult, RuntimeAppPublic,28};2930use sp_std::prelude::*;3132#[cfg(feature = "std")]33use sp_version::NativeVersion;34use sp_version::RuntimeVersion;35pub use pallet_transaction_payment::{36 Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,37};38// A few exports that help ease life for downstream crates.39pub use pallet_balances::Call as BalancesCall;40pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};41pub use frame_support::{42 construct_runtime, match_type,43 dispatch::DispatchResult,44 PalletId, parameter_types, StorageValue, ConsensusEngineId,45 traits::{46 tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,47 Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,48 OnUnbalanced, Randomness, FindAuthor,49 },50 weights::{51 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},52 DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,53 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,54 },55};56use up_data_structs::*;57// use pallet_contracts::weights::WeightInfo;58// #[cfg(any(feature = "std", test))]59use frame_system::{60 self as frame_system, EnsureRoot, EnsureSigned,61 limits::{BlockWeights, BlockLength},62};63use sp_arithmetic::{64 traits::{BaseArithmetic, Unsigned},65};66use smallvec::smallvec;67use codec::{Encode, Decode};68use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};69use fp_rpc::TransactionStatus;70use sp_runtime::{71 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},72 transaction_validity::TransactionValidityError,73 SaturatedConversion,74};7576// pub use pallet_timestamp::Call as TimestampCall;77pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;7879// Polkadot imports80use pallet_xcm::XcmPassthrough;81use polkadot_parachain::primitives::Sibling;82use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};83use xcm_builder::{84 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,85 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,86 ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,87 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,88};89use xcm_executor::{Config, XcmExecutor, Assets};90use sp_std::{marker::PhantomData};9192use xcm::latest::{93 // Xcm,94 AssetId::{Concrete},95 Fungibility::Fungible as XcmFungible,96 MultiAsset,97 Error as XcmError,98};99use xcm_executor::traits::{MatchesFungible, WeightTrader};100//use xcm_executor::traits::MatchesFungible;101use sp_runtime::traits::CheckedConversion;102103use unique_runtime_common::{types::*, constants::*};104105// mod chain_extension;106// use crate::chain_extension::{NFTExtension, Imbalance};107108pub const RUNTIME_NAME: &'static str = "Quartz";109110pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;111112/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know113/// the specifics of the runtime. They can then be made to be agnostic over specific formats114/// of data like extrinsics, allowing for them to continue syncing the network through upgrades115/// to even the core data structures.116pub mod opaque {117 use sp_std::prelude::*;118 use sp_runtime::impl_opaque_keys;119 use super::Aura;120121 pub use unique_runtime_common::types::*;122 pub use super::CrossAccountId;123124 impl_opaque_keys! {125 pub struct SessionKeys {126 pub aura: Aura,127 }128 }129}130131/// This runtime version.132pub const VERSION: RuntimeVersion = RuntimeVersion {133 spec_name: create_runtime_str!(RUNTIME_NAME),134 impl_name: create_runtime_str!(RUNTIME_NAME),135 authoring_version: 1,136 spec_version: 916001,137 impl_version: 0,138 apis: RUNTIME_API_VERSIONS,139 transaction_version: 1,140 state_version: 0,141};142143#[derive(codec::Encode, codec::Decode)]144pub enum XCMPMessage<XAccountId, XBalance> {145 /// Transfer tokens to the given account from the Parachain account.146 TransferToken(XAccountId, XBalance),147}148149/// The version information used to identify this runtime when compiled natively.150#[cfg(feature = "std")]151pub fn native_version() -> NativeVersion {152 NativeVersion {153 runtime_version: VERSION,154 can_author_with: Default::default(),155 }156}157158type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;159160pub struct DealWithFees;161impl OnUnbalanced<NegativeImbalance> for DealWithFees {162 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {163 if let Some(fees) = fees_then_tips.next() {164 // for fees, 100% to treasury165 let mut split = fees.ration(100, 0);166 if let Some(tips) = fees_then_tips.next() {167 // for tips, if any, 100% to treasury168 tips.ration_merge_into(100, 0, &mut split);169 }170 Treasury::on_unbalanced(split.0);171 // Author::on_unbalanced(split.1);172 }173 }174}175176parameter_types! {177 pub const BlockHashCount: BlockNumber = 2400;178 pub RuntimeBlockLength: BlockLength =179 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);180 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);181 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;182 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()183 .base_block(BlockExecutionWeight::get())184 .for_class(DispatchClass::all(), |weights| {185 weights.base_extrinsic = ExtrinsicBaseWeight::get();186 })187 .for_class(DispatchClass::Normal, |weights| {188 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);189 })190 .for_class(DispatchClass::Operational, |weights| {191 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);192 // Operational transactions have some extra reserved space, so that they193 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.194 weights.reserved = Some(195 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT196 );197 })198 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)199 .build_or_panic();200 pub const Version: RuntimeVersion = VERSION;201 pub const SS58Prefix: u8 = 255;202}203204parameter_types! {205 pub const ChainId: u64 = 8888;206}207208pub struct FixedFee;209impl FeeCalculator for FixedFee {210 fn min_gas_price() -> U256 {211 // Targeting 0.15 UNQ per transfer212 1_024_947_215_000u64.into()213 }214}215216// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case217// (contract, which only writes a lot of data),218// approximating on top of our real store write weight219parameter_types! {220 pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;221 pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;222 pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();223}224225/// Limiting EVM execution to 50% of block for substrate users and management tasks226/// EVM transaction consumes more weight than substrate's, so we can't rely on them being227/// scheduled fairly228const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);229parameter_types! {230 pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());231}232233pub enum FixedGasWeightMapping {}234impl GasWeightMapping for FixedGasWeightMapping {235 fn gas_to_weight(gas: u64) -> Weight {236 gas.saturating_mul(WeightPerGas::get())237 }238 fn weight_to_gas(weight: Weight) -> u64 {239 weight / WeightPerGas::get()240 }241}242243impl pallet_evm::Config for Runtime {244 type BlockGasLimit = BlockGasLimit;245 type FeeCalculator = FixedFee;246 type GasWeightMapping = FixedGasWeightMapping;247 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;248 type CallOrigin = EnsureAddressTruncated;249 type WithdrawOrigin = EnsureAddressTruncated;250 type AddressMapping = HashedAddressMapping<Self::Hashing>;251 type PrecompilesType = ();252 type PrecompilesValue = ();253 type Currency = Balances;254 type Event = Event;255 type OnMethodCall = (256 pallet_evm_migration::OnMethodCall<Self>,257 pallet_unique::UniqueErcSupport<Self>,258 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,259 );260 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;261 type ChainId = ChainId;262 type Runner = pallet_evm::runner::stack::Runner<Self>;263 type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;264 type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;265 type FindAuthor = EthereumFindAuthor<Aura>;266}267268impl pallet_evm_migration::Config for Runtime {269 type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;270}271272pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);273impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {274 fn find_author<'a, I>(digests: I) -> Option<H160>275 where276 I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,277 {278 if let Some(author_index) = F::find_author(digests) {279 let authority_id = Aura::authorities()[author_index as usize].clone();280 return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));281 }282 None283 }284}285286impl pallet_ethereum::Config for Runtime {287 type Event = Event;288 type StateRoot = pallet_ethereum::IntermediateStateRoot;289}290291impl pallet_randomness_collective_flip::Config for Runtime {}292293impl frame_system::Config for Runtime {294 /// The data to be stored in an account.295 type AccountData = pallet_balances::AccountData<Balance>;296 /// The identifier used to distinguish between accounts.297 type AccountId = AccountId;298 /// The basic call filter to use in dispatchable.299 type BaseCallFilter = Everything;300 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).301 type BlockHashCount = BlockHashCount;302 /// The maximum length of a block (in bytes).303 type BlockLength = RuntimeBlockLength;304 /// The index type for blocks.305 type BlockNumber = BlockNumber;306 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.307 type BlockWeights = RuntimeBlockWeights;308 /// The aggregated dispatch type that is available for extrinsics.309 type Call = Call;310 /// The weight of database operations that the runtime can invoke.311 type DbWeight = RocksDbWeight;312 /// The ubiquitous event type.313 type Event = Event;314 /// The type for hashing blocks and tries.315 type Hash = Hash;316 /// The hashing algorithm used.317 type Hashing = BlakeTwo256;318 /// The header type.319 type Header = generic::Header<BlockNumber, BlakeTwo256>;320 /// The index type for storing how many extrinsics an account has signed.321 type Index = Index;322 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.323 type Lookup = AccountIdLookup<AccountId, ()>;324 /// What to do if an account is fully reaped from the system.325 type OnKilledAccount = ();326 /// What to do if a new account is created.327 type OnNewAccount = ();328 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;329 /// The ubiquitous origin type.330 type Origin = Origin;331 /// This type is being generated by `construct_runtime!`.332 type PalletInfo = PalletInfo;333 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.334 type SS58Prefix = SS58Prefix;335 /// Weight information for the extrinsics of this pallet.336 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;337 /// Version of the runtime.338 type Version = Version;339 type MaxConsumers = ConstU32<16>;340}341342parameter_types! {343 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;344}345346impl pallet_timestamp::Config for Runtime {347 /// A timestamp: milliseconds since the unix epoch.348 type Moment = u64;349 type OnTimestampSet = ();350 type MinimumPeriod = MinimumPeriod;351 type WeightInfo = ();352}353354parameter_types! {355 // pub const ExistentialDeposit: u128 = 500;356 pub const ExistentialDeposit: u128 = 0;357 pub const MaxLocks: u32 = 50;358}359360impl pallet_balances::Config for Runtime {361 type MaxLocks = MaxLocks;362 type MaxReserves = ();363 type ReserveIdentifier = [u8; 8];364 /// The type for recording an account's balance.365 type Balance = Balance;366 /// The ubiquitous event type.367 type Event = Event;368 type DustRemoval = Treasury;369 type ExistentialDeposit = ExistentialDeposit;370 type AccountStore = System;371 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;372}373374pub const MICROUNIQUE: Balance = 1_000_000_000_000;375pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;376pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;377pub const UNIQUE: Balance = 100 * CENTIUNIQUE;378379pub const fn deposit(items: u32, bytes: u32) -> Balance {380 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE381}382383/*384parameter_types! {385 pub TombstoneDeposit: Balance = deposit(386 1,387 sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,388 );389 pub DepositPerContract: Balance = TombstoneDeposit::get();390 pub const DepositPerStorageByte: Balance = deposit(0, 1);391 pub const DepositPerStorageItem: Balance = deposit(1, 0);392 pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);393 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;394 pub const SignedClaimHandicap: u32 = 2;395 pub const MaxDepth: u32 = 32;396 pub const MaxValueSize: u32 = 16 * 1024;397 pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb398 // The lazy deletion runs inside on_initialize.399 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *400 RuntimeBlockWeights::get().max_block;401 // The weight needed for decoding the queue should be less or equal than a fifth402 // of the overall weight dedicated to the lazy deletion.403 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (404 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -405 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)406 )) / 5) as u32;407 pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();408}409410impl pallet_contracts::Config for Runtime {411 type Time = Timestamp;412 type Randomness = RandomnessCollectiveFlip;413 type Currency = Balances;414 type Event = Event;415 type RentPayment = ();416 type SignedClaimHandicap = SignedClaimHandicap;417 type TombstoneDeposit = TombstoneDeposit;418 type DepositPerContract = DepositPerContract;419 type DepositPerStorageByte = DepositPerStorageByte;420 type DepositPerStorageItem = DepositPerStorageItem;421 type RentFraction = RentFraction;422 type SurchargeReward = SurchargeReward;423 type WeightPrice = pallet_transaction_payment::Pallet<Self>;424 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;425 type ChainExtension = NFTExtension;426 type DeletionQueueDepth = DeletionQueueDepth;427 type DeletionWeightLimit = DeletionWeightLimit;428 type Schedule = Schedule;429 type CallStack = [pallet_contracts::Frame<Self>; 31];430}431*/432433parameter_types! {434 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer435 /// This value increases the priority of `Operational` transactions by adding436 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.437 pub const OperationalFeeMultiplier: u8 = 5;438}439440/// Linear implementor of `WeightToFeePolynomial`441pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);442443impl<T> WeightToFeePolynomial for LinearFee<T>444where445 T: BaseArithmetic + From<u32> + Copy + Unsigned,446{447 type Balance = T;448449 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {450 smallvec!(WeightToFeeCoefficient {451 // Targeting 0.1 Unique per NFT transfer452 coeff_integer: 142_688_000u32.into(),453 coeff_frac: Perbill::zero(),454 negative: false,455 degree: 1,456 })457 }458}459460impl pallet_transaction_payment::Config for Runtime {461 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;462 type TransactionByteFee = TransactionByteFee;463 type OperationalFeeMultiplier = OperationalFeeMultiplier;464 type WeightToFee = LinearFee<Balance>;465 type FeeMultiplierUpdate = ();466}467468parameter_types! {469 pub const ProposalBond: Permill = Permill::from_percent(5);470 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;471 pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;472 pub const SpendPeriod: BlockNumber = 5 * MINUTES;473 pub const Burn: Permill = Permill::from_percent(0);474 pub const TipCountdown: BlockNumber = 1 * DAYS;475 pub const TipFindersFee: Percent = Percent::from_percent(20);476 pub const TipReportDepositBase: Balance = 1 * UNIQUE;477 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;478 pub const BountyDepositBase: Balance = 1 * UNIQUE;479 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;480 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");481 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;482 pub const MaximumReasonLength: u32 = 16384;483 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);484 pub const BountyValueMinimum: Balance = 5 * UNIQUE;485 pub const MaxApprovals: u32 = 100;486}487488impl pallet_treasury::Config for Runtime {489 type PalletId = TreasuryModuleId;490 type Currency = Balances;491 type ApproveOrigin = EnsureRoot<AccountId>;492 type RejectOrigin = EnsureRoot<AccountId>;493 type Event = Event;494 type OnSlash = ();495 type ProposalBond = ProposalBond;496 type ProposalBondMinimum = ProposalBondMinimum;497 type ProposalBondMaximum = ProposalBondMaximum;498 type SpendPeriod = SpendPeriod;499 type Burn = Burn;500 type BurnDestination = ();501 type SpendFunds = ();502 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;503 type MaxApprovals = MaxApprovals;504}505506impl pallet_sudo::Config for Runtime {507 type Event = Event;508 type Call = Call;509}510511pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);512513impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider514 for RelayChainBlockNumberProvider<T>515{516 type BlockNumber = BlockNumber;517518 fn current_block_number() -> Self::BlockNumber {519 cumulus_pallet_parachain_system::Pallet::<T>::validation_data()520 .map(|d| d.relay_parent_number)521 .unwrap_or_default()522 }523}524525parameter_types! {526 pub const MinVestedTransfer: Balance = 10 * UNIQUE;527 pub const MaxVestingSchedules: u32 = 28;528}529530impl orml_vesting::Config for Runtime {531 type Event = Event;532 type Currency = pallet_balances::Pallet<Runtime>;533 type MinVestedTransfer = MinVestedTransfer;534 type VestedTransferOrigin = EnsureSigned<AccountId>;535 type WeightInfo = ();536 type MaxVestingSchedules = MaxVestingSchedules;537 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;538}539540parameter_types! {541 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;542 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;543}544545impl cumulus_pallet_parachain_system::Config for Runtime {546 type Event = Event;547 type SelfParaId = parachain_info::Pallet<Self>;548 type OnSystemEvent = ();549 // type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<550 // MaxDownwardMessageWeight,551 // XcmExecutor<XcmConfig>,552 // Call,553 // >;554 type OutboundXcmpMessageSource = XcmpQueue;555 type DmpMessageHandler = DmpQueue;556 type ReservedDmpWeight = ReservedDmpWeight;557 type ReservedXcmpWeight = ReservedXcmpWeight;558 type XcmpMessageHandler = XcmpQueue;559}560561impl parachain_info::Config for Runtime {}562563impl cumulus_pallet_aura_ext::Config for Runtime {}564565parameter_types! {566 pub const RelayLocation: MultiLocation = MultiLocation::parent();567 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;568 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();569 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();570}571572/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used573/// when determining ownership of accounts for asset transacting and when attempting to use XCM574/// `Transact` in order to determine the dispatch Origin.575pub type LocationToAccountId = (576 // The parent (Relay-chain) origin converts to the default `AccountId`.577 ParentIsDefault<AccountId>,578 // Sibling parachain origins convert to AccountId via the `ParaId::into`.579 SiblingParachainConvertsVia<Sibling, AccountId>,580 // Straight up local `AccountId32` origins just alias directly to `AccountId`.581 AccountId32Aliases<RelayNetwork, AccountId>,582);583584pub struct OnlySelfCurrency;585impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {586 fn matches_fungible(a: &MultiAsset) -> Option<B> {587 match (&a.id, &a.fun) {588 (Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),589 _ => None,590 }591 }592}593594/// Means for transacting assets on this chain.595pub type LocalAssetTransactor = CurrencyAdapter<596 // Use this currency:597 Balances,598 // Use this currency when it is a fungible asset matching the given location or name:599 OnlySelfCurrency,600 // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:601 LocationToAccountId,602 // Our chain's account ID type (we can't get away without mentioning it explicitly):603 AccountId,604 // We don't track any teleports.605 (),606>;607608/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,609/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can610/// biases the kind of local `Origin` it will become.611pub type XcmOriginToTransactDispatchOrigin = (612 // Sovereign account converter; this attempts to derive an `AccountId` from the origin location613 // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for614 // foreign chains who want to have a local sovereign account on this chain which they control.615 SovereignSignedViaLocation<LocationToAccountId, Origin>,616 // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when617 // recognised.618 RelayChainAsNative<RelayOrigin, Origin>,619 // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when620 // recognised.621 SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,622 // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a623 // transaction from the Root origin.624 ParentAsSuperuser<Origin>,625 // Native signed account converter; this just converts an `AccountId32` origin into a normal626 // `Origin::Signed` origin of the same 32-byte value.627 SignedAccountId32AsNative<RelayNetwork, Origin>,628 // Xcm origins can be represented natively under the Xcm pallet's Xcm origin.629 XcmPassthrough<Origin>,630);631632parameter_types! {633 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.634 pub UnitWeightCost: Weight = 1_000_000;635 // 1200 UNIQUEs buy 1 second of weight.636 pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);637 pub const MaxInstructions: u32 = 100;638 pub const MaxAuthorities: u32 = 100_000;639}640641match_type! {642 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {643 MultiLocation { parents: 1, interior: Here } |644 MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }645 };646}647648pub type Barrier = (649 TakeWeightCredit,650 AllowTopLevelPaidExecutionFrom<Everything>,651 AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,652 // ^^^ Parent & its unit plurality gets free execution653);654655pub struct UsingOnlySelfCurrencyComponents<656 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,657 AssetId: Get<MultiLocation>,658 AccountId,659 Currency: CurrencyT<AccountId>,660 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,661>(662 Weight,663 Currency::Balance,664 PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,665);666impl<667 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,668 AssetId: Get<MultiLocation>,669 AccountId,670 Currency: CurrencyT<AccountId>,671 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,672 > WeightTrader673 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>674{675 fn new() -> Self {676 Self(0, Zero::zero(), PhantomData)677 }678679 fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {680 let amount = WeightToFee::calc(&weight);681 let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;682683 // location to this parachain through relay chain684 let option1: xcm::v1::AssetId = Concrete(MultiLocation {685 parents: 1,686 interior: X1(Parachain(ParachainInfo::parachain_id().into())),687 });688 // direct location689 let option2: xcm::v1::AssetId = Concrete(MultiLocation {690 parents: 0,691 interior: Here,692 });693694 let required = if payment.fungible.contains_key(&option1) {695 (option1, u128_amount).into()696 } else if payment.fungible.contains_key(&option2) {697 (option2, u128_amount).into()698 } else {699 (Concrete(MultiLocation::default()), u128_amount).into()700 };701702 let unused = payment703 .checked_sub(required)704 .map_err(|_| XcmError::TooExpensive)?;705 self.0 = self.0.saturating_add(weight);706 self.1 = self.1.saturating_add(amount);707 Ok(unused)708 }709710 fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {711 let weight = weight.min(self.0);712 let amount = WeightToFee::calc(&weight);713 self.0 -= weight;714 self.1 = self.1.saturating_sub(amount);715 let amount: u128 = amount.saturated_into();716 if amount > 0 {717 Some((AssetId::get(), amount).into())718 } else {719 None720 }721 }722}723impl<724 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,725 AssetId: Get<MultiLocation>,726 AccountId,727 Currency: CurrencyT<AccountId>,728 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,729 > Drop730 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>731{732 fn drop(&mut self) {733 OnUnbalanced::on_unbalanced(Currency::issue(self.1));734 }735}736737pub struct XcmConfig;738impl Config for XcmConfig {739 type Call = Call;740 type XcmSender = XcmRouter;741 // How to withdraw and deposit an asset.742 type AssetTransactor = LocalAssetTransactor;743 type OriginConverter = XcmOriginToTransactDispatchOrigin;744 type IsReserve = NativeAsset;745 type IsTeleporter = (); // Teleportation is disabled746 type LocationInverter = LocationInverter<Ancestry>;747 type Barrier = Barrier;748 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;749 type Trader = UsingOnlySelfCurrencyComponents<750 IdentityFee<Balance>,751 RelayLocation,752 AccountId,753 Balances,754 (),755 >;756 type ResponseHandler = (); // Don't handle responses for now.757 type SubscriptionService = PolkadotXcm;758759 type AssetTrap = PolkadotXcm;760 type AssetClaims = PolkadotXcm;761}762763// parameter_types! {764// pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;765// }766767/// No local origins on this chain are allowed to dispatch XCM sends/executions.768pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);769770/// The means for routing XCM messages which are not for local execution into the right message771/// queues.772pub type XcmRouter = (773 // Two routers - use UMP to communicate with the relay chain:774 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,775 // ..and XCMP to communicate with the sibling chains.776 XcmpQueue,777);778779impl pallet_evm_coder_substrate::Config for Runtime {780 type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;781 type GasWeightMapping = FixedGasWeightMapping;782}783784impl pallet_xcm::Config for Runtime {785 type Event = Event;786 type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;787 type XcmRouter = XcmRouter;788 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;789 type XcmExecuteFilter = Everything;790 type XcmExecutor = XcmExecutor<XcmConfig>;791 type XcmTeleportFilter = Everything;792 type XcmReserveTransferFilter = Everything;793 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;794 type LocationInverter = LocationInverter<Ancestry>;795 type Origin = Origin;796 type Call = Call;797 const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;798 type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;799}800801impl cumulus_pallet_xcm::Config for Runtime {802 type Event = Event;803 type XcmExecutor = XcmExecutor<XcmConfig>;804}805806impl cumulus_pallet_xcmp_queue::Config for Runtime {807 type Event = Event;808 type XcmExecutor = XcmExecutor<XcmConfig>;809 type ChannelInfo = ParachainSystem;810 type VersionWrapper = ();811 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;812}813814impl cumulus_pallet_dmp_queue::Config for Runtime {815 type Event = Event;816 type XcmExecutor = XcmExecutor<XcmConfig>;817 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;818}819820impl pallet_aura::Config for Runtime {821 type AuthorityId = AuraId;822 type DisabledValidators = ();823 type MaxAuthorities = MaxAuthorities;824}825826parameter_types! {827 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();828 pub const CollectionCreationPrice: Balance = 100 * UNIQUE;829}830831impl pallet_common::Config for Runtime {832 type Event = Event;833 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;834 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;835 type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;836837 type Currency = Balances;838 type CollectionCreationPrice = CollectionCreationPrice;839 type TreasuryAccountId = TreasuryAccountId;840}841842impl pallet_fungible::Config for Runtime {843 type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;844}845impl pallet_refungible::Config for Runtime {846 type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;847}848impl pallet_nonfungible::Config for Runtime {849 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;850}851852impl pallet_unique::Config for Runtime {853 type Event = Event;854 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;855}856857parameter_types! {858 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied859}860861/// Used for the pallet inflation862impl pallet_inflation::Config for Runtime {863 type Currency = Balances;864 type TreasuryAccountId = TreasuryAccountId;865 type InflationBlockInterval = InflationBlockInterval;866 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;867}868869// parameter_types! {870// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *871// RuntimeBlockWeights::get().max_block;872// pub const MaxScheduledPerBlock: u32 = 50;873// }874875type EvmSponsorshipHandler = (876 pallet_unique::UniqueEthSponsorshipHandler<Runtime>,877 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,878);879type SponsorshipHandler = (880 pallet_unique::UniqueSponsorshipHandler<Runtime>,881 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,882 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,883);884885// impl pallet_unq_scheduler::Config for Runtime {886// type Event = Event;887// type Origin = Origin;888// type PalletsOrigin = OriginCaller;889// type Call = Call;890// type MaximumWeight = MaximumSchedulerWeight;891// type ScheduleOrigin = EnsureSigned<AccountId>;892// type MaxScheduledPerBlock = MaxScheduledPerBlock;893// type SponsorshipHandler = SponsorshipHandler;894// type WeightInfo = ();895// }896897impl pallet_evm_transaction_payment::Config for Runtime {898 type EvmSponsorshipHandler = EvmSponsorshipHandler;899 type Currency = Balances;900 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;901 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;902}903904impl pallet_charge_transaction::Config for Runtime {905 type SponsorshipHandler = SponsorshipHandler;906}907908// impl pallet_contract_helpers::Config for Runtime {909// type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;910// }911912parameter_types! {913 // 0x842899ECF380553E8a4de75bF534cdf6fBF64049914 pub const HelpersContractAddress: H160 = H160([915 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,916 ]);917}918919impl pallet_evm_contract_helpers::Config for Runtime {920 type ContractAddress = HelpersContractAddress;921 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;922}923924construct_runtime!(925 pub enum Runtime where926 Block = Block,927 NodeBlock = opaque::Block,928 UncheckedExtrinsic = UncheckedExtrinsic929 {930 ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,931 ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,932933 Aura: pallet_aura::{Pallet, Config<T>} = 22,934 AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,935936 Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,937 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,938 Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,939 TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,940 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,941 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,942 System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,943 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,944 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,945 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,946947 // XCM helpers.948 XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,949 PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,950 CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,951 DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,952953 // Unique Pallets954 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,955 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,956 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,957 // free = 63958 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,959 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,960 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,961 Fungible: pallet_fungible::{Pallet, Storage} = 67,962 Refungible: pallet_refungible::{Pallet, Storage} = 68,963 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,964965 // Frontier966 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,967 Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,968969 EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,970 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,971 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,972 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,973 }974);975976pub struct TransactionConverter;977978impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {979 fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {980 UncheckedExtrinsic::new_unsigned(981 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),982 )983 }984}985986impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {987 fn convert_transaction(988 &self,989 transaction: pallet_ethereum::Transaction,990 ) -> opaque::UncheckedExtrinsic {991 let extrinsic = UncheckedExtrinsic::new_unsigned(992 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),993 );994 let encoded = extrinsic.encode();995 opaque::UncheckedExtrinsic::decode(&mut &encoded[..])996 .expect("Encoded extrinsic is always valid")997 }998}9991000/// The address format for describing accounts.1001pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1002/// Block header type as expected by this runtime.1003pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1004/// Block type as expected by this runtime.1005pub type Block = generic::Block<Header, UncheckedExtrinsic>;1006/// A Block signed with a Justification1007pub type SignedBlock = generic::SignedBlock<Block>;1008/// BlockId type as expected by this runtime.1009pub type BlockId = generic::BlockId<Block>;1010/// The SignedExtension to the basic transaction logic.1011pub type SignedExtra = (1012 frame_system::CheckSpecVersion<Runtime>,1013 // system::CheckTxVersion<Runtime>,1014 frame_system::CheckGenesis<Runtime>,1015 frame_system::CheckEra<Runtime>,1016 frame_system::CheckNonce<Runtime>,1017 frame_system::CheckWeight<Runtime>,1018 pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1019 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,1020);1021/// Unchecked extrinsic type as expected by this runtime.1022pub type UncheckedExtrinsic =1023 fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1024/// Extrinsic type that has already been checked.1025pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1026/// Executive: handles dispatch to the various modules.1027pub type Executive = frame_executive::Executive<1028 Runtime,1029 Block,1030 frame_system::ChainContext<Runtime>,1031 Runtime,1032 AllPalletsReversedWithSystemFirst,1033>;10341035impl_opaque_keys! {1036 pub struct SessionKeys {1037 pub aura: Aura,1038 }1039}10401041impl fp_self_contained::SelfContainedCall for Call {1042 type SignedInfo = H160;10431044 fn is_self_contained(&self) -> bool {1045 match self {1046 Call::Ethereum(call) => call.is_self_contained(),1047 _ => false,1048 }1049 }10501051 fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1052 match self {1053 Call::Ethereum(call) => call.check_self_contained(),1054 _ => None,1055 }1056 }10571058 fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1059 match self {1060 Call::Ethereum(call) => call.validate_self_contained(info),1061 _ => None,1062 }1063 }10641065 fn pre_dispatch_self_contained(1066 &self,1067 info: &Self::SignedInfo,1068 ) -> Option<Result<(), TransactionValidityError>> {1069 match self {1070 Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1071 _ => None,1072 }1073 }10741075 fn apply_self_contained(1076 self,1077 info: Self::SignedInfo,1078 ) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1079 match self {1080 call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1081 Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1082 )),1083 _ => None,1084 }1085 }1086}10871088macro_rules! dispatch_unique_runtime {1089 ($collection:ident.$method:ident($($name:ident),*)) => {{1090 use pallet_unique::dispatch::Dispatched;10911092 let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1093 let dispatch = collection.as_dyn();10941095 Ok(dispatch.$method($($name),*))1096 }};1097}1098impl_runtime_apis! {1099 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1100 for Runtime1101 {1102 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1103 dispatch_unique_runtime!(collection.account_tokens(account))1104 }1105 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1106 dispatch_unique_runtime!(collection.token_exists(token))1107 }11081109 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1110 dispatch_unique_runtime!(collection.token_owner(token))1111 }1112 fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1113 dispatch_unique_runtime!(collection.const_metadata(token))1114 }1115 fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1116 dispatch_unique_runtime!(collection.variable_metadata(token))1117 }11181119 fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1120 dispatch_unique_runtime!(collection.collection_tokens())1121 }1122 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1123 dispatch_unique_runtime!(collection.account_balance(account))1124 }1125 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1126 dispatch_unique_runtime!(collection.balance(account, token))1127 }1128 fn allowance(1129 collection: CollectionId,1130 sender: CrossAccountId,1131 spender: CrossAccountId,1132 token: TokenId,1133 ) -> Result<u128, DispatchError> {1134 dispatch_unique_runtime!(collection.allowance(sender, spender, token))1135 }11361137 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1138 <pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1139 .or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1140 .or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1141 }1142 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1143 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1144 }1145 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1146 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1147 }1148 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1149 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1150 }1151 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1152 dispatch_unique_runtime!(collection.last_token_id())1153 }1154 fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1155 Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1156 }1157 fn collection_stats() -> Result<CollectionStats, DispatchError> {1158 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1159 }1160 }11611162 impl sp_api::Core<Block> for Runtime {1163 fn version() -> RuntimeVersion {1164 VERSION1165 }11661167 fn execute_block(block: Block) {1168 Executive::execute_block(block)1169 }11701171 fn initialize_block(header: &<Block as BlockT>::Header) {1172 Executive::initialize_block(header)1173 }1174 }11751176 impl sp_api::Metadata<Block> for Runtime {1177 fn metadata() -> OpaqueMetadata {1178 OpaqueMetadata::new(Runtime::metadata().into())1179 }1180 }11811182 impl sp_block_builder::BlockBuilder<Block> for Runtime {1183 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1184 Executive::apply_extrinsic(extrinsic)1185 }11861187 fn finalize_block() -> <Block as BlockT>::Header {1188 Executive::finalize_block()1189 }11901191 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1192 data.create_extrinsics()1193 }11941195 fn check_inherents(1196 block: Block,1197 data: sp_inherents::InherentData,1198 ) -> sp_inherents::CheckInherentsResult {1199 data.check_extrinsics(&block)1200 }12011202 // fn random_seed() -> <Block as BlockT>::Hash {1203 // RandomnessCollectiveFlip::random_seed().01204 // }1205 }12061207 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1208 fn validate_transaction(1209 source: TransactionSource,1210 tx: <Block as BlockT>::Extrinsic,1211 hash: <Block as BlockT>::Hash,1212 ) -> TransactionValidity {1213 Executive::validate_transaction(source, tx, hash)1214 }1215 }12161217 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1218 fn offchain_worker(header: &<Block as BlockT>::Header) {1219 Executive::offchain_worker(header)1220 }1221 }12221223 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1224 fn chain_id() -> u64 {1225 <Runtime as pallet_evm::Config>::ChainId::get()1226 }12271228 fn account_basic(address: H160) -> EVMAccount {1229 EVM::account_basic(&address)1230 }12311232 fn gas_price() -> U256 {1233 <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1234 }12351236 fn account_code_at(address: H160) -> Vec<u8> {1237 EVM::account_codes(address)1238 }12391240 fn author() -> H160 {1241 <pallet_evm::Pallet<Runtime>>::find_author()1242 }12431244 fn storage_at(address: H160, index: U256) -> H256 {1245 let mut tmp = [0u8; 32];1246 index.to_big_endian(&mut tmp);1247 EVM::account_storages(address, H256::from_slice(&tmp[..]))1248 }12491250 #[allow(clippy::redundant_closure)]1251 fn call(1252 from: H160,1253 to: H160,1254 data: Vec<u8>,1255 value: U256,1256 gas_limit: U256,1257 max_fee_per_gas: Option<U256>,1258 max_priority_fee_per_gas: Option<U256>,1259 nonce: Option<U256>,1260 estimate: bool,1261 access_list: Option<Vec<(H160, Vec<H256>)>>,1262 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1263 let config = if estimate {1264 let mut config = <Runtime as pallet_evm::Config>::config().clone();1265 config.estimate = true;1266 Some(config)1267 } else {1268 None1269 };12701271 <Runtime as pallet_evm::Config>::Runner::call(1272 from,1273 to,1274 data,1275 value,1276 gas_limit.low_u64(),1277 max_fee_per_gas,1278 max_priority_fee_per_gas,1279 nonce,1280 access_list.unwrap_or_default(),1281 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1282 ).map_err(|err| err.into())1283 }12841285 #[allow(clippy::redundant_closure)]1286 fn create(1287 from: H160,1288 data: Vec<u8>,1289 value: U256,1290 gas_limit: U256,1291 max_fee_per_gas: Option<U256>,1292 max_priority_fee_per_gas: Option<U256>,1293 nonce: Option<U256>,1294 estimate: bool,1295 access_list: Option<Vec<(H160, Vec<H256>)>>,1296 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1297 let config = if estimate {1298 let mut config = <Runtime as pallet_evm::Config>::config().clone();1299 config.estimate = true;1300 Some(config)1301 } else {1302 None1303 };13041305 <Runtime as pallet_evm::Config>::Runner::create(1306 from,1307 data,1308 value,1309 gas_limit.low_u64(),1310 max_fee_per_gas,1311 max_priority_fee_per_gas,1312 nonce,1313 access_list.unwrap_or_default(),1314 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1315 ).map_err(|err| err.into())1316 }13171318 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1319 Ethereum::current_transaction_statuses()1320 }13211322 fn current_block() -> Option<pallet_ethereum::Block> {1323 Ethereum::current_block()1324 }13251326 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1327 Ethereum::current_receipts()1328 }13291330 fn current_all() -> (1331 Option<pallet_ethereum::Block>,1332 Option<Vec<pallet_ethereum::Receipt>>,1333 Option<Vec<TransactionStatus>>1334 ) {1335 (1336 Ethereum::current_block(),1337 Ethereum::current_receipts(),1338 Ethereum::current_transaction_statuses()1339 )1340 }13411342 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1343 xts.into_iter().filter_map(|xt| match xt.0.function {1344 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1345 _ => None1346 }).collect()1347 }13481349 fn elasticity() -> Option<Permill> {1350 None1351 }1352 }13531354 impl sp_session::SessionKeys<Block> for Runtime {1355 fn decode_session_keys(1356 encoded: Vec<u8>,1357 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1358 SessionKeys::decode_into_raw_public_keys(&encoded)1359 }13601361 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1362 SessionKeys::generate(seed)1363 }1364 }13651366 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1367 fn slot_duration() -> sp_consensus_aura::SlotDuration {1368 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1369 }13701371 fn authorities() -> Vec<AuraId> {1372 Aura::authorities().to_vec()1373 }1374 }13751376 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1377 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1378 ParachainSystem::collect_collation_info(header)1379 }1380 }13811382 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1383 fn account_nonce(account: AccountId) -> Index {1384 System::account_nonce(account)1385 }1386 }13871388 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1389 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1390 TransactionPayment::query_info(uxt, len)1391 }1392 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1393 TransactionPayment::query_fee_details(uxt, len)1394 }1395 }13961397 /*1398 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1399 for Runtime1400 {1401 fn call(1402 origin: AccountId,1403 dest: AccountId,1404 value: Balance,1405 gas_limit: u64,1406 input_data: Vec<u8>,1407 ) -> pallet_contracts_primitives::ContractExecResult {1408 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1409 }14101411 fn instantiate(1412 origin: AccountId,1413 endowment: Balance,1414 gas_limit: u64,1415 code: pallet_contracts_primitives::Code<Hash>,1416 data: Vec<u8>,1417 salt: Vec<u8>,1418 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1419 {1420 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1421 }14221423 fn get_storage(1424 address: AccountId,1425 key: [u8; 32],1426 ) -> pallet_contracts_primitives::GetStorageResult {1427 Contracts::get_storage(address, key)1428 }14291430 fn rent_projection(1431 address: AccountId,1432 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1433 Contracts::rent_projection(address)1434 }1435 }1436 */14371438 #[cfg(feature = "runtime-benchmarks")]1439 impl frame_benchmarking::Benchmark<Block> for Runtime {1440 fn benchmark_metadata(extra: bool) -> (1441 Vec<frame_benchmarking::BenchmarkList>,1442 Vec<frame_support::traits::StorageInfo>,1443 ) {1444 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1445 use frame_support::traits::StorageInfoTrait;14461447 let mut list = Vec::<BenchmarkList>::new();14481449 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1450 list_benchmark!(list, extra, pallet_unique, Unique);1451 list_benchmark!(list, extra, pallet_inflation, Inflation);1452 list_benchmark!(list, extra, pallet_fungible, Fungible);1453 list_benchmark!(list, extra, pallet_refungible, Refungible);1454 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1455 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);14561457 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();14581459 return (list, storage_info)1460 }14611462 fn dispatch_benchmark(1463 config: frame_benchmarking::BenchmarkConfig1464 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1465 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};14661467 let allowlist: Vec<TrackedStorageKey> = vec![1468 // Block Number1469 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1470 // Total Issuance1471 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1472 // Execution Phase1473 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1474 // Event Count1475 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1476 // System Events1477 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1478 ];14791480 let mut batches = Vec::<BenchmarkBatch>::new();1481 let params = (&config, &allowlist);14821483 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1484 add_benchmark!(params, batches, pallet_unique, Unique);1485 add_benchmark!(params, batches, pallet_inflation, Inflation);1486 add_benchmark!(params, batches, pallet_fungible, Fungible);1487 add_benchmark!(params, batches, pallet_refungible, Refungible);1488 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1489 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);14901491 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1492 Ok(batches)1493 }1494 }1495}14961497struct CheckInherents;14981499impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1500 fn check_inherents(1501 block: &Block,1502 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1503 ) -> sp_inherents::CheckInherentsResult {1504 let relay_chain_slot = relay_state_proof1505 .read_slot()1506 .expect("Could not read the relay chain slot from the proof");15071508 let inherent_data =1509 cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1510 relay_chain_slot,1511 sp_std::time::Duration::from_secs(6),1512 )1513 .create_inherent_data()1514 .expect("Could not create the timestamp inherent data");15151516 inherent_data.check_extrinsics(block)1517 }1518}15191520cumulus_pallet_parachain_system::register_validate_block!(1521 Runtime = Runtime,1522 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1523 CheckInherents = CheckInherents,1524);1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;31// #[cfg(any(feature = "std", test))]32// pub use sp_runtime::BuildStorage;3334use sp_runtime::{35 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,36 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},37 transaction_validity::{TransactionSource, TransactionValidity},38 ApplyExtrinsicResult, RuntimeAppPublic,39};4041use sp_std::prelude::*;4243#[cfg(feature = "std")]44use sp_version::NativeVersion;45use sp_version::RuntimeVersion;46pub use pallet_transaction_payment::{47 Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,48};49// A few exports that help ease life for downstream crates.50pub use pallet_balances::Call as BalancesCall;51pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};52pub use frame_support::{53 construct_runtime, match_type,54 dispatch::DispatchResult,55 PalletId, parameter_types, StorageValue, ConsensusEngineId,56 traits::{57 tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,58 Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,59 OnUnbalanced, Randomness, FindAuthor,60 },61 weights::{62 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},63 DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,64 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,65 },66};67use up_data_structs::*;68// use pallet_contracts::weights::WeightInfo;69// #[cfg(any(feature = "std", test))]70use frame_system::{71 self as frame_system, EnsureRoot, EnsureSigned,72 limits::{BlockWeights, BlockLength},73};74use sp_arithmetic::{75 traits::{BaseArithmetic, Unsigned},76};77use smallvec::smallvec;78use codec::{Encode, Decode};79use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};80use fp_rpc::TransactionStatus;81use sp_runtime::{82 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},83 transaction_validity::TransactionValidityError,84 SaturatedConversion,85};8687// pub use pallet_timestamp::Call as TimestampCall;88pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;8990// Polkadot imports91use pallet_xcm::XcmPassthrough;92use polkadot_parachain::primitives::Sibling;93use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};94use xcm_builder::{95 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,96 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,97 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,98 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,99 ParentIsPreset,100};101use xcm_executor::{Config, XcmExecutor, Assets};102use sp_std::{marker::PhantomData};103104use xcm::latest::{105 // Xcm,106 AssetId::{Concrete},107 Fungibility::Fungible as XcmFungible,108 MultiAsset,109 Error as XcmError,110};111use xcm_executor::traits::{MatchesFungible, WeightTrader};112//use xcm_executor::traits::MatchesFungible;113use sp_runtime::traits::CheckedConversion;114115use unique_runtime_common::{types::*, constants::*};116117pub const RUNTIME_NAME: &str = "Quartz";118119pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;120121/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know122/// the specifics of the runtime. They can then be made to be agnostic over specific formats123/// of data like extrinsics, allowing for them to continue syncing the network through upgrades124/// to even the core data structures.125pub mod opaque {126 use sp_std::prelude::*;127 use sp_runtime::impl_opaque_keys;128 use super::Aura;129130 pub use unique_runtime_common::types::*;131 pub use super::CrossAccountId;132133 impl_opaque_keys! {134 pub struct SessionKeys {135 pub aura: Aura,136 }137 }138}139140/// This runtime version.141pub const VERSION: RuntimeVersion = RuntimeVersion {142 spec_name: create_runtime_str!(RUNTIME_NAME),143 impl_name: create_runtime_str!(RUNTIME_NAME),144 authoring_version: 1,145 spec_version: 917004,146 impl_version: 0,147 apis: RUNTIME_API_VERSIONS,148 transaction_version: 1,149 state_version: 0,150};151152#[derive(codec::Encode, codec::Decode)]153pub enum XCMPMessage<XAccountId, XBalance> {154 /// Transfer tokens to the given account from the Parachain account.155 TransferToken(XAccountId, XBalance),156}157158/// The version information used to identify this runtime when compiled natively.159#[cfg(feature = "std")]160pub fn native_version() -> NativeVersion {161 NativeVersion {162 runtime_version: VERSION,163 can_author_with: Default::default(),164 }165}166167type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;168169pub struct DealWithFees;170impl OnUnbalanced<NegativeImbalance> for DealWithFees {171 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {172 if let Some(fees) = fees_then_tips.next() {173 // for fees, 100% to treasury174 let mut split = fees.ration(100, 0);175 if let Some(tips) = fees_then_tips.next() {176 // for tips, if any, 100% to treasury177 tips.ration_merge_into(100, 0, &mut split);178 }179 Treasury::on_unbalanced(split.0);180 // Author::on_unbalanced(split.1);181 }182 }183}184185parameter_types! {186 pub const BlockHashCount: BlockNumber = 2400;187 pub RuntimeBlockLength: BlockLength =188 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);189 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);190 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;191 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()192 .base_block(BlockExecutionWeight::get())193 .for_class(DispatchClass::all(), |weights| {194 weights.base_extrinsic = ExtrinsicBaseWeight::get();195 })196 .for_class(DispatchClass::Normal, |weights| {197 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);198 })199 .for_class(DispatchClass::Operational, |weights| {200 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);201 // Operational transactions have some extra reserved space, so that they202 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.203 weights.reserved = Some(204 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT205 );206 })207 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)208 .build_or_panic();209 pub const Version: RuntimeVersion = VERSION;210 /*211 255 - Quartz212 42 - Opal213 */214 pub const SS58Prefix: u8 = 255;215}216217/*2188880 - Unique2198881 - Quartz2208882 - Opal221*/222parameter_types! {223 pub const ChainId: u64 = 8881;224}225226pub struct FixedFee;227impl FeeCalculator for FixedFee {228 fn min_gas_price() -> U256 {229 // Targeting 0.15 UNQ per transfer230 1_018_751_825_264u64.into()231 }232}233234// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case235// (contract, which only writes a lot of data),236// approximating on top of our real store write weight237parameter_types! {238 pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;239 pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;240 pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();241}242243/// Limiting EVM execution to 50% of block for substrate users and management tasks244/// EVM transaction consumes more weight than substrate's, so we can't rely on them being245/// scheduled fairly246const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);247parameter_types! {248 pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());249}250251pub enum FixedGasWeightMapping {}252impl GasWeightMapping for FixedGasWeightMapping {253 fn gas_to_weight(gas: u64) -> Weight {254 gas.saturating_mul(WeightPerGas::get())255 }256 fn weight_to_gas(weight: Weight) -> u64 {257 weight / WeightPerGas::get()258 }259}260261impl pallet_evm::Config for Runtime {262 type BlockGasLimit = BlockGasLimit;263 type FeeCalculator = FixedFee;264 type GasWeightMapping = FixedGasWeightMapping;265 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;266 type CallOrigin = EnsureAddressTruncated;267 type WithdrawOrigin = EnsureAddressTruncated;268 type AddressMapping = HashedAddressMapping<Self::Hashing>;269 type PrecompilesType = ();270 type PrecompilesValue = ();271 type Currency = Balances;272 type Event = Event;273 type OnMethodCall = (274 pallet_evm_migration::OnMethodCall<Self>,275 pallet_unique::UniqueErcSupport<Self>,276 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,277 );278 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;279 type ChainId = ChainId;280 type Runner = pallet_evm::runner::stack::Runner<Self>;281 type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;282 type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;283 type FindAuthor = EthereumFindAuthor<Aura>;284}285286impl pallet_evm_migration::Config for Runtime {287 type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;288}289290pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);291impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {292 fn find_author<'a, I>(digests: I) -> Option<H160>293 where294 I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,295 {296 if let Some(author_index) = F::find_author(digests) {297 let authority_id = Aura::authorities()[author_index as usize].clone();298 return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));299 }300 None301 }302}303304impl pallet_ethereum::Config for Runtime {305 type Event = Event;306 type StateRoot = pallet_ethereum::IntermediateStateRoot;307}308309impl pallet_randomness_collective_flip::Config for Runtime {}310311impl frame_system::Config for Runtime {312 /// The data to be stored in an account.313 type AccountData = pallet_balances::AccountData<Balance>;314 /// The identifier used to distinguish between accounts.315 type AccountId = AccountId;316 /// The basic call filter to use in dispatchable.317 type BaseCallFilter = Everything;318 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).319 type BlockHashCount = BlockHashCount;320 /// The maximum length of a block (in bytes).321 type BlockLength = RuntimeBlockLength;322 /// The index type for blocks.323 type BlockNumber = BlockNumber;324 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.325 type BlockWeights = RuntimeBlockWeights;326 /// The aggregated dispatch type that is available for extrinsics.327 type Call = Call;328 /// The weight of database operations that the runtime can invoke.329 type DbWeight = RocksDbWeight;330 /// The ubiquitous event type.331 type Event = Event;332 /// The type for hashing blocks and tries.333 type Hash = Hash;334 /// The hashing algorithm used.335 type Hashing = BlakeTwo256;336 /// The header type.337 type Header = generic::Header<BlockNumber, BlakeTwo256>;338 /// The index type for storing how many extrinsics an account has signed.339 type Index = Index;340 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.341 type Lookup = AccountIdLookup<AccountId, ()>;342 /// What to do if an account is fully reaped from the system.343 type OnKilledAccount = ();344 /// What to do if a new account is created.345 type OnNewAccount = ();346 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;347 /// The ubiquitous origin type.348 type Origin = Origin;349 /// This type is being generated by `construct_runtime!`.350 type PalletInfo = PalletInfo;351 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.352 type SS58Prefix = SS58Prefix;353 /// Weight information for the extrinsics of this pallet.354 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;355 /// Version of the runtime.356 type Version = Version;357 type MaxConsumers = ConstU32<16>;358}359360parameter_types! {361 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;362}363364impl pallet_timestamp::Config for Runtime {365 /// A timestamp: milliseconds since the unix epoch.366 type Moment = u64;367 type OnTimestampSet = ();368 type MinimumPeriod = MinimumPeriod;369 type WeightInfo = ();370}371372parameter_types! {373 // pub const ExistentialDeposit: u128 = 500;374 pub const ExistentialDeposit: u128 = 0;375 pub const MaxLocks: u32 = 50;376}377378impl pallet_balances::Config for Runtime {379 type MaxLocks = MaxLocks;380 type MaxReserves = ();381 type ReserveIdentifier = [u8; 8];382 /// The type for recording an account's balance.383 type Balance = Balance;384 /// The ubiquitous event type.385 type Event = Event;386 type DustRemoval = Treasury;387 type ExistentialDeposit = ExistentialDeposit;388 type AccountStore = System;389 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;390}391392pub const MICROUNIQUE: Balance = 1_000_000_000_000;393pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;394pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;395pub const UNIQUE: Balance = 100 * CENTIUNIQUE;396397pub const fn deposit(items: u32, bytes: u32) -> Balance {398 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE399}400401/*402parameter_types! {403 pub TombstoneDeposit: Balance = deposit(404 1,405 sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,406 );407 pub DepositPerContract: Balance = TombstoneDeposit::get();408 pub const DepositPerStorageByte: Balance = deposit(0, 1);409 pub const DepositPerStorageItem: Balance = deposit(1, 0);410 pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);411 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;412 pub const SignedClaimHandicap: u32 = 2;413 pub const MaxDepth: u32 = 32;414 pub const MaxValueSize: u32 = 16 * 1024;415 pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb416 // The lazy deletion runs inside on_initialize.417 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *418 RuntimeBlockWeights::get().max_block;419 // The weight needed for decoding the queue should be less or equal than a fifth420 // of the overall weight dedicated to the lazy deletion.421 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (422 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -423 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)424 )) / 5) as u32;425 pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();426}427428impl pallet_contracts::Config for Runtime {429 type Time = Timestamp;430 type Randomness = RandomnessCollectiveFlip;431 type Currency = Balances;432 type Event = Event;433 type RentPayment = ();434 type SignedClaimHandicap = SignedClaimHandicap;435 type TombstoneDeposit = TombstoneDeposit;436 type DepositPerContract = DepositPerContract;437 type DepositPerStorageByte = DepositPerStorageByte;438 type DepositPerStorageItem = DepositPerStorageItem;439 type RentFraction = RentFraction;440 type SurchargeReward = SurchargeReward;441 type WeightPrice = pallet_transaction_payment::Pallet<Self>;442 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;443 type ChainExtension = NFTExtension;444 type DeletionQueueDepth = DeletionQueueDepth;445 type DeletionWeightLimit = DeletionWeightLimit;446 type Schedule = Schedule;447 type CallStack = [pallet_contracts::Frame<Self>; 31];448}449*/450451parameter_types! {452 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer453 /// This value increases the priority of `Operational` transactions by adding454 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.455 pub const OperationalFeeMultiplier: u8 = 5;456}457458/// Linear implementor of `WeightToFeePolynomial`459pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);460461impl<T> WeightToFeePolynomial for LinearFee<T>462where463 T: BaseArithmetic + From<u32> + Copy + Unsigned,464{465 type Balance = T;466467 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {468 smallvec!(WeightToFeeCoefficient {469 // Targeting 0.1 Unique per NFT transfer470 coeff_integer: 142_688_000u32.into(),471 coeff_frac: Perbill::zero(),472 negative: false,473 degree: 1,474 })475 }476}477478impl pallet_transaction_payment::Config for Runtime {479 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;480 type TransactionByteFee = TransactionByteFee;481 type OperationalFeeMultiplier = OperationalFeeMultiplier;482 type WeightToFee = LinearFee<Balance>;483 type FeeMultiplierUpdate = ();484}485486parameter_types! {487 pub const ProposalBond: Permill = Permill::from_percent(5);488 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;489 pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;490 pub const SpendPeriod: BlockNumber = 5 * MINUTES;491 pub const Burn: Permill = Permill::from_percent(0);492 pub const TipCountdown: BlockNumber = 1 * DAYS;493 pub const TipFindersFee: Percent = Percent::from_percent(20);494 pub const TipReportDepositBase: Balance = 1 * UNIQUE;495 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;496 pub const BountyDepositBase: Balance = 1 * UNIQUE;497 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;498 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");499 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;500 pub const MaximumReasonLength: u32 = 16384;501 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);502 pub const BountyValueMinimum: Balance = 5 * UNIQUE;503 pub const MaxApprovals: u32 = 100;504}505506impl pallet_treasury::Config for Runtime {507 type PalletId = TreasuryModuleId;508 type Currency = Balances;509 type ApproveOrigin = EnsureRoot<AccountId>;510 type RejectOrigin = EnsureRoot<AccountId>;511 type Event = Event;512 type OnSlash = ();513 type ProposalBond = ProposalBond;514 type ProposalBondMinimum = ProposalBondMinimum;515 type ProposalBondMaximum = ProposalBondMaximum;516 type SpendPeriod = SpendPeriod;517 type Burn = Burn;518 type BurnDestination = ();519 type SpendFunds = ();520 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;521 type MaxApprovals = MaxApprovals;522}523524impl pallet_sudo::Config for Runtime {525 type Event = Event;526 type Call = Call;527}528529pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);530531impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider532 for RelayChainBlockNumberProvider<T>533{534 type BlockNumber = BlockNumber;535536 fn current_block_number() -> Self::BlockNumber {537 cumulus_pallet_parachain_system::Pallet::<T>::validation_data()538 .map(|d| d.relay_parent_number)539 .unwrap_or_default()540 }541}542543parameter_types! {544 pub const MinVestedTransfer: Balance = 10 * UNIQUE;545 pub const MaxVestingSchedules: u32 = 28;546}547548impl orml_vesting::Config for Runtime {549 type Event = Event;550 type Currency = pallet_balances::Pallet<Runtime>;551 type MinVestedTransfer = MinVestedTransfer;552 type VestedTransferOrigin = EnsureSigned<AccountId>;553 type WeightInfo = ();554 type MaxVestingSchedules = MaxVestingSchedules;555 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;556}557558parameter_types! {559 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;560 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;561}562563impl cumulus_pallet_parachain_system::Config for Runtime {564 type Event = Event;565 type SelfParaId = parachain_info::Pallet<Self>;566 type OnSystemEvent = ();567 // type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<568 // MaxDownwardMessageWeight,569 // XcmExecutor<XcmConfig>,570 // Call,571 // >;572 type OutboundXcmpMessageSource = XcmpQueue;573 type DmpMessageHandler = DmpQueue;574 type ReservedDmpWeight = ReservedDmpWeight;575 type ReservedXcmpWeight = ReservedXcmpWeight;576 type XcmpMessageHandler = XcmpQueue;577}578579impl parachain_info::Config for Runtime {}580581impl cumulus_pallet_aura_ext::Config for Runtime {}582583parameter_types! {584 pub const RelayLocation: MultiLocation = MultiLocation::parent();585 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;586 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();587 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();588}589590/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used591/// when determining ownership of accounts for asset transacting and when attempting to use XCM592/// `Transact` in order to determine the dispatch Origin.593pub type LocationToAccountId = (594 // The parent (Relay-chain) origin converts to the default `AccountId`.595 ParentIsPreset<AccountId>,596 // Sibling parachain origins convert to AccountId via the `ParaId::into`.597 SiblingParachainConvertsVia<Sibling, AccountId>,598 // Straight up local `AccountId32` origins just alias directly to `AccountId`.599 AccountId32Aliases<RelayNetwork, AccountId>,600);601602pub struct OnlySelfCurrency;603impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {604 fn matches_fungible(a: &MultiAsset) -> Option<B> {605 match (&a.id, &a.fun) {606 (Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),607 _ => None,608 }609 }610}611612/// Means for transacting assets on this chain.613pub type LocalAssetTransactor = CurrencyAdapter<614 // Use this currency:615 Balances,616 // Use this currency when it is a fungible asset matching the given location or name:617 OnlySelfCurrency,618 // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:619 LocationToAccountId,620 // Our chain's account ID type (we can't get away without mentioning it explicitly):621 AccountId,622 // We don't track any teleports.623 (),624>;625626/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,627/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can628/// biases the kind of local `Origin` it will become.629pub type XcmOriginToTransactDispatchOrigin = (630 // Sovereign account converter; this attempts to derive an `AccountId` from the origin location631 // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for632 // foreign chains who want to have a local sovereign account on this chain which they control.633 SovereignSignedViaLocation<LocationToAccountId, Origin>,634 // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when635 // recognised.636 RelayChainAsNative<RelayOrigin, Origin>,637 // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when638 // recognised.639 SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,640 // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a641 // transaction from the Root origin.642 ParentAsSuperuser<Origin>,643 // Native signed account converter; this just converts an `AccountId32` origin into a normal644 // `Origin::Signed` origin of the same 32-byte value.645 SignedAccountId32AsNative<RelayNetwork, Origin>,646 // Xcm origins can be represented natively under the Xcm pallet's Xcm origin.647 XcmPassthrough<Origin>,648);649650parameter_types! {651 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.652 pub UnitWeightCost: Weight = 1_000_000;653 // 1200 UNIQUEs buy 1 second of weight.654 pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);655 pub const MaxInstructions: u32 = 100;656 pub const MaxAuthorities: u32 = 100_000;657}658659match_type! {660 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {661 MultiLocation { parents: 1, interior: Here } |662 MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }663 };664}665666pub type Barrier = (667 TakeWeightCredit,668 AllowTopLevelPaidExecutionFrom<Everything>,669 AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,670 // ^^^ Parent & its unit plurality gets free execution671);672673pub struct UsingOnlySelfCurrencyComponents<674 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,675 AssetId: Get<MultiLocation>,676 AccountId,677 Currency: CurrencyT<AccountId>,678 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,679>(680 Weight,681 Currency::Balance,682 PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,683);684impl<685 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,686 AssetId: Get<MultiLocation>,687 AccountId,688 Currency: CurrencyT<AccountId>,689 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,690 > WeightTrader691 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>692{693 fn new() -> Self {694 Self(0, Zero::zero(), PhantomData)695 }696697 fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {698 let amount = WeightToFee::calc(&weight);699 let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;700701 // location to this parachain through relay chain702 let option1: xcm::v1::AssetId = Concrete(MultiLocation {703 parents: 1,704 interior: X1(Parachain(ParachainInfo::parachain_id().into())),705 });706 // direct location707 let option2: xcm::v1::AssetId = Concrete(MultiLocation {708 parents: 0,709 interior: Here,710 });711712 let required = if payment.fungible.contains_key(&option1) {713 (option1, u128_amount).into()714 } else if payment.fungible.contains_key(&option2) {715 (option2, u128_amount).into()716 } else {717 (Concrete(MultiLocation::default()), u128_amount).into()718 };719720 let unused = payment721 .checked_sub(required)722 .map_err(|_| XcmError::TooExpensive)?;723 self.0 = self.0.saturating_add(weight);724 self.1 = self.1.saturating_add(amount);725 Ok(unused)726 }727728 fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {729 let weight = weight.min(self.0);730 let amount = WeightToFee::calc(&weight);731 self.0 -= weight;732 self.1 = self.1.saturating_sub(amount);733 let amount: u128 = amount.saturated_into();734 if amount > 0 {735 Some((AssetId::get(), amount).into())736 } else {737 None738 }739 }740}741impl<742 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,743 AssetId: Get<MultiLocation>,744 AccountId,745 Currency: CurrencyT<AccountId>,746 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,747 > Drop748 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>749{750 fn drop(&mut self) {751 OnUnbalanced::on_unbalanced(Currency::issue(self.1));752 }753}754755pub struct XcmConfig;756impl Config for XcmConfig {757 type Call = Call;758 type XcmSender = XcmRouter;759 // How to withdraw and deposit an asset.760 type AssetTransactor = LocalAssetTransactor;761 type OriginConverter = XcmOriginToTransactDispatchOrigin;762 type IsReserve = NativeAsset;763 type IsTeleporter = (); // Teleportation is disabled764 type LocationInverter = LocationInverter<Ancestry>;765 type Barrier = Barrier;766 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;767 type Trader = UsingOnlySelfCurrencyComponents<768 IdentityFee<Balance>,769 RelayLocation,770 AccountId,771 Balances,772 (),773 >;774 type ResponseHandler = (); // Don't handle responses for now.775 type SubscriptionService = PolkadotXcm;776777 type AssetTrap = PolkadotXcm;778 type AssetClaims = PolkadotXcm;779}780781// parameter_types! {782// pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;783// }784785/// No local origins on this chain are allowed to dispatch XCM sends/executions.786pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);787788/// The means for routing XCM messages which are not for local execution into the right message789/// queues.790pub type XcmRouter = (791 // Two routers - use UMP to communicate with the relay chain:792 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,793 // ..and XCMP to communicate with the sibling chains.794 XcmpQueue,795);796797impl pallet_evm_coder_substrate::Config for Runtime {798 type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;799 type GasWeightMapping = FixedGasWeightMapping;800}801802impl pallet_xcm::Config for Runtime {803 type Event = Event;804 type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;805 type XcmRouter = XcmRouter;806 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;807 type XcmExecuteFilter = Everything;808 type XcmExecutor = XcmExecutor<XcmConfig>;809 type XcmTeleportFilter = Everything;810 type XcmReserveTransferFilter = Everything;811 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;812 type LocationInverter = LocationInverter<Ancestry>;813 type Origin = Origin;814 type Call = Call;815 const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;816 type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;817}818819impl cumulus_pallet_xcm::Config for Runtime {820 type Event = Event;821 type XcmExecutor = XcmExecutor<XcmConfig>;822}823824impl cumulus_pallet_xcmp_queue::Config for Runtime {825 type Event = Event;826 type XcmExecutor = XcmExecutor<XcmConfig>;827 type ChannelInfo = ParachainSystem;828 type VersionWrapper = ();829 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;830 type ControllerOrigin = EnsureRoot<AccountId>;831 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;832}833834impl cumulus_pallet_dmp_queue::Config for Runtime {835 type Event = Event;836 type XcmExecutor = XcmExecutor<XcmConfig>;837 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;838}839840impl pallet_aura::Config for Runtime {841 type AuthorityId = AuraId;842 type DisabledValidators = ();843 type MaxAuthorities = MaxAuthorities;844}845846parameter_types! {847 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();848 pub const CollectionCreationPrice: Balance = 2 * UNIQUE;849}850851impl pallet_common::Config for Runtime {852 type Event = Event;853 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;854 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;855 type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;856857 type Currency = Balances;858 type CollectionCreationPrice = CollectionCreationPrice;859 type TreasuryAccountId = TreasuryAccountId;860}861862impl pallet_fungible::Config for Runtime {863 type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;864}865impl pallet_refungible::Config for Runtime {866 type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;867}868impl pallet_nonfungible::Config for Runtime {869 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;870}871872impl pallet_unique::Config for Runtime {873 type Event = Event;874 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;875}876877parameter_types! {878 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied879}880881/// Used for the pallet inflation882impl pallet_inflation::Config for Runtime {883 type Currency = Balances;884 type TreasuryAccountId = TreasuryAccountId;885 type InflationBlockInterval = InflationBlockInterval;886 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;887}888889// parameter_types! {890// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *891// RuntimeBlockWeights::get().max_block;892// pub const MaxScheduledPerBlock: u32 = 50;893// }894895type EvmSponsorshipHandler = (896 pallet_unique::UniqueEthSponsorshipHandler<Runtime>,897 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,898);899type SponsorshipHandler = (900 pallet_unique::UniqueSponsorshipHandler<Runtime>,901 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,902 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,903);904905// impl pallet_unq_scheduler::Config for Runtime {906// type Event = Event;907// type Origin = Origin;908// type PalletsOrigin = OriginCaller;909// type Call = Call;910// type MaximumWeight = MaximumSchedulerWeight;911// type ScheduleOrigin = EnsureSigned<AccountId>;912// type MaxScheduledPerBlock = MaxScheduledPerBlock;913// type SponsorshipHandler = SponsorshipHandler;914// type WeightInfo = ();915// }916917impl pallet_evm_transaction_payment::Config for Runtime {918 type EvmSponsorshipHandler = EvmSponsorshipHandler;919 type Currency = Balances;920 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;921 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;922}923924impl pallet_charge_transaction::Config for Runtime {925 type SponsorshipHandler = SponsorshipHandler;926}927928// impl pallet_contract_helpers::Config for Runtime {929// type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;930// }931932parameter_types! {933 // 0x842899ECF380553E8a4de75bF534cdf6fBF64049934 pub const HelpersContractAddress: H160 = H160([935 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,936 ]);937}938939impl pallet_evm_contract_helpers::Config for Runtime {940 type ContractAddress = HelpersContractAddress;941 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;942}943944construct_runtime!(945 pub enum Runtime where946 Block = Block,947 NodeBlock = opaque::Block,948 UncheckedExtrinsic = UncheckedExtrinsic949 {950 ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,951 ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,952953 Aura: pallet_aura::{Pallet, Config<T>} = 22,954 AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,955956 Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,957 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,958 Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,959 TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,960 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,961 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,962 System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,963 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,964 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,965 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,966967 // XCM helpers.968 XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,969 PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,970 CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,971 DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,972973 // Unique Pallets974 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,975 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,976 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,977 // free = 63978 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,979 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,980 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,981 Fungible: pallet_fungible::{Pallet, Storage} = 67,982 Refungible: pallet_refungible::{Pallet, Storage} = 68,983 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,984985 // Frontier986 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,987 Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,988989 EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,990 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,991 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,992 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,993 }994);995996pub struct TransactionConverter;997998impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {999 fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {1000 UncheckedExtrinsic::new_unsigned(1001 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1002 )1003 }1004}10051006impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1007 fn convert_transaction(1008 &self,1009 transaction: pallet_ethereum::Transaction,1010 ) -> opaque::UncheckedExtrinsic {1011 let extrinsic = UncheckedExtrinsic::new_unsigned(1012 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1013 );1014 let encoded = extrinsic.encode();1015 opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1016 .expect("Encoded extrinsic is always valid")1017 }1018}10191020/// The address format for describing accounts.1021pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1022/// Block header type as expected by this runtime.1023pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1024/// Block type as expected by this runtime.1025pub type Block = generic::Block<Header, UncheckedExtrinsic>;1026/// A Block signed with a Justification1027pub type SignedBlock = generic::SignedBlock<Block>;1028/// BlockId type as expected by this runtime.1029pub type BlockId = generic::BlockId<Block>;1030/// The SignedExtension to the basic transaction logic.1031pub type SignedExtra = (1032 frame_system::CheckSpecVersion<Runtime>,1033 // system::CheckTxVersion<Runtime>,1034 frame_system::CheckGenesis<Runtime>,1035 frame_system::CheckEra<Runtime>,1036 frame_system::CheckNonce<Runtime>,1037 frame_system::CheckWeight<Runtime>,1038 pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1039 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,1040);1041/// Unchecked extrinsic type as expected by this runtime.1042pub type UncheckedExtrinsic =1043 fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1044/// Extrinsic type that has already been checked.1045pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1046/// Executive: handles dispatch to the various modules.1047pub type Executive = frame_executive::Executive<1048 Runtime,1049 Block,1050 frame_system::ChainContext<Runtime>,1051 Runtime,1052 AllPalletsReversedWithSystemFirst,1053>;10541055impl_opaque_keys! {1056 pub struct SessionKeys {1057 pub aura: Aura,1058 }1059}10601061impl fp_self_contained::SelfContainedCall for Call {1062 type SignedInfo = H160;10631064 fn is_self_contained(&self) -> bool {1065 match self {1066 Call::Ethereum(call) => call.is_self_contained(),1067 _ => false,1068 }1069 }10701071 fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1072 match self {1073 Call::Ethereum(call) => call.check_self_contained(),1074 _ => None,1075 }1076 }10771078 fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1079 match self {1080 Call::Ethereum(call) => call.validate_self_contained(info),1081 _ => None,1082 }1083 }10841085 fn pre_dispatch_self_contained(1086 &self,1087 info: &Self::SignedInfo,1088 ) -> Option<Result<(), TransactionValidityError>> {1089 match self {1090 Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1091 _ => None,1092 }1093 }10941095 fn apply_self_contained(1096 self,1097 info: Self::SignedInfo,1098 ) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1099 match self {1100 call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1101 Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1102 )),1103 _ => None,1104 }1105 }1106}11071108macro_rules! dispatch_unique_runtime {1109 ($collection:ident.$method:ident($($name:ident),*)) => {{1110 use pallet_unique::dispatch::Dispatched;11111112 let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1113 let dispatch = collection.as_dyn();11141115 Ok(dispatch.$method($($name),*))1116 }};1117}1118impl_runtime_apis! {1119 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1120 for Runtime1121 {1122 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1123 dispatch_unique_runtime!(collection.account_tokens(account))1124 }1125 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1126 dispatch_unique_runtime!(collection.token_exists(token))1127 }11281129 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1130 dispatch_unique_runtime!(collection.token_owner(token))1131 }1132 fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1133 dispatch_unique_runtime!(collection.const_metadata(token))1134 }1135 fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1136 dispatch_unique_runtime!(collection.variable_metadata(token))1137 }11381139 fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1140 dispatch_unique_runtime!(collection.collection_tokens())1141 }1142 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1143 dispatch_unique_runtime!(collection.account_balance(account))1144 }1145 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1146 dispatch_unique_runtime!(collection.balance(account, token))1147 }1148 fn allowance(1149 collection: CollectionId,1150 sender: CrossAccountId,1151 spender: CrossAccountId,1152 token: TokenId,1153 ) -> Result<u128, DispatchError> {1154 dispatch_unique_runtime!(collection.allowance(sender, spender, token))1155 }11561157 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1158 <pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1159 .or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1160 .or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1161 }1162 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1163 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1164 }1165 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1166 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1167 }1168 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1169 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1170 }1171 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1172 dispatch_unique_runtime!(collection.last_token_id())1173 }1174 fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1175 Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1176 }1177 fn collection_stats() -> Result<CollectionStats, DispatchError> {1178 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1179 }1180 }11811182 impl sp_api::Core<Block> for Runtime {1183 fn version() -> RuntimeVersion {1184 VERSION1185 }11861187 fn execute_block(block: Block) {1188 Executive::execute_block(block)1189 }11901191 fn initialize_block(header: &<Block as BlockT>::Header) {1192 Executive::initialize_block(header)1193 }1194 }11951196 impl sp_api::Metadata<Block> for Runtime {1197 fn metadata() -> OpaqueMetadata {1198 OpaqueMetadata::new(Runtime::metadata().into())1199 }1200 }12011202 impl sp_block_builder::BlockBuilder<Block> for Runtime {1203 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1204 Executive::apply_extrinsic(extrinsic)1205 }12061207 fn finalize_block() -> <Block as BlockT>::Header {1208 Executive::finalize_block()1209 }12101211 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1212 data.create_extrinsics()1213 }12141215 fn check_inherents(1216 block: Block,1217 data: sp_inherents::InherentData,1218 ) -> sp_inherents::CheckInherentsResult {1219 data.check_extrinsics(&block)1220 }12211222 // fn random_seed() -> <Block as BlockT>::Hash {1223 // RandomnessCollectiveFlip::random_seed().01224 // }1225 }12261227 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1228 fn validate_transaction(1229 source: TransactionSource,1230 tx: <Block as BlockT>::Extrinsic,1231 hash: <Block as BlockT>::Hash,1232 ) -> TransactionValidity {1233 Executive::validate_transaction(source, tx, hash)1234 }1235 }12361237 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1238 fn offchain_worker(header: &<Block as BlockT>::Header) {1239 Executive::offchain_worker(header)1240 }1241 }12421243 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1244 fn chain_id() -> u64 {1245 <Runtime as pallet_evm::Config>::ChainId::get()1246 }12471248 fn account_basic(address: H160) -> EVMAccount {1249 EVM::account_basic(&address)1250 }12511252 fn gas_price() -> U256 {1253 <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1254 }12551256 fn account_code_at(address: H160) -> Vec<u8> {1257 EVM::account_codes(address)1258 }12591260 fn author() -> H160 {1261 <pallet_evm::Pallet<Runtime>>::find_author()1262 }12631264 fn storage_at(address: H160, index: U256) -> H256 {1265 let mut tmp = [0u8; 32];1266 index.to_big_endian(&mut tmp);1267 EVM::account_storages(address, H256::from_slice(&tmp[..]))1268 }12691270 #[allow(clippy::redundant_closure)]1271 fn call(1272 from: H160,1273 to: H160,1274 data: Vec<u8>,1275 value: U256,1276 gas_limit: U256,1277 max_fee_per_gas: Option<U256>,1278 max_priority_fee_per_gas: Option<U256>,1279 nonce: Option<U256>,1280 estimate: bool,1281 access_list: Option<Vec<(H160, Vec<H256>)>>,1282 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1283 let config = if estimate {1284 let mut config = <Runtime as pallet_evm::Config>::config().clone();1285 config.estimate = true;1286 Some(config)1287 } else {1288 None1289 };12901291 <Runtime as pallet_evm::Config>::Runner::call(1292 from,1293 to,1294 data,1295 value,1296 gas_limit.low_u64(),1297 max_fee_per_gas,1298 max_priority_fee_per_gas,1299 nonce,1300 access_list.unwrap_or_default(),1301 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1302 ).map_err(|err| err.into())1303 }13041305 #[allow(clippy::redundant_closure)]1306 fn create(1307 from: H160,1308 data: Vec<u8>,1309 value: U256,1310 gas_limit: U256,1311 max_fee_per_gas: Option<U256>,1312 max_priority_fee_per_gas: Option<U256>,1313 nonce: Option<U256>,1314 estimate: bool,1315 access_list: Option<Vec<(H160, Vec<H256>)>>,1316 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1317 let config = if estimate {1318 let mut config = <Runtime as pallet_evm::Config>::config().clone();1319 config.estimate = true;1320 Some(config)1321 } else {1322 None1323 };13241325 <Runtime as pallet_evm::Config>::Runner::create(1326 from,1327 data,1328 value,1329 gas_limit.low_u64(),1330 max_fee_per_gas,1331 max_priority_fee_per_gas,1332 nonce,1333 access_list.unwrap_or_default(),1334 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1335 ).map_err(|err| err.into())1336 }13371338 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1339 Ethereum::current_transaction_statuses()1340 }13411342 fn current_block() -> Option<pallet_ethereum::Block> {1343 Ethereum::current_block()1344 }13451346 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1347 Ethereum::current_receipts()1348 }13491350 fn current_all() -> (1351 Option<pallet_ethereum::Block>,1352 Option<Vec<pallet_ethereum::Receipt>>,1353 Option<Vec<TransactionStatus>>1354 ) {1355 (1356 Ethereum::current_block(),1357 Ethereum::current_receipts(),1358 Ethereum::current_transaction_statuses()1359 )1360 }13611362 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1363 xts.into_iter().filter_map(|xt| match xt.0.function {1364 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1365 _ => None1366 }).collect()1367 }13681369 fn elasticity() -> Option<Permill> {1370 None1371 }1372 }13731374 impl sp_session::SessionKeys<Block> for Runtime {1375 fn decode_session_keys(1376 encoded: Vec<u8>,1377 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1378 SessionKeys::decode_into_raw_public_keys(&encoded)1379 }13801381 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1382 SessionKeys::generate(seed)1383 }1384 }13851386 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1387 fn slot_duration() -> sp_consensus_aura::SlotDuration {1388 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1389 }13901391 fn authorities() -> Vec<AuraId> {1392 Aura::authorities().to_vec()1393 }1394 }13951396 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1397 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1398 ParachainSystem::collect_collation_info(header)1399 }1400 }14011402 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1403 fn account_nonce(account: AccountId) -> Index {1404 System::account_nonce(account)1405 }1406 }14071408 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1409 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1410 TransactionPayment::query_info(uxt, len)1411 }1412 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1413 TransactionPayment::query_fee_details(uxt, len)1414 }1415 }14161417 /*1418 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1419 for Runtime1420 {1421 fn call(1422 origin: AccountId,1423 dest: AccountId,1424 value: Balance,1425 gas_limit: u64,1426 input_data: Vec<u8>,1427 ) -> pallet_contracts_primitives::ContractExecResult {1428 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1429 }14301431 fn instantiate(1432 origin: AccountId,1433 endowment: Balance,1434 gas_limit: u64,1435 code: pallet_contracts_primitives::Code<Hash>,1436 data: Vec<u8>,1437 salt: Vec<u8>,1438 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1439 {1440 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1441 }14421443 fn get_storage(1444 address: AccountId,1445 key: [u8; 32],1446 ) -> pallet_contracts_primitives::GetStorageResult {1447 Contracts::get_storage(address, key)1448 }14491450 fn rent_projection(1451 address: AccountId,1452 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1453 Contracts::rent_projection(address)1454 }1455 }1456 */14571458 #[cfg(feature = "runtime-benchmarks")]1459 impl frame_benchmarking::Benchmark<Block> for Runtime {1460 fn benchmark_metadata(extra: bool) -> (1461 Vec<frame_benchmarking::BenchmarkList>,1462 Vec<frame_support::traits::StorageInfo>,1463 ) {1464 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1465 use frame_support::traits::StorageInfoTrait;14661467 let mut list = Vec::<BenchmarkList>::new();14681469 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1470 list_benchmark!(list, extra, pallet_unique, Unique);1471 list_benchmark!(list, extra, pallet_inflation, Inflation);1472 list_benchmark!(list, extra, pallet_fungible, Fungible);1473 list_benchmark!(list, extra, pallet_refungible, Refungible);1474 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1475 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);14761477 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();14781479 return (list, storage_info)1480 }14811482 fn dispatch_benchmark(1483 config: frame_benchmarking::BenchmarkConfig1484 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1485 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};14861487 let allowlist: Vec<TrackedStorageKey> = vec![1488 // Block Number1489 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1490 // Total Issuance1491 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1492 // Execution Phase1493 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1494 // Event Count1495 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1496 // System Events1497 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1498 ];14991500 let mut batches = Vec::<BenchmarkBatch>::new();1501 let params = (&config, &allowlist);15021503 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1504 add_benchmark!(params, batches, pallet_unique, Unique);1505 add_benchmark!(params, batches, pallet_inflation, Inflation);1506 add_benchmark!(params, batches, pallet_fungible, Fungible);1507 add_benchmark!(params, batches, pallet_refungible, Refungible);1508 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1509 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);15101511 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1512 Ok(batches)1513 }1514 }1515}15161517struct CheckInherents;15181519impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1520 fn check_inherents(1521 block: &Block,1522 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1523 ) -> sp_inherents::CheckInherentsResult {1524 let relay_chain_slot = relay_state_proof1525 .read_slot()1526 .expect("Could not read the relay chain slot from the proof");15271528 let inherent_data =1529 cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1530 relay_chain_slot,1531 sp_std::time::Duration::from_secs(6),1532 )1533 .create_inherent_data()1534 .expect("Could not create the timestamp inherent data");15351536 inherent_data.check_extrinsics(block)1537 }1538}15391540cumulus_pallet_parachain_system::register_validate_block!(1541 Runtime = Runtime,1542 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1543 CheckInherents = CheckInherents,1544);runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -100,6 +100,7 @@
'xcm/std',
'xcm-builder/std',
'xcm-executor/std',
+ 'unique-runtime-common/std',
"orml-vesting/std",
]
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -1,7 +1,18 @@
-//
-// This file is subject to the terms and conditions defined in
-// file 'LICENSE', which is part of this source code package.
-//
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
@@ -83,8 +94,9 @@
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
- ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+ RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
+ ParentIsPreset,
};
use xcm_executor::{Config, XcmExecutor, Assets};
use sp_std::{marker::PhantomData};
@@ -101,11 +113,8 @@
use sp_runtime::traits::CheckedConversion;
use unique_runtime_common::{types::*, constants::*};
-
-// mod chain_extension;
-// use crate::chain_extension::{NFTExtension, Imbalance};
-pub const RUNTIME_NAME: &'static str = "Unique";
+pub const RUNTIME_NAME: &str = "Unique";
pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
@@ -133,7 +142,7 @@
spec_name: create_runtime_str!(RUNTIME_NAME),
impl_name: create_runtime_str!(RUNTIME_NAME),
authoring_version: 1,
- spec_version: 916001,
+ spec_version: 917004,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@@ -198,18 +207,28 @@
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
.build_or_panic();
pub const Version: RuntimeVersion = VERSION;
- pub const SS58Prefix: u8 = 255;
+ /*
+ FIXME - Unique
+ 255 - Quartz
+ 42 - Opal
+ */
+ pub const SS58Prefix: u8 = 255; // FIXME set valid valud for the Unique runtime
}
+/*
+8880 - Unique
+8881 - Quartz
+8882 - Opal
+*/
parameter_types! {
- pub const ChainId: u64 = 8888;
+ pub const ChainId: u64 = 8880;
}
pub struct FixedFee;
impl FeeCalculator for FixedFee {
fn min_gas_price() -> U256 {
// Targeting 0.15 UNQ per transfer
- 1_024_947_215_000u64.into()
+ 1_018_751_825_264u64.into()
}
}
@@ -574,7 +593,7 @@
/// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the default `AccountId`.
- ParentIsDefault<AccountId>,
+ ParentIsPreset<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
@@ -809,6 +828,8 @@
type ChannelInfo = ParachainSystem;
type VersionWrapper = ();
type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
+ type ControllerOrigin = EnsureRoot<AccountId>;
+ type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
}
impl cumulus_pallet_dmp_queue::Config for Runtime {
@@ -825,7 +846,7 @@
parameter_types! {
pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();
- pub const CollectionCreationPrice: Balance = 100 * UNIQUE;
+ pub const CollectionCreationPrice: Balance = 2 * UNIQUE;
}
impl pallet_common::Config for Runtime {