difftreelog
chore fix merge
in: master
6 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -117,7 +117,7 @@
version = "0.1.0"
dependencies = [
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
+ "pallet-evm",
"parity-scale-codec 3.1.5",
"sp-api",
"sp-core",
@@ -2563,20 +2563,6 @@
"parity-scale-codec 3.1.5",
"sp-core",
"sp-runtime",
- "sp-std",
-]
-
-[[package]]
-name = "fp-evm"
-version = "3.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
-dependencies = [
- "evm",
- "frame-support",
- "impl-trait-for-tuples",
- "parity-scale-codec 3.1.5",
- "serde",
- "sp-core",
"sp-std",
]
@@ -2597,15 +2583,6 @@
[[package]]
name = "fp-evm-mapping"
version = "0.1.0"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
-dependencies = [
- "frame-support",
- "sp-core",
-]
-
-[[package]]
-name = "fp-evm-mapping"
-version = "0.1.0"
source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
dependencies = [
"frame-support",
@@ -2619,7 +2596,7 @@
dependencies = [
"ethereum",
"ethereum-types",
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm",
"parity-scale-codec 3.1.5",
"scale-info",
"sp-api",
@@ -5175,7 +5152,7 @@
"cumulus-primitives-utility",
"derivative",
"evm-coder",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
"frame-benchmarking",
@@ -5195,7 +5172,7 @@
"pallet-common",
"pallet-configuration",
"pallet-ethereum",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-evm-contract-helpers",
"pallet-evm-migration",
@@ -5343,7 +5320,7 @@
"frame-system",
"pallet-balances",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
+ "pallet-evm",
"pallet-evm-contract-helpers",
"pallet-evm-migration",
"pallet-randomness-collective-flip",
@@ -5470,7 +5447,7 @@
version = "1.0.0"
source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
dependencies = [
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm",
"frame-support",
"frame-system",
"parity-scale-codec 3.1.5",
@@ -5579,11 +5556,11 @@
dependencies = [
"ethereum",
"evm-coder",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping",
"frame-benchmarking",
"frame-support",
"frame-system",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"parity-scale-codec 3.1.5",
"scale-info",
@@ -5598,7 +5575,7 @@
name = "pallet-configuration"
version = "0.1.1"
dependencies = [
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm",
"frame-support",
"frame-system",
"parity-scale-codec 3.1.5",
@@ -5689,48 +5666,21 @@
"ethereum-types",
"evm",
"fp-consensus",
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm",
+ "fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
"fp-storage",
"frame-support",
"frame-system",
"log",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
- "pallet-timestamp",
- "parity-scale-codec 3.1.5",
- "rlp",
- "scale-info",
- "serde",
- "sha3 0.10.2",
- "sp-io",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
-name = "pallet-evm"
-version = "6.0.0-dev"
-source = "git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27#69945f20e8dc06ab9e0dd636848a8db6a408c71c"
-dependencies = [
- "evm",
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?branch=unique-polkadot-v0.9.27)",
- "frame-benchmarking",
- "frame-support",
- "frame-system",
- "hex",
- "impl-trait-for-tuples",
- "log",
+ "pallet-evm",
"pallet-timestamp",
"parity-scale-codec 3.1.5",
- "primitive-types",
"rlp",
"scale-info",
"serde",
"sha3 0.10.2",
- "sp-core",
"sp-io",
"sp-runtime",
"sp-std",
@@ -5742,8 +5692,8 @@
source = "git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d#89a37c5a489f426cc7a42d7b94019974093a052d"
dependencies = [
"evm",
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm",
+ "fp-evm-mapping",
"frame-benchmarking",
"frame-support",
"frame-system",
@@ -5773,7 +5723,7 @@
"frame-support",
"frame-system",
"pallet-ethereum",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"parity-scale-codec 3.1.5",
"scale-info",
"sp-core",
@@ -5787,12 +5737,12 @@
dependencies = [
"ethereum",
"evm-coder",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping",
"frame-support",
"frame-system",
"log",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-evm-transaction-payment",
"parity-scale-codec 3.1.5",
@@ -5808,11 +5758,11 @@
name = "pallet-evm-migration"
version = "0.1.1"
dependencies = [
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm",
"frame-benchmarking",
"frame-support",
"frame-system",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"parity-scale-codec 3.1.5",
"scale-info",
"sp-core",
@@ -5825,12 +5775,12 @@
name = "pallet-evm-transaction-payment"
version = "0.1.1"
dependencies = [
- "fp-evm 3.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm",
+ "fp-evm-mapping",
"frame-support",
"frame-system",
"pallet-ethereum",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"parity-scale-codec 3.1.5",
"scale-info",
"sp-core",
@@ -5850,7 +5800,7 @@
"frame-support",
"frame-system",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-structure",
"parity-scale-codec 3.1.5",
@@ -6092,7 +6042,7 @@
"frame-support",
"frame-system",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-structure",
"parity-scale-codec 3.1.5",
@@ -6215,7 +6165,7 @@
"frame-support",
"frame-system",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-structure",
"parity-scale-codec 3.1.5",
@@ -6236,7 +6186,7 @@
"frame-support",
"frame-system",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-nonfungible",
"pallet-structure",
"parity-scale-codec 3.1.5",
@@ -6256,7 +6206,7 @@
"frame-support",
"frame-system",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-nonfungible",
"pallet-rmrk-core",
"parity-scale-codec 3.1.5",
@@ -6386,7 +6336,7 @@
"frame-support",
"frame-system",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"parity-scale-codec 3.1.5",
"scale-info",
"sp-std",
@@ -6533,7 +6483,7 @@
"frame-support",
"frame-system",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-nonfungible",
"pallet-refungible",
@@ -8436,7 +8386,7 @@
"cumulus-primitives-utility",
"derivative",
"evm-coder",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
"frame-benchmarking",
@@ -8456,7 +8406,7 @@
"pallet-common",
"pallet-configuration",
"pallet-ethereum",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-evm-contract-helpers",
"pallet-evm-migration",
@@ -11701,13 +11651,13 @@
version = "0.1.1"
dependencies = [
"evm-coder",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping",
"frame-support",
"frame-system",
"pallet-balances",
"pallet-common",
"pallet-ethereum",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-fungible",
"pallet-nonfungible",
@@ -12204,7 +12154,7 @@
"app-promotion-rpc",
"jsonrpsee",
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"parity-scale-codec 3.1.5",
"rmrk-rpc",
"sp-api",
@@ -12430,7 +12380,7 @@
"cumulus-primitives-utility",
"derivative",
"evm-coder",
- "fp-evm-mapping 0.1.0 (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "fp-evm-mapping",
"fp-rpc",
"fp-self-contained",
"frame-benchmarking",
@@ -12450,7 +12400,7 @@
"pallet-common",
"pallet-configuration",
"pallet-ethereum",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"pallet-evm-coder-substrate",
"pallet-evm-contract-helpers",
"pallet-evm-migration",
@@ -12536,7 +12486,7 @@
dependencies = [
"fp-rpc",
"frame-support",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"sp-consensus-aura",
"sp-core",
"sp-runtime",
@@ -12550,7 +12500,7 @@
"derivative",
"frame-support",
"frame-system",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"parity-scale-codec 3.1.5",
"rmrk-traits",
"scale-info",
@@ -12566,7 +12516,7 @@
version = "0.1.3"
dependencies = [
"pallet-common",
- "pallet-evm 6.0.0-dev (git+https://github.com/uniquenetwork/frontier?rev=89a37c5a489f426cc7a42d7b94019974093a052d)",
+ "pallet-evm",
"parity-scale-codec 3.1.5",
"sp-api",
"sp-core",
client/rpc/src/lib.rsdiffbeforeafterboth--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -577,8 +577,8 @@
BlockNumber: Decode + Member + AtLeast32BitUnsigned,
AccountId: Decode,
C: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
+ CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,
C::Api: AppPromotionRuntimeApi<Block, BlockNumber, CrossAccountId, AccountId>,
- CrossAccountId: pallet_evm::account::CrossAccountId<AccountId>,
{
pass_method!(total_staked(staker: Option<CrossAccountId>) -> String => |v| v.to_string(), app_promotion_api);
pass_method!(total_staked_per_block(staker: CrossAccountId) -> Vec<(BlockNumber, String)> =>
pallets/app-promotion/Cargo.tomldiffbeforeafterboth--- a/pallets/app-promotion/Cargo.toml
+++ b/pallets/app-promotion/Cargo.toml
@@ -52,7 +52,7 @@
pallet-balances ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
pallet-timestamp ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
pallet-randomness-collective-flip ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm ={ default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm ={ default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
sp-std ={ default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
primitives/app_promotion_rpc/Cargo.tomldiffbeforeafterboth--- a/primitives/app_promotion_rpc/Cargo.toml
+++ b/primitives/app_promotion_rpc/Cargo.toml
@@ -14,7 +14,7 @@
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
sp-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.27" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.27" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", rev = "89a37c5a489f426cc7a42d7b94019974093a052d" }
[features]
default = ["std"]
runtime/common/runtime_apis.rsdiffbeforeafterboth1// 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#[macro_export]18macro_rules! dispatch_unique_runtime {19 ($collection:ident.$method:ident($($name:ident),*)) => {{20 let collection = <Runtime as pallet_common::Config>::CollectionDispatch::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);21 let dispatch = collection.as_dyn();2223 Ok::<_, DispatchError>(dispatch.$method($($name),*))24 }};25}2627#[macro_export]28macro_rules! impl_common_runtime_apis {29 (30 $(31 #![custom_apis]3233 $($custom_apis:tt)+34 )?35 ) => {36 use sp_std::prelude::*;37 use sp_api::impl_runtime_apis;38 use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};39 use sp_runtime::{40 Permill,41 traits::Block as BlockT,42 transaction_validity::{TransactionSource, TransactionValidity},43 ApplyExtrinsicResult, DispatchError,44 };45 use fp_rpc::TransactionStatus;46 use pallet_transaction_payment::{47 FeeDetails, RuntimeDispatchInfo,48 };49 use pallet_evm::{50 Runner, account::CrossAccountId as _,51 Account as EVMAccount,52 FeeCalculator53 };54 use runtime_common::{55 sponsoring::{SponsorshipPredict, UniqueSponsorshipPredict},56 dispatch::CollectionDispatch,57 config::ethereum::CrossAccountId,58 };59 use up_data_structs::*;606162 impl_runtime_apis! {63 $($($custom_apis)+)?6465 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {66 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {67 dispatch_unique_runtime!(collection.account_tokens(account))68 }69 fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {70 dispatch_unique_runtime!(collection.collection_tokens())71 }72 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {73 dispatch_unique_runtime!(collection.token_exists(token))74 }7576 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {77 dispatch_unique_runtime!(collection.token_owner(token))78 }7980 fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec::<CrossAccountId>, DispatchError> {81 dispatch_unique_runtime!(collection.token_owners(token))82 }8384 fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {85 let budget = up_data_structs::budget::Value::new(10);8687 Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))88 }89 fn token_children(collection: CollectionId, token: TokenId) -> Result<Vec<TokenChild>, DispatchError> {90 Ok(<pallet_nonfungible::Pallet<Runtime>>::token_children_ids(collection, token))91 }92 fn collection_properties(93 collection: CollectionId,94 keys: Option<Vec<Vec<u8>>>95 ) -> Result<Vec<Property>, DispatchError> {96 let keys = keys.map(97 |keys| Common::bytes_keys_to_property_keys(keys)98 ).transpose()?;99100 Common::filter_collection_properties(collection, keys)101 }102103 fn token_properties(104 collection: CollectionId,105 token_id: TokenId,106 keys: Option<Vec<Vec<u8>>>107 ) -> Result<Vec<Property>, DispatchError> {108 let keys = keys.map(109 |keys| Common::bytes_keys_to_property_keys(keys)110 ).transpose()?;111112 dispatch_unique_runtime!(collection.token_properties(token_id, keys))113 }114115 fn property_permissions(116 collection: CollectionId,117 keys: Option<Vec<Vec<u8>>>118 ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {119 let keys = keys.map(120 |keys| Common::bytes_keys_to_property_keys(keys)121 ).transpose()?;122123 Common::filter_property_permissions(collection, keys)124 }125126 fn token_data(127 collection: CollectionId,128 token_id: TokenId,129 keys: Option<Vec<Vec<u8>>>130 ) -> Result<TokenData<CrossAccountId>, DispatchError> {131 let token_data = TokenData {132 properties: Self::token_properties(collection, token_id, keys)?,133 owner: Self::token_owner(collection, token_id)?,134 pieces: Self::total_pieces(collection, token_id)?.unwrap_or(0),135 };136137 Ok(token_data)138 }139140 fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {141 dispatch_unique_runtime!(collection.total_supply())142 }143 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {144 dispatch_unique_runtime!(collection.account_balance(account))145 }146 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {147 dispatch_unique_runtime!(collection.balance(account, token))148 }149 fn allowance(150 collection: CollectionId,151 sender: CrossAccountId,152 spender: CrossAccountId,153 token: TokenId,154 ) -> Result<u128, DispatchError> {155 dispatch_unique_runtime!(collection.allowance(sender, spender, token))156 }157158 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {159 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))160 }161 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {162 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))163 }164 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {165 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))166 }167 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {168 dispatch_unique_runtime!(collection.last_token_id())169 }170 fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {171 Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))172 }173 fn collection_stats() -> Result<CollectionStats, DispatchError> {174 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())175 }176 fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {177 Ok(<UniqueSponsorshipPredict<Runtime> as SponsorshipPredict<Runtime>>::predict(178 collection,179 account,180 token181 ))182 }183184 fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {185 Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))186 }187188 fn total_pieces(collection: CollectionId, token_id: TokenId) -> Result<Option<u128>, DispatchError> {189 dispatch_unique_runtime!(collection.total_pieces(token_id))190 }191 }192193 impl app_promotion_rpc::AppPromotionApi<Block, BlockNumber, CrossAccountId, AccountId> for Runtime {194 fn total_staked(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {195 #[cfg(not(feature = "app-promotion"))]196 return unsupported!();197198 #[cfg(feature = "app-promotion")]199 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked(staker).unwrap_or_default());200 }201202 fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {203 #[cfg(not(feature = "app-promotion"))]204 return unsupported!();205206 #[cfg(feature = "app-promotion")]207 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked_per_block(staker));208 }209210 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {211 #[cfg(not(feature = "app-promotion"))]212 return unsupported!();213214 #[cfg(feature = "app-promotion")]215 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake(staker));216 }217218 fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {219 #[cfg(not(feature = "app-promotion"))]220 return unsupported!();221222 #[cfg(feature = "app-promotion")]223 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake_per_block(staker))224 }225 }226227 impl rmrk_rpc::RmrkApi<228 Block,229 AccountId,230 RmrkCollectionInfo<AccountId>,231 RmrkInstanceInfo<AccountId>,232 RmrkResourceInfo,233 RmrkPropertyInfo,234 RmrkBaseInfo<AccountId>,235 RmrkPartType,236 RmrkTheme237 > for Runtime {238 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {239 #[cfg(feature = "rmrk")]240 return pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>();241242 #[cfg(not(feature = "rmrk"))]243 return unsupported!();244 }245246 #[allow(unused_variables)]247 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {248 #[cfg(feature = "rmrk")]249 return pallet_proxy_rmrk_core::rpc::collection_by_id::<Runtime>(collection_id);250251 #[cfg(not(feature = "rmrk"))]252 return unsupported!();253 }254255 #[allow(unused_variables)]256 fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {257 #[cfg(feature = "rmrk")]258 return pallet_proxy_rmrk_core::rpc::nft_by_id::<Runtime>(collection_id, nft_by_id);259260 #[cfg(not(feature = "rmrk"))]261 return unsupported!();262 }263264 #[allow(unused_variables)]265 fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {266 #[cfg(feature = "rmrk")]267 return pallet_proxy_rmrk_core::rpc::account_tokens::<Runtime>(account_id, collection_id);268269 #[cfg(not(feature = "rmrk"))]270 return unsupported!();271 }272273 #[allow(unused_variables)]274 fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {275 #[cfg(feature = "rmrk")]276 return pallet_proxy_rmrk_core::rpc::nft_children::<Runtime>(collection_id, nft_id);277278 #[cfg(not(feature = "rmrk"))]279 return unsupported!();280 }281282 #[allow(unused_variables)]283 fn collection_properties(284 collection_id: RmrkCollectionId,285 filter_keys: Option<Vec<RmrkPropertyKey>>286 ) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {287 #[cfg(feature = "rmrk")]288 return pallet_proxy_rmrk_core::rpc::collection_properties::<Runtime>(collection_id, filter_keys);289290 #[cfg(not(feature = "rmrk"))]291 return unsupported!();292 }293294 #[allow(unused_variables)]295 fn nft_properties(296 collection_id: RmrkCollectionId,297 nft_id: RmrkNftId,298 filter_keys: Option<Vec<RmrkPropertyKey>>299 ) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {300 #[cfg(feature = "rmrk")]301 return pallet_proxy_rmrk_core::rpc::nft_properties::<Runtime>(collection_id, nft_id, filter_keys);302303 #[cfg(not(feature = "rmrk"))]304 return unsupported!();305 }306307 #[allow(unused_variables)]308 fn nft_resources(collection_id: RmrkCollectionId,nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {309 #[cfg(feature = "rmrk")]310 return pallet_proxy_rmrk_core::rpc::nft_resources::<Runtime>(collection_id, nft_id);311312 #[cfg(not(feature = "rmrk"))]313 return unsupported!();314 }315316 #[allow(unused_variables)]317 fn nft_resource_priority(318 collection_id: RmrkCollectionId,319 nft_id: RmrkNftId,320 resource_id: RmrkResourceId321 ) -> Result<Option<u32>, DispatchError> {322 #[cfg(feature = "rmrk")]323 return pallet_proxy_rmrk_core::rpc::nft_resource_priority::<Runtime>(collection_id, nft_id, resource_id);324325 #[cfg(not(feature = "rmrk"))]326 return unsupported!();327 }328329 #[allow(unused_variables)]330 fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {331 #[cfg(feature = "rmrk")]332 return pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id);333334 #[cfg(not(feature = "rmrk"))]335 return unsupported!();336 }337338 #[allow(unused_variables)]339 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {340 #[cfg(feature = "rmrk")]341 return pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id);342343 #[cfg(not(feature = "rmrk"))]344 return unsupported!();345 }346347 #[allow(unused_variables)]348 fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {349 #[cfg(feature = "rmrk")]350 return pallet_proxy_rmrk_equip::rpc::theme_names::<Runtime>(base_id);351352 #[cfg(not(feature = "rmrk"))]353 return unsupported!();354 }355356 #[allow(unused_variables)]357 fn theme(358 base_id: RmrkBaseId,359 theme_name: RmrkThemeName,360 filter_keys: Option<Vec<RmrkPropertyKey>>361 ) -> Result<Option<RmrkTheme>, DispatchError> {362 #[cfg(feature = "rmrk")]363 return pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys);364365 #[cfg(not(feature = "rmrk"))]366 return unsupported!();367 }368 }369370 impl sp_api::Core<Block> for Runtime {371 fn version() -> RuntimeVersion {372 VERSION373 }374375 fn execute_block(block: Block) {376 Executive::execute_block(block)377 }378379 fn initialize_block(header: &<Block as BlockT>::Header) {380 Executive::initialize_block(header)381 }382 }383384 impl sp_api::Metadata<Block> for Runtime {385 fn metadata() -> OpaqueMetadata {386 OpaqueMetadata::new(Runtime::metadata().into())387 }388 }389390 impl sp_block_builder::BlockBuilder<Block> for Runtime {391 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {392 Executive::apply_extrinsic(extrinsic)393 }394395 fn finalize_block() -> <Block as BlockT>::Header {396 Executive::finalize_block()397 }398399 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {400 data.create_extrinsics()401 }402403 fn check_inherents(404 block: Block,405 data: sp_inherents::InherentData,406 ) -> sp_inherents::CheckInherentsResult {407 data.check_extrinsics(&block)408 }409410 // fn random_seed() -> <Block as BlockT>::Hash {411 // RandomnessCollectiveFlip::random_seed().0412 // }413 }414415 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {416 fn validate_transaction(417 source: TransactionSource,418 tx: <Block as BlockT>::Extrinsic,419 hash: <Block as BlockT>::Hash,420 ) -> TransactionValidity {421 Executive::validate_transaction(source, tx, hash)422 }423 }424425 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {426 fn offchain_worker(header: &<Block as BlockT>::Header) {427 Executive::offchain_worker(header)428 }429 }430431 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {432 fn chain_id() -> u64 {433 <Runtime as pallet_evm::Config>::ChainId::get()434 }435436 fn account_basic(address: H160) -> EVMAccount {437 let (account, _) = EVM::account_basic(&address);438 account439 }440441 fn gas_price() -> U256 {442 let (price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();443 price444 }445446 fn account_code_at(address: H160) -> Vec<u8> {447 EVM::account_codes(address)448 }449450 fn author() -> H160 {451 <pallet_evm::Pallet<Runtime>>::find_author()452 }453454 fn storage_at(address: H160, index: U256) -> H256 {455 let mut tmp = [0u8; 32];456 index.to_big_endian(&mut tmp);457 EVM::account_storages(address, H256::from_slice(&tmp[..]))458 }459460 #[allow(clippy::redundant_closure)]461 fn call(462 from: H160,463 to: H160,464 data: Vec<u8>,465 value: U256,466 gas_limit: U256,467 max_fee_per_gas: Option<U256>,468 max_priority_fee_per_gas: Option<U256>,469 nonce: Option<U256>,470 estimate: bool,471 access_list: Option<Vec<(H160, Vec<H256>)>>,472 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {473 let config = if estimate {474 let mut config = <Runtime as pallet_evm::Config>::config().clone();475 config.estimate = true;476 Some(config)477 } else {478 None479 };480481 let is_transactional = false;482 <Runtime as pallet_evm::Config>::Runner::call(483 CrossAccountId::from_eth(from),484 to,485 data,486 value,487 gas_limit.low_u64(),488 max_fee_per_gas,489 max_priority_fee_per_gas,490 nonce,491 access_list.unwrap_or_default(),492 is_transactional,493 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),494 ).map_err(|err| err.error.into())495 }496497 #[allow(clippy::redundant_closure)]498 fn create(499 from: H160,500 data: Vec<u8>,501 value: U256,502 gas_limit: U256,503 max_fee_per_gas: Option<U256>,504 max_priority_fee_per_gas: Option<U256>,505 nonce: Option<U256>,506 estimate: bool,507 access_list: Option<Vec<(H160, Vec<H256>)>>,508 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {509 let config = if estimate {510 let mut config = <Runtime as pallet_evm::Config>::config().clone();511 config.estimate = true;512 Some(config)513 } else {514 None515 };516517 let is_transactional = false;518 <Runtime as pallet_evm::Config>::Runner::create(519 CrossAccountId::from_eth(from),520 data,521 value,522 gas_limit.low_u64(),523 max_fee_per_gas,524 max_priority_fee_per_gas,525 nonce,526 access_list.unwrap_or_default(),527 is_transactional,528 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),529 ).map_err(|err| err.error.into())530 }531532 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {533 Ethereum::current_transaction_statuses()534 }535536 fn current_block() -> Option<pallet_ethereum::Block> {537 Ethereum::current_block()538 }539540 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {541 Ethereum::current_receipts()542 }543544 fn current_all() -> (545 Option<pallet_ethereum::Block>,546 Option<Vec<pallet_ethereum::Receipt>>,547 Option<Vec<TransactionStatus>>548 ) {549 (550 Ethereum::current_block(),551 Ethereum::current_receipts(),552 Ethereum::current_transaction_statuses()553 )554 }555556 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {557 xts.into_iter().filter_map(|xt| match xt.0.function {558 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),559 _ => None560 }).collect()561 }562563 fn elasticity() -> Option<Permill> {564 None565 }566 }567568 impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {569 fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {570 UncheckedExtrinsic::new_unsigned(571 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),572 )573 }574 }575576 impl sp_session::SessionKeys<Block> for Runtime {577 fn decode_session_keys(578 encoded: Vec<u8>,579 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {580 SessionKeys::decode_into_raw_public_keys(&encoded)581 }582583 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {584 SessionKeys::generate(seed)585 }586 }587588 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {589 fn slot_duration() -> sp_consensus_aura::SlotDuration {590 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())591 }592593 fn authorities() -> Vec<AuraId> {594 Aura::authorities().to_vec()595 }596 }597598 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {599 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {600 ParachainSystem::collect_collation_info(header)601 }602 }603604 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {605 fn account_nonce(account: AccountId) -> Index {606 System::account_nonce(account)607 }608 }609610 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {611 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {612 TransactionPayment::query_info(uxt, len)613 }614 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {615 TransactionPayment::query_fee_details(uxt, len)616 }617 }618619 /*620 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>621 for Runtime622 {623 fn call(624 origin: AccountId,625 dest: AccountId,626 value: Balance,627 gas_limit: u64,628 input_data: Vec<u8>,629 ) -> pallet_contracts_primitives::ContractExecResult {630 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)631 }632633 fn instantiate(634 origin: AccountId,635 endowment: Balance,636 gas_limit: u64,637 code: pallet_contracts_primitives::Code<Hash>,638 data: Vec<u8>,639 salt: Vec<u8>,640 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>641 {642 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)643 }644645 fn get_storage(646 address: AccountId,647 key: [u8; 32],648 ) -> pallet_contracts_primitives::GetStorageResult {649 Contracts::get_storage(address, key)650 }651652 fn rent_projection(653 address: AccountId,654 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {655 Contracts::rent_projection(address)656 }657 }658 */659660 #[cfg(feature = "runtime-benchmarks")]661 impl frame_benchmarking::Benchmark<Block> for Runtime {662 fn benchmark_metadata(extra: bool) -> (663 Vec<frame_benchmarking::BenchmarkList>,664 Vec<frame_support::traits::StorageInfo>,665 ) {666 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};667 use frame_support::traits::StorageInfoTrait;668669 let mut list = Vec::<BenchmarkList>::new();670671 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);672 list_benchmark!(list, extra, pallet_common, Common);673 list_benchmark!(list, extra, pallet_unique, Unique);674 list_benchmark!(list, extra, pallet_structure, Structure);675 list_benchmark!(list, extra, pallet_inflation, Inflation);676 list_benchmark!(list, extra, pallet_app_promotion, AppPromotion);677 list_benchmark!(list, extra, pallet_fungible, Fungible);678 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);679680 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]681 list_benchmark!(list, extra, pallet_refungible, Refungible);682683 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]684 list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);685686 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]687 list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);688689 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]690 list_benchmark!(list, extra, pallet_proxy_rmrk_equip, RmrkEquip);691692 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);693694 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();695696 return (list, storage_info)697 }698699 fn dispatch_benchmark(700 config: frame_benchmarking::BenchmarkConfig701 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {702 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};703704 let allowlist: Vec<TrackedStorageKey> = vec![705 // Total Issuance706 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),707708 // Block Number709 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),710 // Execution Phase711 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),712 // Event Count713 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),714 // System Events715 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),716717 // Evm CurrentLogs718 hex_literal::hex!("1da53b775b270400e7e61ed5cbc5a146547f210cec367e9af919603343b9cb56").to_vec().into(),719720 // Transactional depth721 hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),722 ];723724 let mut batches = Vec::<BenchmarkBatch>::new();725 let params = (&config, &allowlist);726727 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);728 add_benchmark!(params, batches, pallet_common, Common);729 add_benchmark!(params, batches, pallet_unique, Unique);730 add_benchmark!(params, batches, pallet_structure, Structure);731 add_benchmark!(params, batches, pallet_inflation, Inflation);732 add_benchmark!(params, batches, pallet_app_promotion, AppPromotion);733 add_benchmark!(params, batches, pallet_fungible, Fungible);734 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);735736 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]737 add_benchmark!(params, batches, pallet_refungible, Refungible);738739 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]740 add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);741742 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]743 add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);744745 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]746 add_benchmark!(params, batches, pallet_proxy_rmrk_equip, RmrkEquip);747748 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);749750 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }751 Ok(batches)752 }753 }754755 #[cfg(feature = "try-runtime")]756 impl frame_try_runtime::TryRuntime<Block> for Runtime {757 fn on_runtime_upgrade() -> (frame_support::pallet_prelude::Weight, frame_support::pallet_prelude::Weight) {758 log::info!("try-runtime::on_runtime_upgrade unique-chain.");759 let weight = Executive::try_runtime_upgrade().unwrap();760 (weight, crate::config::substrate::RuntimeBlockWeights::get().max_block)761 }762763 fn execute_block_no_check(block: Block) -> frame_support::pallet_prelude::Weight {764 Executive::execute_block_no_check(block)765 }766 }767 }768 }769}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#[macro_export]18macro_rules! dispatch_unique_runtime {19 ($collection:ident.$method:ident($($name:ident),*)) => {{20 let collection = <Runtime as pallet_common::Config>::CollectionDispatch::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);21 let dispatch = collection.as_dyn();2223 Ok::<_, DispatchError>(dispatch.$method($($name),*))24 }};25}2627#[macro_export]28macro_rules! impl_common_runtime_apis {29 (30 $(31 #![custom_apis]3233 $($custom_apis:tt)+34 )?35 ) => {36 use sp_std::prelude::*;37 use sp_api::impl_runtime_apis;38 use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};39 use sp_runtime::{40 Permill,41 traits::Block as BlockT,42 transaction_validity::{TransactionSource, TransactionValidity},43 ApplyExtrinsicResult, DispatchError,44 };45 use fp_rpc::TransactionStatus;46 use pallet_transaction_payment::{47 FeeDetails, RuntimeDispatchInfo,48 };49 use pallet_evm::{50 Runner, account::CrossAccountId as _,51 Account as EVMAccount, FeeCalculator,52 };53 use runtime_common::{54 sponsoring::{SponsorshipPredict, UniqueSponsorshipPredict},55 dispatch::CollectionDispatch,56 config::ethereum::CrossAccountId,57 };58 use up_data_structs::*;596061 impl_runtime_apis! {62 $($($custom_apis)+)?6364 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {65 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {66 dispatch_unique_runtime!(collection.account_tokens(account))67 }68 fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {69 dispatch_unique_runtime!(collection.collection_tokens())70 }71 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {72 dispatch_unique_runtime!(collection.token_exists(token))73 }7475 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {76 dispatch_unique_runtime!(collection.token_owner(token))77 }7879 fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec::<CrossAccountId>, DispatchError> {80 dispatch_unique_runtime!(collection.token_owners(token))81 }8283 fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {84 let budget = up_data_structs::budget::Value::new(10);8586 Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))87 }88 fn token_children(collection: CollectionId, token: TokenId) -> Result<Vec<TokenChild>, DispatchError> {89 Ok(<pallet_nonfungible::Pallet<Runtime>>::token_children_ids(collection, token))90 }91 fn collection_properties(92 collection: CollectionId,93 keys: Option<Vec<Vec<u8>>>94 ) -> Result<Vec<Property>, DispatchError> {95 let keys = keys.map(96 |keys| Common::bytes_keys_to_property_keys(keys)97 ).transpose()?;9899 Common::filter_collection_properties(collection, keys)100 }101102 fn token_properties(103 collection: CollectionId,104 token_id: TokenId,105 keys: Option<Vec<Vec<u8>>>106 ) -> Result<Vec<Property>, DispatchError> {107 let keys = keys.map(108 |keys| Common::bytes_keys_to_property_keys(keys)109 ).transpose()?;110111 dispatch_unique_runtime!(collection.token_properties(token_id, keys))112 }113114 fn property_permissions(115 collection: CollectionId,116 keys: Option<Vec<Vec<u8>>>117 ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {118 let keys = keys.map(119 |keys| Common::bytes_keys_to_property_keys(keys)120 ).transpose()?;121122 Common::filter_property_permissions(collection, keys)123 }124125 fn token_data(126 collection: CollectionId,127 token_id: TokenId,128 keys: Option<Vec<Vec<u8>>>129 ) -> Result<TokenData<CrossAccountId>, DispatchError> {130 let token_data = TokenData {131 properties: Self::token_properties(collection, token_id, keys)?,132 owner: Self::token_owner(collection, token_id)?,133 pieces: Self::total_pieces(collection, token_id)?.unwrap_or(0),134 };135136 Ok(token_data)137 }138139 fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {140 dispatch_unique_runtime!(collection.total_supply())141 }142 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {143 dispatch_unique_runtime!(collection.account_balance(account))144 }145 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {146 dispatch_unique_runtime!(collection.balance(account, token))147 }148 fn allowance(149 collection: CollectionId,150 sender: CrossAccountId,151 spender: CrossAccountId,152 token: TokenId,153 ) -> Result<u128, DispatchError> {154 dispatch_unique_runtime!(collection.allowance(sender, spender, token))155 }156157 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {158 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))159 }160 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {161 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))162 }163 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {164 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))165 }166 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {167 dispatch_unique_runtime!(collection.last_token_id())168 }169 fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {170 Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))171 }172 fn collection_stats() -> Result<CollectionStats, DispatchError> {173 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())174 }175 fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {176 Ok(<UniqueSponsorshipPredict<Runtime> as SponsorshipPredict<Runtime>>::predict(177 collection,178 account,179 token180 ))181 }182183 fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {184 Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))185 }186187 fn total_pieces(collection: CollectionId, token_id: TokenId) -> Result<Option<u128>, DispatchError> {188 dispatch_unique_runtime!(collection.total_pieces(token_id))189 }190 }191192 impl app_promotion_rpc::AppPromotionApi<Block, BlockNumber, CrossAccountId, AccountId> for Runtime {193 fn total_staked(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {194 #[cfg(not(feature = "app-promotion"))]195 return unsupported!();196197 #[cfg(feature = "app-promotion")]198 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked(staker).unwrap_or_default());199 }200201 fn total_staked_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {202 #[cfg(not(feature = "app-promotion"))]203 return unsupported!();204205 #[cfg(feature = "app-promotion")]206 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_total_staked_per_block(staker));207 }208209 fn pending_unstake(staker: Option<CrossAccountId>) -> Result<u128, DispatchError> {210 #[cfg(not(feature = "app-promotion"))]211 return unsupported!();212213 #[cfg(feature = "app-promotion")]214 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake(staker));215 }216217 fn pending_unstake_per_block(staker: CrossAccountId) -> Result<Vec<(BlockNumber, u128)>, DispatchError> {218 #[cfg(not(feature = "app-promotion"))]219 return unsupported!();220221 #[cfg(feature = "app-promotion")]222 return Ok(<pallet_app_promotion::Pallet<Runtime>>::cross_id_pending_unstake_per_block(staker))223 }224 }225226 impl rmrk_rpc::RmrkApi<227 Block,228 AccountId,229 RmrkCollectionInfo<AccountId>,230 RmrkInstanceInfo<AccountId>,231 RmrkResourceInfo,232 RmrkPropertyInfo,233 RmrkBaseInfo<AccountId>,234 RmrkPartType,235 RmrkTheme236 > for Runtime {237 fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {238 #[cfg(feature = "rmrk")]239 return pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>();240241 #[cfg(not(feature = "rmrk"))]242 return unsupported!();243 }244245 #[allow(unused_variables)]246 fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {247 #[cfg(feature = "rmrk")]248 return pallet_proxy_rmrk_core::rpc::collection_by_id::<Runtime>(collection_id);249250 #[cfg(not(feature = "rmrk"))]251 return unsupported!();252 }253254 #[allow(unused_variables)]255 fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {256 #[cfg(feature = "rmrk")]257 return pallet_proxy_rmrk_core::rpc::nft_by_id::<Runtime>(collection_id, nft_by_id);258259 #[cfg(not(feature = "rmrk"))]260 return unsupported!();261 }262263 #[allow(unused_variables)]264 fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {265 #[cfg(feature = "rmrk")]266 return pallet_proxy_rmrk_core::rpc::account_tokens::<Runtime>(account_id, collection_id);267268 #[cfg(not(feature = "rmrk"))]269 return unsupported!();270 }271272 #[allow(unused_variables)]273 fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {274 #[cfg(feature = "rmrk")]275 return pallet_proxy_rmrk_core::rpc::nft_children::<Runtime>(collection_id, nft_id);276277 #[cfg(not(feature = "rmrk"))]278 return unsupported!();279 }280281 #[allow(unused_variables)]282 fn collection_properties(283 collection_id: RmrkCollectionId,284 filter_keys: Option<Vec<RmrkPropertyKey>>285 ) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {286 #[cfg(feature = "rmrk")]287 return pallet_proxy_rmrk_core::rpc::collection_properties::<Runtime>(collection_id, filter_keys);288289 #[cfg(not(feature = "rmrk"))]290 return unsupported!();291 }292293 #[allow(unused_variables)]294 fn nft_properties(295 collection_id: RmrkCollectionId,296 nft_id: RmrkNftId,297 filter_keys: Option<Vec<RmrkPropertyKey>>298 ) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {299 #[cfg(feature = "rmrk")]300 return pallet_proxy_rmrk_core::rpc::nft_properties::<Runtime>(collection_id, nft_id, filter_keys);301302 #[cfg(not(feature = "rmrk"))]303 return unsupported!();304 }305306 #[allow(unused_variables)]307 fn nft_resources(collection_id: RmrkCollectionId,nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {308 #[cfg(feature = "rmrk")]309 return pallet_proxy_rmrk_core::rpc::nft_resources::<Runtime>(collection_id, nft_id);310311 #[cfg(not(feature = "rmrk"))]312 return unsupported!();313 }314315 #[allow(unused_variables)]316 fn nft_resource_priority(317 collection_id: RmrkCollectionId,318 nft_id: RmrkNftId,319 resource_id: RmrkResourceId320 ) -> Result<Option<u32>, DispatchError> {321 #[cfg(feature = "rmrk")]322 return pallet_proxy_rmrk_core::rpc::nft_resource_priority::<Runtime>(collection_id, nft_id, resource_id);323324 #[cfg(not(feature = "rmrk"))]325 return unsupported!();326 }327328 #[allow(unused_variables)]329 fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {330 #[cfg(feature = "rmrk")]331 return pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id);332333 #[cfg(not(feature = "rmrk"))]334 return unsupported!();335 }336337 #[allow(unused_variables)]338 fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {339 #[cfg(feature = "rmrk")]340 return pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id);341342 #[cfg(not(feature = "rmrk"))]343 return unsupported!();344 }345346 #[allow(unused_variables)]347 fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {348 #[cfg(feature = "rmrk")]349 return pallet_proxy_rmrk_equip::rpc::theme_names::<Runtime>(base_id);350351 #[cfg(not(feature = "rmrk"))]352 return unsupported!();353 }354355 #[allow(unused_variables)]356 fn theme(357 base_id: RmrkBaseId,358 theme_name: RmrkThemeName,359 filter_keys: Option<Vec<RmrkPropertyKey>>360 ) -> Result<Option<RmrkTheme>, DispatchError> {361 #[cfg(feature = "rmrk")]362 return pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys);363364 #[cfg(not(feature = "rmrk"))]365 return unsupported!();366 }367 }368369 impl sp_api::Core<Block> for Runtime {370 fn version() -> RuntimeVersion {371 VERSION372 }373374 fn execute_block(block: Block) {375 Executive::execute_block(block)376 }377378 fn initialize_block(header: &<Block as BlockT>::Header) {379 Executive::initialize_block(header)380 }381 }382383 impl sp_api::Metadata<Block> for Runtime {384 fn metadata() -> OpaqueMetadata {385 OpaqueMetadata::new(Runtime::metadata().into())386 }387 }388389 impl sp_block_builder::BlockBuilder<Block> for Runtime {390 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {391 Executive::apply_extrinsic(extrinsic)392 }393394 fn finalize_block() -> <Block as BlockT>::Header {395 Executive::finalize_block()396 }397398 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {399 data.create_extrinsics()400 }401402 fn check_inherents(403 block: Block,404 data: sp_inherents::InherentData,405 ) -> sp_inherents::CheckInherentsResult {406 data.check_extrinsics(&block)407 }408409 // fn random_seed() -> <Block as BlockT>::Hash {410 // RandomnessCollectiveFlip::random_seed().0411 // }412 }413414 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {415 fn validate_transaction(416 source: TransactionSource,417 tx: <Block as BlockT>::Extrinsic,418 hash: <Block as BlockT>::Hash,419 ) -> TransactionValidity {420 Executive::validate_transaction(source, tx, hash)421 }422 }423424 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {425 fn offchain_worker(header: &<Block as BlockT>::Header) {426 Executive::offchain_worker(header)427 }428 }429430 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {431 fn chain_id() -> u64 {432 <Runtime as pallet_evm::Config>::ChainId::get()433 }434435 fn account_basic(address: H160) -> EVMAccount {436 let (account, _) = EVM::account_basic(&address);437 account438 }439440 fn gas_price() -> U256 {441 let (price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();442 price443 }444445 fn account_code_at(address: H160) -> Vec<u8> {446 EVM::account_codes(address)447 }448449 fn author() -> H160 {450 <pallet_evm::Pallet<Runtime>>::find_author()451 }452453 fn storage_at(address: H160, index: U256) -> H256 {454 let mut tmp = [0u8; 32];455 index.to_big_endian(&mut tmp);456 EVM::account_storages(address, H256::from_slice(&tmp[..]))457 }458459 #[allow(clippy::redundant_closure)]460 fn call(461 from: H160,462 to: H160,463 data: Vec<u8>,464 value: U256,465 gas_limit: U256,466 max_fee_per_gas: Option<U256>,467 max_priority_fee_per_gas: Option<U256>,468 nonce: Option<U256>,469 estimate: bool,470 access_list: Option<Vec<(H160, Vec<H256>)>>,471 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {472 let config = if estimate {473 let mut config = <Runtime as pallet_evm::Config>::config().clone();474 config.estimate = true;475 Some(config)476 } else {477 None478 };479480 let is_transactional = false;481 <Runtime as pallet_evm::Config>::Runner::call(482 CrossAccountId::from_eth(from),483 to,484 data,485 value,486 gas_limit.low_u64(),487 max_fee_per_gas,488 max_priority_fee_per_gas,489 nonce,490 access_list.unwrap_or_default(),491 is_transactional,492 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),493 ).map_err(|err| err.error.into())494 }495496 #[allow(clippy::redundant_closure)]497 fn create(498 from: H160,499 data: Vec<u8>,500 value: U256,501 gas_limit: U256,502 max_fee_per_gas: Option<U256>,503 max_priority_fee_per_gas: Option<U256>,504 nonce: Option<U256>,505 estimate: bool,506 access_list: Option<Vec<(H160, Vec<H256>)>>,507 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {508 let config = if estimate {509 let mut config = <Runtime as pallet_evm::Config>::config().clone();510 config.estimate = true;511 Some(config)512 } else {513 None514 };515516 let is_transactional = false;517 <Runtime as pallet_evm::Config>::Runner::create(518 CrossAccountId::from_eth(from),519 data,520 value,521 gas_limit.low_u64(),522 max_fee_per_gas,523 max_priority_fee_per_gas,524 nonce,525 access_list.unwrap_or_default(),526 is_transactional,527 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),528 ).map_err(|err| err.error.into())529 }530531 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {532 Ethereum::current_transaction_statuses()533 }534535 fn current_block() -> Option<pallet_ethereum::Block> {536 Ethereum::current_block()537 }538539 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {540 Ethereum::current_receipts()541 }542543 fn current_all() -> (544 Option<pallet_ethereum::Block>,545 Option<Vec<pallet_ethereum::Receipt>>,546 Option<Vec<TransactionStatus>>547 ) {548 (549 Ethereum::current_block(),550 Ethereum::current_receipts(),551 Ethereum::current_transaction_statuses()552 )553 }554555 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {556 xts.into_iter().filter_map(|xt| match xt.0.function {557 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),558 _ => None559 }).collect()560 }561562 fn elasticity() -> Option<Permill> {563 None564 }565 }566567 impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {568 fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic {569 UncheckedExtrinsic::new_unsigned(570 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),571 )572 }573 }574575 impl sp_session::SessionKeys<Block> for Runtime {576 fn decode_session_keys(577 encoded: Vec<u8>,578 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {579 SessionKeys::decode_into_raw_public_keys(&encoded)580 }581582 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {583 SessionKeys::generate(seed)584 }585 }586587 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {588 fn slot_duration() -> sp_consensus_aura::SlotDuration {589 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())590 }591592 fn authorities() -> Vec<AuraId> {593 Aura::authorities().to_vec()594 }595 }596597 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {598 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {599 ParachainSystem::collect_collation_info(header)600 }601 }602603 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {604 fn account_nonce(account: AccountId) -> Index {605 System::account_nonce(account)606 }607 }608609 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {610 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {611 TransactionPayment::query_info(uxt, len)612 }613 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {614 TransactionPayment::query_fee_details(uxt, len)615 }616 }617618 /*619 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>620 for Runtime621 {622 fn call(623 origin: AccountId,624 dest: AccountId,625 value: Balance,626 gas_limit: u64,627 input_data: Vec<u8>,628 ) -> pallet_contracts_primitives::ContractExecResult {629 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)630 }631632 fn instantiate(633 origin: AccountId,634 endowment: Balance,635 gas_limit: u64,636 code: pallet_contracts_primitives::Code<Hash>,637 data: Vec<u8>,638 salt: Vec<u8>,639 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>640 {641 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)642 }643644 fn get_storage(645 address: AccountId,646 key: [u8; 32],647 ) -> pallet_contracts_primitives::GetStorageResult {648 Contracts::get_storage(address, key)649 }650651 fn rent_projection(652 address: AccountId,653 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {654 Contracts::rent_projection(address)655 }656 }657 */658659 #[cfg(feature = "runtime-benchmarks")]660 impl frame_benchmarking::Benchmark<Block> for Runtime {661 fn benchmark_metadata(extra: bool) -> (662 Vec<frame_benchmarking::BenchmarkList>,663 Vec<frame_support::traits::StorageInfo>,664 ) {665 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};666 use frame_support::traits::StorageInfoTrait;667668 let mut list = Vec::<BenchmarkList>::new();669670 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);671 list_benchmark!(list, extra, pallet_common, Common);672 list_benchmark!(list, extra, pallet_unique, Unique);673 list_benchmark!(list, extra, pallet_structure, Structure);674 list_benchmark!(list, extra, pallet_inflation, Inflation);675 list_benchmark!(list, extra, pallet_app_promotion, AppPromotion);676 list_benchmark!(list, extra, pallet_fungible, Fungible);677 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);678679 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]680 list_benchmark!(list, extra, pallet_refungible, Refungible);681682 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]683 list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);684685 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]686 list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);687688 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]689 list_benchmark!(list, extra, pallet_proxy_rmrk_equip, RmrkEquip);690691 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);692693 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();694695 return (list, storage_info)696 }697698 fn dispatch_benchmark(699 config: frame_benchmarking::BenchmarkConfig700 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {701 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};702703 let allowlist: Vec<TrackedStorageKey> = vec![704 // Total Issuance705 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),706707 // Block Number708 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),709 // Execution Phase710 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),711 // Event Count712 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),713 // System Events714 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),715716 // Evm CurrentLogs717 hex_literal::hex!("1da53b775b270400e7e61ed5cbc5a146547f210cec367e9af919603343b9cb56").to_vec().into(),718719 // Transactional depth720 hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),721 ];722723 let mut batches = Vec::<BenchmarkBatch>::new();724 let params = (&config, &allowlist);725726 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);727 add_benchmark!(params, batches, pallet_common, Common);728 add_benchmark!(params, batches, pallet_unique, Unique);729 add_benchmark!(params, batches, pallet_structure, Structure);730 add_benchmark!(params, batches, pallet_inflation, Inflation);731 add_benchmark!(params, batches, pallet_app_promotion, AppPromotion);732 add_benchmark!(params, batches, pallet_fungible, Fungible);733 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);734735 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]736 add_benchmark!(params, batches, pallet_refungible, Refungible);737738 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]739 add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);740741 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]742 add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);743744 #[cfg(not(any(feature = "unique-runtime", feature = "quartz-runtime")))]745 add_benchmark!(params, batches, pallet_proxy_rmrk_equip, RmrkEquip);746747 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);748749 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }750 Ok(batches)751 }752 }753754 #[cfg(feature = "try-runtime")]755 impl frame_try_runtime::TryRuntime<Block> for Runtime {756 fn on_runtime_upgrade() -> (frame_support::pallet_prelude::Weight, frame_support::pallet_prelude::Weight) {757 log::info!("try-runtime::on_runtime_upgrade unique-chain.");758 let weight = Executive::try_runtime_upgrade().unwrap();759 (weight, crate::config::substrate::RuntimeBlockWeights::get().max_block)760 }761762 fn execute_block_no_check(block: Block) -> frame_support::pallet_prelude::Weight {763 Executive::execute_block_no_check(block)764 }765 }766 }767 }768}tests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -33,7 +33,7 @@
GAS_ARGS,
subToEth,
} from './util/helpers';
-import { submitTransactionAsync } from '../substrate/substrate-api';
+import {submitTransactionAsync} from '../substrate/substrate-api';
describe('Sponsoring EVM contracts', () => {
itWeb3('Self sponsored can be set by the address that deployed the contract', async ({api, web3, privateKeyWrapper}) => {