git.delta.rocks / unique-network / refs/commits / ba69054f3875

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2021-11-26parent: #d1696cc.patch.diff
in: master

26 files changed

modified.maintain/frame-weight-template.hbsdiffbeforeafterboth
--- a/.maintain/frame-weight-template.hbs
+++ b/.maintain/frame-weight-template.hbs
@@ -14,6 +14,7 @@
 #![cfg_attr(rustfmt, rustfmt_skip)]
 #![allow(unused_parens)]
 #![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
 
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
 use sp_std::marker::PhantomData;
modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -57,9 +57,5 @@
 bench-nonfungible:
 	make _bench PALLET=nonfungible
 
-.PHONY: bench-evm-coder-substrate
-bench-evm-coder-substrate:
-	make _bench PALLET=evm-coder-substrate
-
 .PHONY: bench
-bench: bench-evm-migration bench-nft bench-fungible bench-refungible bench-nonfungible bench-evm-coder-substrate
+bench: bench-evm-migration bench-nft bench-fungible bench-refungible bench-nonfungible
modifiedcrates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth
--- a/crates/evm-coder-macros/src/solidity_interface.rs
+++ b/crates/evm-coder-macros/src/solidity_interface.rs
@@ -226,16 +226,10 @@
 		}
 	}
 	fn is_value(&self) -> bool {
-		match self {
-			Self::Plain(v) if v == "value" => true,
-			_ => false,
-		}
+		matches!(self, Self::Plain(v) if v == "value")
 	}
 	fn is_caller(&self) -> bool {
-		match self {
-			Self::Plain(v) if v == "caller" => true,
-			_ => false,
-		}
+		matches!(self, Self::Plain(v) if v == "caller")
 	}
 	fn is_special(&self) -> bool {
 		self.is_caller() || self.is_value()
@@ -599,7 +593,7 @@
 						#args,
 					)*
 				)?;
-				(&result).into_result()
+				(&result).to_result()
 			}
 		}
 	}
modifiedcrates/evm-coder/src/abi.rsdiffbeforeafterboth
--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -310,7 +310,7 @@
 
 pub trait AbiWrite {
 	fn abi_write(&self, writer: &mut AbiWriter);
-	fn into_result(&self) -> ResultWithPostInfo<AbiWriter> {
+	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {
 		let mut writer = AbiWriter::new();
 		self.abi_write(&mut writer);
 		Ok(writer.into())
@@ -319,7 +319,7 @@
 
 impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {
 	// this particular AbiWrite implementation should be split to another trait,
-	// which only implements [`into_result`]
+	// which only implements [`to_result`]
 	//
 	// But due to lack of specialization feature in stable Rust, we can't have
 	// blanket impl of this trait `for T where T: AbiWrite`, so here we abusing
@@ -327,7 +327,7 @@
 	fn abi_write(&self, _writer: &mut AbiWriter) {
 		debug_assert!(false, "shouldn't be called, see comment")
 	}
-	fn into_result(&self) -> ResultWithPostInfo<AbiWriter> {
+	fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {
 		match self {
 			Ok(v) => Ok(WithPostDispatchInfo {
 				post_info: v.post_info.clone(),
modifiednode/rpc/src/lib.rsdiffbeforeafterboth
--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -214,7 +214,7 @@
 			500_usize, // max stored filters
 			overrides.clone(),
 			max_past_logs,
-			block_data_cache.clone(),
+			block_data_cache,
 		)));
 	}
 
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -51,7 +51,7 @@
 		Self::new_with_gas_limit(id, u64::MAX)
 	}
 	pub fn try_get(id: CollectionId) -> Result<Self, DispatchError> {
-		Ok(Self::new(id).ok_or_else(|| <Error<T>>::CollectionNotFound)?)
+		Ok(Self::new(id).ok_or(<Error<T>>::CollectionNotFound)?)
 	}
 	pub fn log(&self, log: impl evm_coder::ToLog) {
 		self.recorder.log(log)
@@ -453,7 +453,7 @@
 			collection.limits.owner_can_destroy(),
 			<Error<T>>::NoPermission,
 		);
-		collection.check_is_owner(&sender)?;
+		collection.check_is_owner(sender)?;
 
 		let destroyed_collections = <DestroyedCollectionCount<T>>::get()
 			.0
@@ -476,7 +476,7 @@
 		user: &T::CrossAccountId,
 		allowed: bool,
 	) -> DispatchResult {
-		collection.check_is_owner_or_admin(&sender)?;
+		collection.check_is_owner_or_admin(sender)?;
 
 		// =========
 
@@ -495,7 +495,7 @@
 		user: &T::CrossAccountId,
 		admin: bool,
 	) -> DispatchResult {
-		collection.check_is_owner_or_admin(&sender)?;
+		collection.check_is_owner_or_admin(sender)?;
 
 		let was_admin = <IsAdmin<T>>::get((collection.id, user));
 		if was_admin == admin {
modifiedpallets/evm-contract-helpers/exp.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/exp.rs
+++ b/pallets/evm-contract-helpers/exp.rs
@@ -532,11 +532,11 @@
             match c.call {
                 InternalCall::ContractOwner { contract_address } => {
                     let result = self.contract_owner(contract_address)?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 InternalCall::SponsoringEnabled { contract_address } => {
                     let result = self.sponsoring_enabled(contract_address)?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 InternalCall::ToggleSponsoring {
                     contract_address,
@@ -544,7 +544,7 @@
                 } => {
                     let result =
                         self.toggle_sponsoring(c.caller.clone(), contract_address, enabled)?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 InternalCall::SetSponsoringRateLimit {
                     contract_address,
@@ -555,22 +555,22 @@
                         contract_address,
                         rate_limit,
                     )?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 InternalCall::GetSponsoringRateLimit { contract_address } => {
                     let result = self.get_sponsoring_rate_limit(contract_address)?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 InternalCall::Allowed {
                     contract_address,
                     user,
                 } => {
                     let result = self.allowed(contract_address, user)?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 InternalCall::AllowlistEnabled { contract_address } => {
                     let result = self.allowlist_enabled(contract_address)?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 InternalCall::ToggleAllowlist {
                     contract_address,
@@ -578,7 +578,7 @@
                 } => {
                     let result =
                         self.toggle_allowlist(c.caller.clone(), contract_address, enabled)?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 InternalCall::ToggleAllowed {
                     contract_address,
@@ -587,7 +587,7 @@
                 } => {
                     let result =
                         self.toggle_allowed(c.caller.clone(), contract_address, user, allowed)?;
-                    (&result).into_result()
+                    (&result).to_result()
                 }
                 _ => ::core::panicking::panic("internal error: entered unreachable code"),
             }
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -1,10 +1,7 @@
 use core::marker::PhantomData;
 use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};
 use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
-use pallet_evm::{
-	ExitReason, ExitRevert, OnCreate, OnMethodCall, PrecompileOutput, PrecompileResult,
-	PrecompileFailure,
-};
+use pallet_evm::{ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure};
 use sp_core::H160;
 use crate::{
 	AllowlistEnabled, Config, Owner, Pallet, SelfSponsoring, SponsorBasket, SponsoringRateLimit,
@@ -161,7 +158,7 @@
 		if let Some(last_tx_block) = <SponsorBasket<T>>::get(&call.0, who) {
 			let limit = <SponsoringRateLimit<T>>::get(&call.0);
 
-			let timeout = last_tx_block + limit.into();
+			let timeout = last_tx_block + limit;
 			if block_number < timeout {
 				return None;
 			}
modifiedpallets/evm-migration/src/weights.rsdiffbeforeafterboth
--- a/pallets/evm-migration/src/weights.rs
+++ b/pallets/evm-migration/src/weights.rs
@@ -25,6 +25,7 @@
 #![cfg_attr(rustfmt, rustfmt_skip)]
 #![allow(unused_parens)]
 #![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
 
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
 use sp_std::marker::PhantomData;
modifiedpallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-transaction-payment/src/lib.rs
+++ b/pallets/evm-transaction-payment/src/lib.rs
@@ -128,7 +128,7 @@
 				let sponsor = frame_support::storage::with_transaction(|| {
 					TransactionOutcome::Rollback(T::EvmSponsorshipHandler::get_sponsor(
 						&who,
-						&(target.clone(), input.clone()),
+						&(*target, input.clone()),
 					))
 				})?;
 				let sponsor = T::EvmAddressMapping::into_account_id(sponsor);
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -116,7 +116,7 @@
 		);
 
 		with_weight(
-			<Pallet<T>>::transfer(&self, &from, &to, amount),
+			<Pallet<T>>::transfer(self, &from, &to, amount),
 			<CommonWeights<T>>::transfer(),
 		)
 	}
@@ -134,7 +134,7 @@
 		);
 
 		with_weight(
-			<Pallet<T>>::set_allowance(&self, &sender, &spender, amount),
+			<Pallet<T>>::set_allowance(self, &sender, &spender, amount),
 			<CommonWeights<T>>::approve(),
 		)
 	}
@@ -153,7 +153,7 @@
 		);
 
 		with_weight(
-			<Pallet<T>>::transfer_from(&self, &sender, &from, &to, amount),
+			<Pallet<T>>::transfer_from(self, &sender, &from, &to, amount),
 			<CommonWeights<T>>::transfer_from(),
 		)
 	}
@@ -171,7 +171,7 @@
 		);
 
 		with_weight(
-			<Pallet<T>>::burn_from(&self, &sender, &from, amount),
+			<Pallet<T>>::burn_from(self, &sender, &from, amount),
 			<CommonWeights<T>>::burn_from(),
 		)
 	}
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -6,7 +6,6 @@
 use sp_core::{H160, U256};
 use sp_std::vec::Vec;
 use pallet_common::account::CrossAccountId;
-use pallet_common::erc::PrecompileOutput;
 use pallet_evm_coder_substrate::{call, dispatch_to_evm};
 
 use crate::{
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -303,8 +303,8 @@
 		amount: u128,
 	) -> DispatchResult {
 		if collection.access == AccessMode::AllowList {
-			collection.check_allowlist(&owner)?;
-			collection.check_allowlist(&spender)?;
+			collection.check_allowlist(owner)?;
+			collection.check_allowlist(spender)?;
 		}
 
 		if <Balance<T>>::get((collection.id, owner)) < amount {
modifiedpallets/fungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -25,6 +25,7 @@
 #![cfg_attr(rustfmt, rustfmt_skip)]
 #![allow(unused_parens)]
 #![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
 
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
 use sp_std::marker::PhantomData;
@@ -32,11 +33,11 @@
 /// Weight functions needed for pallet_fungible.
 pub trait WeightInfo {
 	fn create_item() -> Weight;
-	fn burn_from() -> Weight;
 	fn burn_item() -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
+	fn burn_from() -> Weight;
 }
 
 /// Weights for pallet_fungible using the Substrate node and recommended hardware.
modifiedpallets/nft/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/nft/src/benchmarking.rs
+++ b/pallets/nft/src/benchmarking.rs
@@ -158,6 +158,7 @@
 			sponsored_data_size: Some(0),
 			token_limit: Some(1),
 			sponsor_transfer_timeout: Some(0),
+			sponsor_approve_timeout: None,
 			owner_can_destroy: Some(true),
 			owner_can_transfer: Some(true),
 			sponsored_data_rate_limit: None,
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -195,7 +195,7 @@
 
 			// Create new collection
 			let new_collection = Collection {
-				owner: who.clone(),
+				owner: who,
 				name: collection_name,
 				mode: mode.clone(),
 				mint_mode: false,
modifiedpallets/nft/src/weights.rsdiffbeforeafterboth
--- a/pallets/nft/src/weights.rs
+++ b/pallets/nft/src/weights.rs
@@ -25,6 +25,7 @@
 #![cfg_attr(rustfmt, rustfmt_skip)]
 #![allow(unused_parens)]
 #![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
 
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
 use sp_std::marker::PhantomData;
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -100,7 +100,7 @@
 		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
 		if amount == 1 {
 			with_weight(
-				<Pallet<T>>::burn(&self, &sender, token),
+				<Pallet<T>>::burn(self, &sender, token),
 				<CommonWeights<T>>::burn_item(),
 			)
 		} else {
@@ -118,7 +118,7 @@
 		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
 		if amount == 1 {
 			with_weight(
-				<Pallet<T>>::transfer(&self, &from, &to, token),
+				<Pallet<T>>::transfer(self, &from, &to, token),
 				<CommonWeights<T>>::transfer(),
 			)
 		} else {
@@ -137,9 +137,9 @@
 
 		with_weight(
 			if amount == 1 {
-				<Pallet<T>>::set_allowance(&self, &sender, token, Some(&spender))
+				<Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))
 			} else {
-				<Pallet<T>>::set_allowance(&self, &sender, token, None)
+				<Pallet<T>>::set_allowance(self, &sender, token, None)
 			},
 			<CommonWeights<T>>::approve(),
 		)
@@ -157,7 +157,7 @@
 
 		if amount == 1 {
 			with_weight(
-				<Pallet<T>>::transfer_from(&self, &sender, &from, &to, token),
+				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token),
 				<CommonWeights<T>>::transfer_from(),
 			)
 		} else {
@@ -176,7 +176,7 @@
 
 		if amount == 1 {
 			with_weight(
-				<Pallet<T>>::burn_from(&self, &sender, &from, token),
+				<Pallet<T>>::burn_from(self, &sender, &from, token),
 				<CommonWeights<T>>::burn_from(),
 			)
 		} else {
@@ -192,7 +192,7 @@
 	) -> DispatchResultWithPostInfo {
 		let len = data.len();
 		with_weight(
-			<Pallet<T>>::set_variable_metadata(&self, &sender, token, data),
+			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),
 			<CommonWeights<T>>::set_variable_metadata(len as u32),
 		)
 	}
@@ -218,12 +218,12 @@
 	}
 	fn const_metadata(&self, token: TokenId) -> Vec<u8> {
 		<TokenData<T>>::get((self.id, token))
-			.map(|t| t.const_data.clone())
+			.map(|t| t.const_data)
 			.unwrap_or_default()
 	}
 	fn variable_metadata(&self, token: TokenId) -> Vec<u8> {
 		<TokenData<T>>::get((self.id, token))
-			.map(|t| t.variable_data.clone())
+			.map(|t| t.variable_data)
 			.unwrap_or_default()
 	}
 
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -13,7 +13,6 @@
 	erc::{CommonEvmHandler, PrecompileResult},
 };
 use pallet_evm_coder_substrate::call;
-use pallet_common::erc::PrecompileOutput;
 
 use crate::{
 	AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -169,8 +169,8 @@
 		sender: &T::CrossAccountId,
 		token: TokenId,
 	) -> DispatchResult {
-		let token_data = <TokenData<T>>::get((collection.id, token))
-			.ok_or_else(|| <CommonError<T>>::TokenNotFound)?;
+		let token_data =
+			<TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
 		ensure!(
 			&token_data.owner == sender
 				|| (collection.limits.owner_can_transfer() && collection.is_owner_or_admin(sender)),
@@ -197,7 +197,7 @@
 				collection.id,
 				token,
 				sender.clone(),
-				old_spender.clone(),
+				old_spender,
 				0,
 			));
 		}
@@ -213,7 +213,7 @@
 			token_data.owner,
 			1,
 		));
-		return Ok(());
+		Ok(())
 	}
 
 	pub fn transfer(
@@ -227,8 +227,8 @@
 			<CommonError<T>>::TransferNotAllowed
 		);
 
-		let token_data = <TokenData<T>>::get((collection.id, token))
-			.ok_or_else(|| <CommonError<T>>::TokenNotFound)?;
+		let token_data =
+			<TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
 		ensure!(
 			&token_data.owner == from
 				|| (collection.limits.owner_can_transfer() && collection.is_owner_or_admin(from)),
@@ -399,7 +399,7 @@
 						collection.id,
 						token,
 						sender.clone(),
-						old_owner.clone(),
+						old_owner,
 						0,
 					));
 				}
@@ -429,7 +429,7 @@
 					collection.id,
 					token,
 					sender.clone(),
-					old_spender.clone(),
+					old_spender,
 					0,
 				));
 			}
@@ -443,9 +443,9 @@
 		spender: Option<&T::CrossAccountId>,
 	) -> DispatchResult {
 		if collection.access == AccessMode::AllowList {
-			collection.check_allowlist(&sender)?;
+			collection.check_allowlist(sender)?;
 			if let Some(spender) = spender {
-				collection.check_allowlist(&spender)?;
+				collection.check_allowlist(spender)?;
 			}
 		}
 
@@ -491,7 +491,7 @@
 
 		// =========
 
-		Self::transfer(collection, &from, to, token)?;
+		Self::transfer(collection, from, to, token)?;
 		// Allowance is reset in [`transfer`]
 		Ok(())
 	}
@@ -519,7 +519,7 @@
 
 		// =========
 
-		Self::burn(collection, &from, token)
+		Self::burn(collection, from, token)
 	}
 
 	pub fn set_variable_metadata(
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -25,6 +25,7 @@
 #![cfg_attr(rustfmt, rustfmt_skip)]
 #![allow(unused_parens)]
 #![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
 
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
 use sp_std::marker::PhantomData;
@@ -33,11 +34,11 @@
 pub trait WeightInfo {
 	fn create_item() -> Weight;
 	fn create_multiple_items(b: u32, ) -> Weight;
-	fn burn_from() -> Weight;
 	fn burn_item() -> Weight;
 	fn transfer() -> Weight;
 	fn approve() -> Weight;
 	fn transfer_from() -> Weight;
+	fn burn_from() -> Weight;
 	fn set_variable_metadata(b: u32, ) -> Weight;
 }
 
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -135,7 +135,7 @@
 		amount: u128,
 	) -> DispatchResultWithPostInfo {
 		with_weight(
-			<Pallet<T>>::transfer(&self, &from, &to, token, amount),
+			<Pallet<T>>::transfer(self, &from, &to, token, amount),
 			<CommonWeights<T>>::transfer(),
 		)
 	}
@@ -148,7 +148,7 @@
 		amount: u128,
 	) -> DispatchResultWithPostInfo {
 		with_weight(
-			<Pallet<T>>::set_allowance(&self, &sender, &spender, token, amount),
+			<Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),
 			<CommonWeights<T>>::approve(),
 		)
 	}
@@ -162,7 +162,7 @@
 		amount: u128,
 	) -> DispatchResultWithPostInfo {
 		with_weight(
-			<Pallet<T>>::transfer_from(&self, &sender, &from, &to, token, amount),
+			<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount),
 			<CommonWeights<T>>::transfer_from(),
 		)
 	}
@@ -175,7 +175,7 @@
 		amount: u128,
 	) -> DispatchResultWithPostInfo {
 		with_weight(
-			<Pallet<T>>::burn_from(&self, &sender, &from, token, amount),
+			<Pallet<T>>::burn_from(self, &sender, &from, token, amount),
 			<CommonWeights<T>>::burn_from(),
 		)
 	}
@@ -188,7 +188,7 @@
 	) -> DispatchResultWithPostInfo {
 		let len = data.len();
 		with_weight(
-			<Pallet<T>>::set_variable_metadata(&self, &sender, token, data),
+			<Pallet<T>>::set_variable_metadata(self, &sender, token, data),
 			<CommonWeights<T>>::set_variable_metadata(len as u32),
 		)
 	}
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -189,7 +189,7 @@
 		<Balance<T>>::remove_prefix((collection.id, token_id), None);
 		<Allowance<T>>::remove_prefix((collection.id, token_id), None);
 		// TODO: ERC721 transfer event
-		return Ok(());
+		Ok(())
 	}
 
 	pub fn burn(
@@ -367,8 +367,8 @@
 			collection.check_allowlist(sender)?;
 
 			for item in data.iter() {
-				for (user, _) in &item.users {
-					collection.check_allowlist(&user)?;
+				for user in item.users.keys() {
+					collection.check_allowlist(user)?;
 				}
 			}
 		}
@@ -409,7 +409,7 @@
 
 		let mut balances = BTreeMap::new();
 		for data in &data {
-			for (owner, _) in &data.users {
+			for owner in data.users.keys() {
 				let balance = balances
 					.entry(owner)
 					.or_insert_with(|| <AccountBalance<T>>::get((collection.id, owner)));
@@ -483,8 +483,8 @@
 		amount: u128,
 	) -> DispatchResult {
 		if collection.access == AccessMode::AllowList {
-			collection.check_allowlist(&sender)?;
-			collection.check_allowlist(&spender)?;
+			collection.check_allowlist(sender)?;
+			collection.check_allowlist(spender)?;
 		}
 
 		<PalletCommon<T>>::ensure_correct_receiver(spender)?;
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -25,6 +25,7 @@
 #![cfg_attr(rustfmt, rustfmt_skip)]
 #![allow(unused_parens)]
 #![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
 
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
 use sp_std::marker::PhantomData;
@@ -33,7 +34,6 @@
 pub trait WeightInfo {
 	fn create_item() -> Weight;
 	fn create_multiple_items(b: u32, ) -> Weight;
-	fn burn_from() -> Weight;
 	fn burn_item_partial() -> Weight;
 	fn burn_item_fully() -> Weight;
 	fn transfer_normal() -> Weight;
@@ -45,6 +45,7 @@
 	fn transfer_from_creating() -> Weight;
 	fn transfer_from_removing() -> Weight;
 	fn transfer_from_creating_removing() -> Weight;
+	fn burn_from() -> Weight;
 	fn set_variable_metadata(b: u32, ) -> Weight;
 }
 
modifiedprimitives/nft/src/lib.rsdiffbeforeafterboth
--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -327,8 +327,7 @@
 		D: ser::Serializer,
 		V: Serialize,
 	{
-		let vec: &Vec<_> = &value;
-		vec.serialize(serializer)
+		(value as &Vec<_>).serialize(serializer)
 	}
 
 	pub fn deserialize<'de, D, V, S>(deserializer: D) -> Result<BoundedVec<V, S>, D::Error>
modifiedruntime/src/lib.rsdiffbeforeafterboth
before · runtime/src/lib.rs
1//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};19// #[cfg(any(feature = "std", test))]20// pub use sp_runtime::BuildStorage;2122use sp_runtime::{23	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,24	traits::{25		AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify, AccountIdConversion,26	},27	transaction_validity::{TransactionSource, TransactionValidity},28	ApplyExtrinsicResult, MultiSignature,29};3031use sp_std::prelude::*;3233#[cfg(feature = "std")]34use sp_version::NativeVersion;35use sp_version::RuntimeVersion;36pub use pallet_transaction_payment::{37	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,38};39// A few exports that help ease life for downstream crates.40pub use pallet_balances::Call as BalancesCall;41pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};42pub use frame_support::{43	construct_runtime, match_type,44	dispatch::DispatchResult,45	PalletId, parameter_types, StorageValue, ConsensusEngineId,46	traits::{47		Everything, Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem,48		LockIdentifier, 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 nft_data_structs::*;57// use pallet_contracts::weights::WeightInfo;58// #[cfg(any(feature = "std", test))]59use frame_system::{60	self as 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_core::crypto::Public;71use sp_runtime::{72	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf},73	transaction_validity::TransactionValidityError,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, IsConcrete, LocationInverter, NativeAsset,86	ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,87	SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,88	SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,89};90use xcm_executor::{Config, XcmExecutor};9192// mod chain_extension;93// use crate::chain_extension::{NFTExtension, Imbalance};9495/// An index to a block.96pub type BlockNumber = u32;9798/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.99pub type Signature = MultiSignature;100101/// Some way of identifying an account on the chain. We intentionally make it equivalent102/// to the public key of our transaction signing scheme.103pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;104105pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;106107/// The type for looking up accounts. We don't expect more than 4 billion of them, but you108/// never know...109pub type AccountIndex = u32;110111/// Balance of an account.112pub type Balance = u128;113114/// Index of a transaction in the chain.115pub type Index = u32;116117/// A hash of some data used by the chain.118pub type Hash = sp_core::H256;119120/// Digest item type.121pub type DigestItem = generic::DigestItem<Hash>;122123/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know124/// the specifics of the runtime. They can then be made to be agnostic over specific formats125/// of data like extrinsics, allowing for them to continue syncing the network through upgrades126/// to even the core data structures.127pub mod opaque {128	use super::*;129130	pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;131132	/// Opaque block type.133	pub type Block = generic::Block<Header, UncheckedExtrinsic>;134135	pub type SessionHandlers = ();136137	impl_opaque_keys! {138		pub struct SessionKeys {139			pub aura: Aura,140		}141	}142}143144/// This runtime version.145pub const VERSION: RuntimeVersion = RuntimeVersion {146	spec_name: create_runtime_str!("opal"),147	impl_name: create_runtime_str!("opal"),148	authoring_version: 1,149	spec_version: 912202,150	impl_version: 1,151	apis: RUNTIME_API_VERSIONS,152	transaction_version: 1,153};154155pub const MILLISECS_PER_BLOCK: u64 = 12000;156157pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;158159// These time units are defined in number of blocks.160pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);161pub const HOURS: BlockNumber = MINUTES * 60;162pub const DAYS: BlockNumber = HOURS * 24;163164parameter_types! {165	pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;166}167168#[derive(codec::Encode, codec::Decode)]169pub enum XCMPMessage<XAccountId, XBalance> {170	/// Transfer tokens to the given account from the Parachain account.171	TransferToken(XAccountId, XBalance),172}173174/// The version information used to identify this runtime when compiled natively.175#[cfg(feature = "std")]176pub fn native_version() -> NativeVersion {177	NativeVersion {178		runtime_version: VERSION,179		can_author_with: Default::default(),180	}181}182183type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;184185pub struct DealWithFees;186impl OnUnbalanced<NegativeImbalance> for DealWithFees {187	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {188		if let Some(fees) = fees_then_tips.next() {189			// for fees, 100% to treasury190			let mut split = fees.ration(100, 0);191			if let Some(tips) = fees_then_tips.next() {192				// for tips, if any, 100% to treasury193				tips.ration_merge_into(100, 0, &mut split);194			}195			Treasury::on_unbalanced(split.0);196			// Author::on_unbalanced(split.1);197		}198	}199}200201/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.202/// This is used to limit the maximal weight of a single extrinsic.203const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);204/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used205/// by  Operational  extrinsics.206const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);207/// We allow for 2 seconds of compute with a 6 second average block time.208const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;209210parameter_types! {211	pub const BlockHashCount: BlockNumber = 2400;212	pub RuntimeBlockLength: BlockLength =213		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);214	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);215	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;216	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()217		.base_block(BlockExecutionWeight::get())218		.for_class(DispatchClass::all(), |weights| {219			weights.base_extrinsic = ExtrinsicBaseWeight::get();220		})221		.for_class(DispatchClass::Normal, |weights| {222			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);223		})224		.for_class(DispatchClass::Operational, |weights| {225			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);226			// Operational transactions have some extra reserved space, so that they227			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.228			weights.reserved = Some(229				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT230			);231		})232		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)233		.build_or_panic();234	pub const Version: RuntimeVersion = VERSION;235	pub const SS58Prefix: u8 = 42;236}237238parameter_types! {239	pub const ChainId: u64 = 8888;240}241242pub struct FixedFee;243impl FeeCalculator for FixedFee {244	fn min_gas_price() -> U256 {245		// Targeting 0.15 UNQ per transfer246		1_024_947_215u32.into()247	}248}249250// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case251// (contract, which only writes a lot of data),252// approximating on top of our real store write weight253parameter_types! {254	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;255	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;256	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();257}258259/// Limiting EVM execution to 50% of block for substrate users and management tasks260/// EVM transaction consumes more weight than substrate's, so we can't rely on them being261/// scheduled fairly262const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);263parameter_types! {264	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());265}266267pub enum FixedGasWeightMapping {}268impl GasWeightMapping for FixedGasWeightMapping {269	fn gas_to_weight(gas: u64) -> Weight {270		gas.saturating_mul(WeightPerGas::get())271	}272	fn weight_to_gas(weight: Weight) -> u64 {273		weight / WeightPerGas::get()274	}275}276277impl pallet_evm::Config for Runtime {278	type BlockGasLimit = BlockGasLimit;279	type FeeCalculator = FixedFee;280	type GasWeightMapping = FixedGasWeightMapping;281	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;282	type CallOrigin = EnsureAddressTruncated;283	type WithdrawOrigin = EnsureAddressTruncated;284	type AddressMapping = HashedAddressMapping<Self::Hashing>;285	type Precompiles = ();286	type Currency = Balances;287	type Event = Event;288	type OnMethodCall = (289		pallet_evm_migration::OnMethodCall<Self>,290		pallet_nft::NftErcSupport<Self>,291		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,292	);293	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;294	type ChainId = ChainId;295	type Runner = pallet_evm::runner::stack::Runner<Self>;296	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;297	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;298	type FindAuthor = EthereumFindAuthor<Aura>;299}300301impl pallet_evm_migration::Config for Runtime {302	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;303}304305pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);306impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {307	fn find_author<'a, I>(digests: I) -> Option<H160>308	where309		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,310	{311		if let Some(author_index) = F::find_author(digests) {312			let authority_id = Aura::authorities()[author_index as usize].clone();313			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));314		}315		None316	}317}318319impl pallet_ethereum::Config for Runtime {320	type Event = Event;321	type StateRoot = pallet_ethereum::IntermediateStateRoot;322}323324impl pallet_randomness_collective_flip::Config for Runtime {}325326impl system::Config for Runtime {327	/// The data to be stored in an account.328	type AccountData = pallet_balances::AccountData<Balance>;329	/// The identifier used to distinguish between accounts.330	type AccountId = AccountId;331	/// The basic call filter to use in dispatchable.332	type BaseCallFilter = Everything;333	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).334	type BlockHashCount = BlockHashCount;335	/// The maximum length of a block (in bytes).336	type BlockLength = RuntimeBlockLength;337	/// The index type for blocks.338	type BlockNumber = BlockNumber;339	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.340	type BlockWeights = RuntimeBlockWeights;341	/// The aggregated dispatch type that is available for extrinsics.342	type Call = Call;343	/// The weight of database operations that the runtime can invoke.344	type DbWeight = RocksDbWeight;345	/// The ubiquitous event type.346	type Event = Event;347	/// The type for hashing blocks and tries.348	type Hash = Hash;349	/// The hashing algorithm used.350	type Hashing = BlakeTwo256;351	/// The header type.352	type Header = generic::Header<BlockNumber, BlakeTwo256>;353	/// The index type for storing how many extrinsics an account has signed.354	type Index = Index;355	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.356	type Lookup = AccountIdLookup<AccountId, ()>;357	/// What to do if an account is fully reaped from the system.358	type OnKilledAccount = ();359	/// What to do if a new account is created.360	type OnNewAccount = ();361	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;362	/// The ubiquitous origin type.363	type Origin = Origin;364	/// This type is being generated by `construct_runtime!`.365	type PalletInfo = PalletInfo;366	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.367	type SS58Prefix = SS58Prefix;368	/// Weight information for the extrinsics of this pallet.369	type SystemWeightInfo = system::weights::SubstrateWeight<Self>;370	/// Version of the runtime.371	type Version = Version;372}373374parameter_types! {375	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;376}377378impl pallet_timestamp::Config for Runtime {379	/// A timestamp: milliseconds since the unix epoch.380	type Moment = u64;381	type OnTimestampSet = ();382	type MinimumPeriod = MinimumPeriod;383	type WeightInfo = ();384}385386parameter_types! {387	// pub const ExistentialDeposit: u128 = 500;388	pub const ExistentialDeposit: u128 = 0;389	pub const MaxLocks: u32 = 50;390}391392impl pallet_balances::Config for Runtime {393	type MaxLocks = MaxLocks;394	type MaxReserves = ();395	type ReserveIdentifier = [u8; 8];396	/// The type for recording an account's balance.397	type Balance = Balance;398	/// The ubiquitous event type.399	type Event = Event;400	type DustRemoval = Treasury;401	type ExistentialDeposit = ExistentialDeposit;402	type AccountStore = System;403	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;404}405406pub const MICROUNIQUE: Balance = 1_000_000_000;407pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;408pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;409pub const UNIQUE: Balance = 100 * CENTIUNIQUE;410411pub const fn deposit(items: u32, bytes: u32) -> Balance {412	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE413}414415/*416parameter_types! {417	pub TombstoneDeposit: Balance = deposit(418		1,419		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,420	);421	pub DepositPerContract: Balance = TombstoneDeposit::get();422	pub const DepositPerStorageByte: Balance = deposit(0, 1);423	pub const DepositPerStorageItem: Balance = deposit(1, 0);424	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);425	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;426	pub const SignedClaimHandicap: u32 = 2;427	pub const MaxDepth: u32 = 32;428	pub const MaxValueSize: u32 = 16 * 1024;429	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb430	// The lazy deletion runs inside on_initialize.431	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *432		RuntimeBlockWeights::get().max_block;433	// The weight needed for decoding the queue should be less or equal than a fifth434	// of the overall weight dedicated to the lazy deletion.435	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (436			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -437			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)438		)) / 5) as u32;439	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();440}441442impl pallet_contracts::Config for Runtime {443	type Time = Timestamp;444	type Randomness = RandomnessCollectiveFlip;445	type Currency = Balances;446	type Event = Event;447	type RentPayment = ();448	type SignedClaimHandicap = SignedClaimHandicap;449	type TombstoneDeposit = TombstoneDeposit;450	type DepositPerContract = DepositPerContract;451	type DepositPerStorageByte = DepositPerStorageByte;452	type DepositPerStorageItem = DepositPerStorageItem;453	type RentFraction = RentFraction;454	type SurchargeReward = SurchargeReward;455	type WeightPrice = pallet_transaction_payment::Pallet<Self>;456	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;457	type ChainExtension = NFTExtension;458	type DeletionQueueDepth = DeletionQueueDepth;459	type DeletionWeightLimit = DeletionWeightLimit;460	type Schedule = Schedule;461	type CallStack = [pallet_contracts::Frame<Self>; 31];462}463*/464465parameter_types! {466	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer467	/// This value increases the priority of `Operational` transactions by adding468	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.469	pub const OperationalFeeMultiplier: u8 = 5;470}471472/// Linear implementor of `WeightToFeePolynomial`473pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);474475impl<T> WeightToFeePolynomial for LinearFee<T>476where477	T: BaseArithmetic + From<u32> + Copy + Unsigned,478{479	type Balance = T;480481	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {482		smallvec!(WeightToFeeCoefficient {483			// Targeting 0.1 Unique per NFT transfer484			coeff_integer: 142_688u32.into(),485			coeff_frac: Perbill::zero(),486			negative: false,487			degree: 1,488		})489	}490}491492impl pallet_transaction_payment::Config for Runtime {493	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;494	type TransactionByteFee = TransactionByteFee;495	type OperationalFeeMultiplier = OperationalFeeMultiplier;496	type WeightToFee = LinearFee<Balance>;497	type FeeMultiplierUpdate = ();498}499500parameter_types! {501	pub const ProposalBond: Permill = Permill::from_percent(5);502	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;503	pub const SpendPeriod: BlockNumber = 5 * MINUTES;504	pub const Burn: Permill = Permill::from_percent(0);505	pub const TipCountdown: BlockNumber = 1 * DAYS;506	pub const TipFindersFee: Percent = Percent::from_percent(20);507	pub const TipReportDepositBase: Balance = 1 * UNIQUE;508	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;509	pub const BountyDepositBase: Balance = 1 * UNIQUE;510	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;511	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");512	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;513	pub const MaximumReasonLength: u32 = 16384;514	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);515	pub const BountyValueMinimum: Balance = 5 * UNIQUE;516	pub const MaxApprovals: u32 = 100;517}518519impl pallet_treasury::Config for Runtime {520	type PalletId = TreasuryModuleId;521	type Currency = Balances;522	type ApproveOrigin = EnsureRoot<AccountId>;523	type RejectOrigin = EnsureRoot<AccountId>;524	type Event = Event;525	type OnSlash = ();526	type ProposalBond = ProposalBond;527	type ProposalBondMinimum = ProposalBondMinimum;528	type SpendPeriod = SpendPeriod;529	type Burn = Burn;530	type BurnDestination = ();531	type SpendFunds = ();532	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;533	type MaxApprovals = MaxApprovals;534}535536impl pallet_sudo::Config for Runtime {537	type Event = Event;538	type Call = Call;539}540541pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);542543impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider544	for RelayChainBlockNumberProvider<T>545{546	type BlockNumber = BlockNumber;547548	fn current_block_number() -> Self::BlockNumber {549		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()550			.map(|d| d.relay_parent_number)551			.unwrap_or_default()552	}553}554555parameter_types! {556	pub const MinVestedTransfer: Balance = 10 * UNIQUE;557	pub const MaxVestingSchedules: u32 = 28;558}559560impl orml_vesting::Config for Runtime {561	type Event = Event;562	type Currency = pallet_balances::Pallet<Runtime>;563	type MinVestedTransfer = MinVestedTransfer;564	type VestedTransferOrigin = EnsureSigned<AccountId>;565	type WeightInfo = ();566	type MaxVestingSchedules = MaxVestingSchedules;567	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;568}569570parameter_types! {571	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;572	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;573}574575impl cumulus_pallet_parachain_system::Config for Runtime {576	type Event = Event;577	type OnValidationData = ();578	type SelfParaId = parachain_info::Pallet<Self>;579	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<580	// 	MaxDownwardMessageWeight,581	// 	XcmExecutor<XcmConfig>,582	// 	Call,583	// >;584	type OutboundXcmpMessageSource = XcmpQueue;585	type DmpMessageHandler = DmpQueue;586	type ReservedDmpWeight = ReservedDmpWeight;587	type ReservedXcmpWeight = ReservedXcmpWeight;588	type XcmpMessageHandler = XcmpQueue;589}590591impl parachain_info::Config for Runtime {}592593impl cumulus_pallet_aura_ext::Config for Runtime {}594595parameter_types! {596	pub const RelayLocation: MultiLocation = MultiLocation::parent();597	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;598	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();599	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();600}601602/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used603/// when determining ownership of accounts for asset transacting and when attempting to use XCM604/// `Transact` in order to determine the dispatch Origin.605pub type LocationToAccountId = (606	// The parent (Relay-chain) origin converts to the default `AccountId`.607	ParentIsDefault<AccountId>,608	// Sibling parachain origins convert to AccountId via the `ParaId::into`.609	SiblingParachainConvertsVia<Sibling, AccountId>,610	// Straight up local `AccountId32` origins just alias directly to `AccountId`.611	AccountId32Aliases<RelayNetwork, AccountId>,612);613614/// Means for transacting assets on this chain.615pub type LocalAssetTransactor = CurrencyAdapter<616	// Use this currency:617	Balances,618	// Use this currency when it is a fungible asset matching the given location or name:619	IsConcrete<RelayLocation>,620	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:621	LocationToAccountId,622	// Our chain's account ID type (we can't get away without mentioning it explicitly):623	AccountId,624	// We don't track any teleports.625	(),626>;627628/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,629/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can630/// biases the kind of local `Origin` it will become.631pub type XcmOriginToTransactDispatchOrigin = (632	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location633	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for634	// foreign chains who want to have a local sovereign account on this chain which they control.635	SovereignSignedViaLocation<LocationToAccountId, Origin>,636	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when637	// recognised.638	RelayChainAsNative<RelayOrigin, Origin>,639	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when640	// recognised.641	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,642	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a643	// transaction from the Root origin.644	ParentAsSuperuser<Origin>,645	// Native signed account converter; this just converts an `AccountId32` origin into a normal646	// `Origin::Signed` origin of the same 32-byte value.647	SignedAccountId32AsNative<RelayNetwork, Origin>,648	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.649	XcmPassthrough<Origin>,650);651652parameter_types! {653	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.654	pub UnitWeightCost: Weight = 1_000_000;655	// 1200 UNIQUEs buy 1 second of weight.656	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);657	pub const MaxInstructions: u32 = 100;658	pub const MaxAuthorities: u32 = 100_000;659}660661match_type! {662	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {663		MultiLocation { parents: 1, interior: Here } |664		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }665	};666}667668pub type Barrier = (669	TakeWeightCredit,670	AllowTopLevelPaidExecutionFrom<Everything>,671	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,672	// ^^^ Parent & its unit plurality gets free execution673);674675pub struct XcmConfig;676impl Config for XcmConfig {677	type Call = Call;678	type XcmSender = XcmRouter;679	// How to withdraw and deposit an asset.680	type AssetTransactor = LocalAssetTransactor;681	type OriginConverter = XcmOriginToTransactDispatchOrigin;682	type IsReserve = NativeAsset;683	type IsTeleporter = (); // Teleportation is disabled684	type LocationInverter = LocationInverter<Ancestry>;685	type Barrier = Barrier;686	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;687	type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;688	type ResponseHandler = (); // Don't handle responses for now.689	type SubscriptionService = PolkadotXcm;690691	type AssetTrap = PolkadotXcm;692	type AssetClaims = PolkadotXcm;693}694695// parameter_types! {696// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;697// }698699/// No local origins on this chain are allowed to dispatch XCM sends/executions.700pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);701702/// The means for routing XCM messages which are not for local execution into the right message703/// queues.704pub type XcmRouter = (705	// Two routers - use UMP to communicate with the relay chain:706	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,707	// ..and XCMP to communicate with the sibling chains.708	XcmpQueue,709);710711impl pallet_evm_coder_substrate::Config for Runtime {712	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;713	type GasWeightMapping = FixedGasWeightMapping;714}715716impl pallet_xcm::Config for Runtime {717	type Event = Event;718	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;719	type XcmRouter = XcmRouter;720	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;721	type XcmExecuteFilter = Everything;722	type XcmExecutor = XcmExecutor<XcmConfig>;723	type XcmTeleportFilter = Everything;724	type XcmReserveTransferFilter = Everything;725	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;726	type LocationInverter = LocationInverter<Ancestry>;727	type Origin = Origin;728	type Call = Call;729	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;730	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;731}732733impl cumulus_pallet_xcm::Config for Runtime {734	type Event = Event;735	type XcmExecutor = XcmExecutor<XcmConfig>;736}737738impl cumulus_pallet_xcmp_queue::Config for Runtime {739	type Event = Event;740	type XcmExecutor = XcmExecutor<XcmConfig>;741	type ChannelInfo = ParachainSystem;742	type VersionWrapper = ();743}744745impl cumulus_pallet_dmp_queue::Config for Runtime {746	type Event = Event;747	type XcmExecutor = XcmExecutor<XcmConfig>;748	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;749}750751impl pallet_aura::Config for Runtime {752	type AuthorityId = AuraId;753	type DisabledValidators = ();754	type MaxAuthorities = MaxAuthorities;755}756757parameter_types! {758	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();759	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;760}761762impl pallet_common::Config for Runtime {763	type Event = Event;764	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;765	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;766	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;767768	type Currency = Balances;769	type CollectionCreationPrice = CollectionCreationPrice;770	type TreasuryAccountId = TreasuryAccountId;771}772773impl pallet_fungible::Config for Runtime {774	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;775}776impl pallet_refungible::Config for Runtime {777	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;778}779impl pallet_nonfungible::Config for Runtime {780	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;781}782783/// Used for the pallet nft in `./nft.rs`784impl pallet_nft::Config for Runtime {785	type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;786}787788parameter_types! {789	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied790}791792/// Used for the pallet inflation793impl pallet_inflation::Config for Runtime {794	type Currency = Balances;795	type TreasuryAccountId = TreasuryAccountId;796	type InflationBlockInterval = InflationBlockInterval;797}798799// parameter_types! {800// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *801// 		RuntimeBlockWeights::get().max_block;802// 	pub const MaxScheduledPerBlock: u32 = 50;803// }804805type EvmSponsorshipHandler = (806	pallet_nft::NftEthSponsorshipHandler<Runtime>,807	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,808);809type SponsorshipHandler = (810	pallet_nft::NftSponsorshipHandler<Runtime>,811	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,812	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,813);814815// impl pallet_unq_scheduler::Config for Runtime {816// 	type Event = Event;817// 	type Origin = Origin;818// 	type PalletsOrigin = OriginCaller;819// 	type Call = Call;820// 	type MaximumWeight = MaximumSchedulerWeight;821// 	type ScheduleOrigin = EnsureSigned<AccountId>;822// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;823// 	type SponsorshipHandler = SponsorshipHandler;824// 	type WeightInfo = ();825// }826827impl pallet_evm_transaction_payment::Config for Runtime {828	type EvmSponsorshipHandler = EvmSponsorshipHandler;829	type Currency = Balances;830	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;831	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;832}833834impl pallet_nft_charge_transaction::Config for Runtime {835	type SponsorshipHandler = SponsorshipHandler;836}837838// impl pallet_contract_helpers::Config for Runtime {839//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;840// }841842parameter_types! {843	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049844	pub const HelpersContractAddress: H160 = H160([845		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,846	]);847}848849impl pallet_evm_contract_helpers::Config for Runtime {850	type ContractAddress = HelpersContractAddress;851	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;852}853854construct_runtime!(855	pub enum Runtime where856		Block = Block,857		NodeBlock = opaque::Block,858		UncheckedExtrinsic = UncheckedExtrinsic859	{860		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,861		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,862863		Aura: pallet_aura::{Pallet, Config<T>} = 22,864		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,865866		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,867		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,868		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,869		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,870		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,871		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,872		System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,873		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,874		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,875		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,876877		// XCM helpers.878		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,879		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,880		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,881		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,882883		// Unique Pallets884		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,885		Nft: pallet_nft::{Pallet, Call, Storage} = 61,886		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,887		// free = 63888		Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage } = 64,889		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,890		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,891		Fungible: pallet_fungible::{Pallet, Storage} = 67,892		Refungible: pallet_refungible::{Pallet, Storage} = 68,893		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,894895		// Frontier896		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,897		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,898899		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,900		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,901		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,902		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,903	}904);905906pub struct TransactionConverter;907908impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {909	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {910		UncheckedExtrinsic::new_unsigned(911			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),912		)913	}914}915916impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {917	fn convert_transaction(918		&self,919		transaction: pallet_ethereum::Transaction,920	) -> opaque::UncheckedExtrinsic {921		let extrinsic = UncheckedExtrinsic::new_unsigned(922			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),923		);924		let encoded = extrinsic.encode();925		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])926			.expect("Encoded extrinsic is always valid")927	}928}929930/// The address format for describing accounts.931pub type Address = sp_runtime::MultiAddress<AccountId, ()>;932/// Block header type as expected by this runtime.933pub type Header = generic::Header<BlockNumber, BlakeTwo256>;934/// Block type as expected by this runtime.935pub type Block = generic::Block<Header, UncheckedExtrinsic>;936/// A Block signed with a Justification937pub type SignedBlock = generic::SignedBlock<Block>;938/// BlockId type as expected by this runtime.939pub type BlockId = generic::BlockId<Block>;940/// The SignedExtension to the basic transaction logic.941pub type SignedExtra = (942	system::CheckSpecVersion<Runtime>,943	// system::CheckTxVersion<Runtime>,944	system::CheckGenesis<Runtime>,945	system::CheckEra<Runtime>,946	system::CheckNonce<Runtime>,947	system::CheckWeight<Runtime>,948	pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,949	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,950);951/// Unchecked extrinsic type as expected by this runtime.952pub type UncheckedExtrinsic =953	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;954/// Extrinsic type that has already been checked.955pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;956/// Executive: handles dispatch to the various modules.957pub type Executive = frame_executive::Executive<958	Runtime,959	Block,960	frame_system::ChainContext<Runtime>,961	Runtime,962	AllPallets,963>;964965impl_opaque_keys! {966	pub struct SessionKeys {967		pub aura: Aura,968	}969}970971impl fp_self_contained::SelfContainedCall for Call {972	type SignedInfo = H160;973974	fn is_self_contained(&self) -> bool {975		match self {976			Call::Ethereum(call) => call.is_self_contained(),977			_ => false,978		}979	}980981	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {982		match self {983			Call::Ethereum(call) => call.check_self_contained(),984			_ => None,985		}986	}987988	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {989		match self {990			Call::Ethereum(call) => call.validate_self_contained(info),991			_ => None,992		}993	}994995	fn pre_dispatch_self_contained(996		&self,997		info: &Self::SignedInfo,998	) -> Option<Result<(), TransactionValidityError>> {999		match self {1000			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1001			_ => None,1002		}1003	}10041005	fn apply_self_contained(1006		self,1007		info: Self::SignedInfo,1008	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1009		match self {1010			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1011				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1012			)),1013			_ => None,1014		}1015	}1016}10171018macro_rules! dispatch_nft_runtime {1019	($collection:ident.$method:ident($($name:ident),*)) => {{1020		use pallet_nft::dispatch::Dispatched;10211022		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::new($collection).unwrap());1023		let dispatch = collection.as_dyn();10241025		dispatch.$method($($name),*)1026	}};1027}1028impl_runtime_apis! {1029	impl up_rpc::NftApi<Block, CrossAccountId, AccountId>1030		for Runtime1031	{1032		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId> {1033			dispatch_nft_runtime!(collection.account_tokens(account))1034		}1035		fn token_exists(collection: CollectionId, token: TokenId) -> bool {1036			dispatch_nft_runtime!(collection.token_exists(token))1037		}10381039		fn token_owner(collection: CollectionId, token: TokenId) -> CrossAccountId {1040			dispatch_nft_runtime!(collection.token_owner(token))1041		}1042		fn const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1043			dispatch_nft_runtime!(collection.const_metadata(token))1044		}1045		fn variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1046			dispatch_nft_runtime!(collection.variable_metadata(token))1047		}10481049		fn collection_tokens(collection: CollectionId) -> u32 {1050			dispatch_nft_runtime!(collection.collection_tokens())1051		}1052		fn account_balance(collection: CollectionId, account: CrossAccountId) -> u32 {1053			dispatch_nft_runtime!(collection.account_balance(account))1054		}1055		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> u128 {1056			dispatch_nft_runtime!(collection.balance(account, token))1057		}1058		fn allowance(1059			collection: CollectionId,1060			sender: CrossAccountId,1061			spender: CrossAccountId,1062			token: TokenId,1063		) -> u128 {1064			dispatch_nft_runtime!(collection.allowance(sender, spender, token))1065		}10661067		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1068			<pallet_nft::NftErcSupport<Runtime>>::get_code(&account)1069				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1070				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1071		}1072		fn adminlist(collection: CollectionId) -> Vec<CrossAccountId> {1073			<pallet_common::Pallet<Runtime>>::adminlist(collection)1074		}1075		fn allowlist(collection: CollectionId) -> Vec<CrossAccountId> {1076			<pallet_common::Pallet<Runtime>>::allowlist(collection)1077		}1078		fn allowed(collection: CollectionId, user: CrossAccountId) -> bool {1079			<pallet_common::Pallet<Runtime>>::allowed(collection, user)1080		}1081		fn last_token_id(collection: CollectionId) -> TokenId {1082			dispatch_nft_runtime!(collection.last_token_id())1083		}1084		fn collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>> {1085			<pallet_common::CollectionById<Runtime>>::get(collection)1086		}1087		fn collection_stats() -> CollectionStats {1088			<pallet_common::Pallet<Runtime>>::collection_stats()1089		}1090	}10911092	impl sp_api::Core<Block> for Runtime {1093		fn version() -> RuntimeVersion {1094			VERSION1095		}10961097		fn execute_block(block: Block) {1098			Executive::execute_block(block)1099		}11001101		fn initialize_block(header: &<Block as BlockT>::Header) {1102			Executive::initialize_block(header)1103		}1104	}11051106	impl sp_api::Metadata<Block> for Runtime {1107		fn metadata() -> OpaqueMetadata {1108			OpaqueMetadata::new(Runtime::metadata().into())1109		}1110	}11111112	impl sp_block_builder::BlockBuilder<Block> for Runtime {1113		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1114			Executive::apply_extrinsic(extrinsic)1115		}11161117		fn finalize_block() -> <Block as BlockT>::Header {1118			Executive::finalize_block()1119		}11201121		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1122			data.create_extrinsics()1123		}11241125		fn check_inherents(1126			block: Block,1127			data: sp_inherents::InherentData,1128		) -> sp_inherents::CheckInherentsResult {1129			data.check_extrinsics(&block)1130		}11311132		// fn random_seed() -> <Block as BlockT>::Hash {1133		//     RandomnessCollectiveFlip::random_seed().01134		// }1135	}11361137	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1138		fn validate_transaction(1139			source: TransactionSource,1140			tx: <Block as BlockT>::Extrinsic,1141			hash: <Block as BlockT>::Hash,1142		) -> TransactionValidity {1143			Executive::validate_transaction(source, tx, hash)1144		}1145	}11461147	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1148		fn offchain_worker(header: &<Block as BlockT>::Header) {1149			Executive::offchain_worker(header)1150		}1151	}11521153	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1154		fn chain_id() -> u64 {1155			<Runtime as pallet_evm::Config>::ChainId::get()1156		}11571158		fn account_basic(address: H160) -> EVMAccount {1159			EVM::account_basic(&address)1160		}11611162		fn gas_price() -> U256 {1163			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1164		}11651166		fn account_code_at(address: H160) -> Vec<u8> {1167			EVM::account_codes(address)1168		}11691170		fn author() -> H160 {1171			<pallet_evm::Pallet<Runtime>>::find_author()1172		}11731174		fn storage_at(address: H160, index: U256) -> H256 {1175			let mut tmp = [0u8; 32];1176			index.to_big_endian(&mut tmp);1177			EVM::account_storages(address, H256::from_slice(&tmp[..]))1178		}11791180		fn call(1181			from: H160,1182			to: H160,1183			data: Vec<u8>,1184			value: U256,1185			gas_limit: U256,1186			gas_price: Option<U256>,1187			nonce: Option<U256>,1188			estimate: bool,1189		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1190			let config = if estimate {1191				let mut config = <Runtime as pallet_evm::Config>::config().clone();1192				config.estimate = true;1193				Some(config)1194			} else {1195				None1196			};11971198			<Runtime as pallet_evm::Config>::Runner::call(1199				from,1200				to,1201				data,1202				value,1203				gas_limit.low_u64(),1204				gas_price,1205				nonce,1206				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1207			).map_err(|err| err.into())1208		}12091210		fn create(1211			from: H160,1212			data: Vec<u8>,1213			value: U256,1214			gas_limit: U256,1215			gas_price: Option<U256>,1216			nonce: Option<U256>,1217			estimate: bool,1218		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1219			let config = if estimate {1220				let mut config = <Runtime as pallet_evm::Config>::config().clone();1221				config.estimate = true;1222				Some(config)1223			} else {1224				None1225			};12261227			<Runtime as pallet_evm::Config>::Runner::create(1228				from,1229				data,1230				value,1231				gas_limit.low_u64(),1232				gas_price,1233				nonce,1234				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1235			).map_err(|err| err.into())1236		}12371238		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1239			Ethereum::current_transaction_statuses()1240		}12411242		fn current_block() -> Option<pallet_ethereum::Block> {1243			Ethereum::current_block()1244		}12451246		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1247			Ethereum::current_receipts()1248		}12491250		fn current_all() -> (1251			Option<pallet_ethereum::Block>,1252			Option<Vec<pallet_ethereum::Receipt>>,1253			Option<Vec<TransactionStatus>>1254		) {1255			(1256				Ethereum::current_block(),1257				Ethereum::current_receipts(),1258				Ethereum::current_transaction_statuses()1259			)1260		}12611262		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1263			xts.into_iter().filter_map(|xt| match xt.0.function {1264				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1265				_ => None1266			}).collect()1267		}1268	}12691270	impl sp_session::SessionKeys<Block> for Runtime {1271		fn decode_session_keys(1272			encoded: Vec<u8>,1273		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1274			SessionKeys::decode_into_raw_public_keys(&encoded)1275		}12761277		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1278			SessionKeys::generate(seed)1279		}1280	}12811282	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1283		fn slot_duration() -> sp_consensus_aura::SlotDuration {1284			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1285		}12861287		fn authorities() -> Vec<AuraId> {1288			Aura::authorities().to_vec()1289		}1290	}12911292	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1293		fn collect_collation_info() -> cumulus_primitives_core::CollationInfo {1294			ParachainSystem::collect_collation_info()1295		}1296	}12971298	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1299		fn account_nonce(account: AccountId) -> Index {1300			System::account_nonce(account)1301		}1302	}13031304	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1305		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1306			TransactionPayment::query_info(uxt, len)1307		}1308		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1309			TransactionPayment::query_fee_details(uxt, len)1310		}1311	}13121313	/*1314	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1315		for Runtime1316	{1317		fn call(1318			origin: AccountId,1319			dest: AccountId,1320			value: Balance,1321			gas_limit: u64,1322			input_data: Vec<u8>,1323		) -> pallet_contracts_primitives::ContractExecResult {1324			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1325		}13261327		fn instantiate(1328			origin: AccountId,1329			endowment: Balance,1330			gas_limit: u64,1331			code: pallet_contracts_primitives::Code<Hash>,1332			data: Vec<u8>,1333			salt: Vec<u8>,1334		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1335		{1336			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1337		}13381339		fn get_storage(1340			address: AccountId,1341			key: [u8; 32],1342		) -> pallet_contracts_primitives::GetStorageResult {1343			Contracts::get_storage(address, key)1344		}13451346		fn rent_projection(1347			address: AccountId,1348		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1349			Contracts::rent_projection(address)1350		}1351	}1352	*/13531354	#[cfg(feature = "runtime-benchmarks")]1355	impl frame_benchmarking::Benchmark<Block> for Runtime {1356		fn benchmark_metadata(extra: bool) -> (1357			Vec<frame_benchmarking::BenchmarkList>,1358			Vec<frame_support::traits::StorageInfo>,1359		) {1360			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1361			use frame_support::traits::StorageInfoTrait;13621363			let mut list = Vec::<BenchmarkList>::new();13641365			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1366			list_benchmark!(list, extra, pallet_nft, Nft);1367			list_benchmark!(list, extra, pallet_inflation, Inflation);1368			list_benchmark!(list, extra, pallet_fungible, Fungible);1369			list_benchmark!(list, extra, pallet_refungible, Refungible);1370			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1371			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);13721373			let storage_info = AllPalletsWithSystem::storage_info();13741375			return (list, storage_info)1376		}13771378		fn dispatch_benchmark(1379			config: frame_benchmarking::BenchmarkConfig1380		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1381			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};13821383			let allowlist: Vec<TrackedStorageKey> = vec![1384				// Block Number1385				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1386				// Total Issuance1387				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1388				// Execution Phase1389				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1390				// Event Count1391				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1392				// System Events1393				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1394			];13951396			let mut batches = Vec::<BenchmarkBatch>::new();1397			let params = (&config, &allowlist);13981399			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1400			add_benchmark!(params, batches, pallet_nft, Nft);1401			add_benchmark!(params, batches, pallet_inflation, Inflation);1402			add_benchmark!(params, batches, pallet_fungible, Fungible);1403			add_benchmark!(params, batches, pallet_refungible, Refungible);1404			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1405			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);14061407			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1408			Ok(batches)1409		}1410	}1411}14121413struct CheckInherents;14141415impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1416	fn check_inherents(1417		block: &Block,1418		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1419	) -> sp_inherents::CheckInherentsResult {1420		let relay_chain_slot = relay_state_proof1421			.read_slot()1422			.expect("Could not read the relay chain slot from the proof");14231424		let inherent_data =1425			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1426				relay_chain_slot,1427				sp_std::time::Duration::from_secs(6),1428			)1429			.create_inherent_data()1430			.expect("Could not create the timestamp inherent data");14311432		inherent_data.check_extrinsics(block)1433	}1434}14351436cumulus_pallet_parachain_system::register_validate_block!(1437	Runtime = Runtime,1438	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1439	CheckInherents = CheckInherents,1440);
after · runtime/src/lib.rs
1//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};19// #[cfg(any(feature = "std", test))]20// pub use sp_runtime::BuildStorage;2122use sp_runtime::{23	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,24	traits::{25		AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify, AccountIdConversion,26	},27	transaction_validity::{TransactionSource, TransactionValidity},28	ApplyExtrinsicResult, MultiSignature,29};3031use sp_std::prelude::*;3233#[cfg(feature = "std")]34use sp_version::NativeVersion;35use sp_version::RuntimeVersion;36pub use pallet_transaction_payment::{37	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,38};39// A few exports that help ease life for downstream crates.40pub use pallet_balances::Call as BalancesCall;41pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};42pub use frame_support::{43	construct_runtime, match_type,44	dispatch::DispatchResult,45	PalletId, parameter_types, StorageValue, ConsensusEngineId,46	traits::{47		Everything, Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem,48		LockIdentifier, 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 nft_data_structs::*;57// use pallet_contracts::weights::WeightInfo;58// #[cfg(any(feature = "std", test))]59use frame_system::{60	self as 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_core::crypto::Public;71use sp_runtime::{72	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf},73	transaction_validity::TransactionValidityError,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, IsConcrete, LocationInverter, NativeAsset,86	ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,87	SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,88	SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,89};90use xcm_executor::{Config, XcmExecutor};9192// mod chain_extension;93// use crate::chain_extension::{NFTExtension, Imbalance};9495/// An index to a block.96pub type BlockNumber = u32;9798/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.99pub type Signature = MultiSignature;100101/// Some way of identifying an account on the chain. We intentionally make it equivalent102/// to the public key of our transaction signing scheme.103pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;104105pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;106107/// The type for looking up accounts. We don't expect more than 4 billion of them, but you108/// never know...109pub type AccountIndex = u32;110111/// Balance of an account.112pub type Balance = u128;113114/// Index of a transaction in the chain.115pub type Index = u32;116117/// A hash of some data used by the chain.118pub type Hash = sp_core::H256;119120/// Digest item type.121pub type DigestItem = generic::DigestItem<Hash>;122123/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know124/// the specifics of the runtime. They can then be made to be agnostic over specific formats125/// of data like extrinsics, allowing for them to continue syncing the network through upgrades126/// to even the core data structures.127pub mod opaque {128	use super::*;129130	pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;131132	/// Opaque block type.133	pub type Block = generic::Block<Header, UncheckedExtrinsic>;134135	pub type SessionHandlers = ();136137	impl_opaque_keys! {138		pub struct SessionKeys {139			pub aura: Aura,140		}141	}142}143144/// This runtime version.145pub const VERSION: RuntimeVersion = RuntimeVersion {146	spec_name: create_runtime_str!("opal"),147	impl_name: create_runtime_str!("opal"),148	authoring_version: 1,149	spec_version: 912202,150	impl_version: 1,151	apis: RUNTIME_API_VERSIONS,152	transaction_version: 1,153};154155pub const MILLISECS_PER_BLOCK: u64 = 12000;156157pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;158159// These time units are defined in number of blocks.160pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);161pub const HOURS: BlockNumber = MINUTES * 60;162pub const DAYS: BlockNumber = HOURS * 24;163164parameter_types! {165	pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;166}167168#[derive(codec::Encode, codec::Decode)]169pub enum XCMPMessage<XAccountId, XBalance> {170	/// Transfer tokens to the given account from the Parachain account.171	TransferToken(XAccountId, XBalance),172}173174/// The version information used to identify this runtime when compiled natively.175#[cfg(feature = "std")]176pub fn native_version() -> NativeVersion {177	NativeVersion {178		runtime_version: VERSION,179		can_author_with: Default::default(),180	}181}182183type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;184185pub struct DealWithFees;186impl OnUnbalanced<NegativeImbalance> for DealWithFees {187	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {188		if let Some(fees) = fees_then_tips.next() {189			// for fees, 100% to treasury190			let mut split = fees.ration(100, 0);191			if let Some(tips) = fees_then_tips.next() {192				// for tips, if any, 100% to treasury193				tips.ration_merge_into(100, 0, &mut split);194			}195			Treasury::on_unbalanced(split.0);196			// Author::on_unbalanced(split.1);197		}198	}199}200201/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.202/// This is used to limit the maximal weight of a single extrinsic.203const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);204/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used205/// by  Operational  extrinsics.206const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);207/// We allow for 2 seconds of compute with a 6 second average block time.208const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;209210parameter_types! {211	pub const BlockHashCount: BlockNumber = 2400;212	pub RuntimeBlockLength: BlockLength =213		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);214	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);215	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;216	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()217		.base_block(BlockExecutionWeight::get())218		.for_class(DispatchClass::all(), |weights| {219			weights.base_extrinsic = ExtrinsicBaseWeight::get();220		})221		.for_class(DispatchClass::Normal, |weights| {222			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);223		})224		.for_class(DispatchClass::Operational, |weights| {225			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);226			// Operational transactions have some extra reserved space, so that they227			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.228			weights.reserved = Some(229				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT230			);231		})232		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)233		.build_or_panic();234	pub const Version: RuntimeVersion = VERSION;235	pub const SS58Prefix: u8 = 42;236}237238parameter_types! {239	pub const ChainId: u64 = 8888;240}241242pub struct FixedFee;243impl FeeCalculator for FixedFee {244	fn min_gas_price() -> U256 {245		// Targeting 0.15 UNQ per transfer246		1_024_947_215u32.into()247	}248}249250// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case251// (contract, which only writes a lot of data),252// approximating on top of our real store write weight253parameter_types! {254	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;255	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;256	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();257}258259/// Limiting EVM execution to 50% of block for substrate users and management tasks260/// EVM transaction consumes more weight than substrate's, so we can't rely on them being261/// scheduled fairly262const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);263parameter_types! {264	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());265}266267pub enum FixedGasWeightMapping {}268impl GasWeightMapping for FixedGasWeightMapping {269	fn gas_to_weight(gas: u64) -> Weight {270		gas.saturating_mul(WeightPerGas::get())271	}272	fn weight_to_gas(weight: Weight) -> u64 {273		weight / WeightPerGas::get()274	}275}276277impl pallet_evm::Config for Runtime {278	type BlockGasLimit = BlockGasLimit;279	type FeeCalculator = FixedFee;280	type GasWeightMapping = FixedGasWeightMapping;281	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;282	type CallOrigin = EnsureAddressTruncated;283	type WithdrawOrigin = EnsureAddressTruncated;284	type AddressMapping = HashedAddressMapping<Self::Hashing>;285	type Precompiles = ();286	type Currency = Balances;287	type Event = Event;288	type OnMethodCall = (289		pallet_evm_migration::OnMethodCall<Self>,290		pallet_nft::NftErcSupport<Self>,291		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,292	);293	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;294	type ChainId = ChainId;295	type Runner = pallet_evm::runner::stack::Runner<Self>;296	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;297	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;298	type FindAuthor = EthereumFindAuthor<Aura>;299}300301impl pallet_evm_migration::Config for Runtime {302	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;303}304305pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);306impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {307	fn find_author<'a, I>(digests: I) -> Option<H160>308	where309		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,310	{311		if let Some(author_index) = F::find_author(digests) {312			let authority_id = Aura::authorities()[author_index as usize].clone();313			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));314		}315		None316	}317}318319impl pallet_ethereum::Config for Runtime {320	type Event = Event;321	type StateRoot = pallet_ethereum::IntermediateStateRoot;322}323324impl pallet_randomness_collective_flip::Config for Runtime {}325326impl system::Config for Runtime {327	/// The data to be stored in an account.328	type AccountData = pallet_balances::AccountData<Balance>;329	/// The identifier used to distinguish between accounts.330	type AccountId = AccountId;331	/// The basic call filter to use in dispatchable.332	type BaseCallFilter = Everything;333	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).334	type BlockHashCount = BlockHashCount;335	/// The maximum length of a block (in bytes).336	type BlockLength = RuntimeBlockLength;337	/// The index type for blocks.338	type BlockNumber = BlockNumber;339	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.340	type BlockWeights = RuntimeBlockWeights;341	/// The aggregated dispatch type that is available for extrinsics.342	type Call = Call;343	/// The weight of database operations that the runtime can invoke.344	type DbWeight = RocksDbWeight;345	/// The ubiquitous event type.346	type Event = Event;347	/// The type for hashing blocks and tries.348	type Hash = Hash;349	/// The hashing algorithm used.350	type Hashing = BlakeTwo256;351	/// The header type.352	type Header = generic::Header<BlockNumber, BlakeTwo256>;353	/// The index type for storing how many extrinsics an account has signed.354	type Index = Index;355	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.356	type Lookup = AccountIdLookup<AccountId, ()>;357	/// What to do if an account is fully reaped from the system.358	type OnKilledAccount = ();359	/// What to do if a new account is created.360	type OnNewAccount = ();361	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;362	/// The ubiquitous origin type.363	type Origin = Origin;364	/// This type is being generated by `construct_runtime!`.365	type PalletInfo = PalletInfo;366	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.367	type SS58Prefix = SS58Prefix;368	/// Weight information for the extrinsics of this pallet.369	type SystemWeightInfo = system::weights::SubstrateWeight<Self>;370	/// Version of the runtime.371	type Version = Version;372}373374parameter_types! {375	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;376}377378impl pallet_timestamp::Config for Runtime {379	/// A timestamp: milliseconds since the unix epoch.380	type Moment = u64;381	type OnTimestampSet = ();382	type MinimumPeriod = MinimumPeriod;383	type WeightInfo = ();384}385386parameter_types! {387	// pub const ExistentialDeposit: u128 = 500;388	pub const ExistentialDeposit: u128 = 0;389	pub const MaxLocks: u32 = 50;390}391392impl pallet_balances::Config for Runtime {393	type MaxLocks = MaxLocks;394	type MaxReserves = ();395	type ReserveIdentifier = [u8; 8];396	/// The type for recording an account's balance.397	type Balance = Balance;398	/// The ubiquitous event type.399	type Event = Event;400	type DustRemoval = Treasury;401	type ExistentialDeposit = ExistentialDeposit;402	type AccountStore = System;403	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;404}405406pub const MICROUNIQUE: Balance = 1_000_000_000;407pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;408pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;409pub const UNIQUE: Balance = 100 * CENTIUNIQUE;410411pub const fn deposit(items: u32, bytes: u32) -> Balance {412	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE413}414415/*416parameter_types! {417	pub TombstoneDeposit: Balance = deposit(418		1,419		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,420	);421	pub DepositPerContract: Balance = TombstoneDeposit::get();422	pub const DepositPerStorageByte: Balance = deposit(0, 1);423	pub const DepositPerStorageItem: Balance = deposit(1, 0);424	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);425	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;426	pub const SignedClaimHandicap: u32 = 2;427	pub const MaxDepth: u32 = 32;428	pub const MaxValueSize: u32 = 16 * 1024;429	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb430	// The lazy deletion runs inside on_initialize.431	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *432		RuntimeBlockWeights::get().max_block;433	// The weight needed for decoding the queue should be less or equal than a fifth434	// of the overall weight dedicated to the lazy deletion.435	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (436			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -437			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)438		)) / 5) as u32;439	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();440}441442impl pallet_contracts::Config for Runtime {443	type Time = Timestamp;444	type Randomness = RandomnessCollectiveFlip;445	type Currency = Balances;446	type Event = Event;447	type RentPayment = ();448	type SignedClaimHandicap = SignedClaimHandicap;449	type TombstoneDeposit = TombstoneDeposit;450	type DepositPerContract = DepositPerContract;451	type DepositPerStorageByte = DepositPerStorageByte;452	type DepositPerStorageItem = DepositPerStorageItem;453	type RentFraction = RentFraction;454	type SurchargeReward = SurchargeReward;455	type WeightPrice = pallet_transaction_payment::Pallet<Self>;456	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;457	type ChainExtension = NFTExtension;458	type DeletionQueueDepth = DeletionQueueDepth;459	type DeletionWeightLimit = DeletionWeightLimit;460	type Schedule = Schedule;461	type CallStack = [pallet_contracts::Frame<Self>; 31];462}463*/464465parameter_types! {466	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer467	/// This value increases the priority of `Operational` transactions by adding468	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.469	pub const OperationalFeeMultiplier: u8 = 5;470}471472/// Linear implementor of `WeightToFeePolynomial`473pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);474475impl<T> WeightToFeePolynomial for LinearFee<T>476where477	T: BaseArithmetic + From<u32> + Copy + Unsigned,478{479	type Balance = T;480481	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {482		smallvec!(WeightToFeeCoefficient {483			// Targeting 0.1 Unique per NFT transfer484			coeff_integer: 142_688u32.into(),485			coeff_frac: Perbill::zero(),486			negative: false,487			degree: 1,488		})489	}490}491492impl pallet_transaction_payment::Config for Runtime {493	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;494	type TransactionByteFee = TransactionByteFee;495	type OperationalFeeMultiplier = OperationalFeeMultiplier;496	type WeightToFee = LinearFee<Balance>;497	type FeeMultiplierUpdate = ();498}499500parameter_types! {501	pub const ProposalBond: Permill = Permill::from_percent(5);502	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;503	pub const SpendPeriod: BlockNumber = 5 * MINUTES;504	pub const Burn: Permill = Permill::from_percent(0);505	pub const TipCountdown: BlockNumber = 1 * DAYS;506	pub const TipFindersFee: Percent = Percent::from_percent(20);507	pub const TipReportDepositBase: Balance = 1 * UNIQUE;508	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;509	pub const BountyDepositBase: Balance = 1 * UNIQUE;510	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;511	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");512	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;513	pub const MaximumReasonLength: u32 = 16384;514	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);515	pub const BountyValueMinimum: Balance = 5 * UNIQUE;516	pub const MaxApprovals: u32 = 100;517}518519impl pallet_treasury::Config for Runtime {520	type PalletId = TreasuryModuleId;521	type Currency = Balances;522	type ApproveOrigin = EnsureRoot<AccountId>;523	type RejectOrigin = EnsureRoot<AccountId>;524	type Event = Event;525	type OnSlash = ();526	type ProposalBond = ProposalBond;527	type ProposalBondMinimum = ProposalBondMinimum;528	type SpendPeriod = SpendPeriod;529	type Burn = Burn;530	type BurnDestination = ();531	type SpendFunds = ();532	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;533	type MaxApprovals = MaxApprovals;534}535536impl pallet_sudo::Config for Runtime {537	type Event = Event;538	type Call = Call;539}540541pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);542543impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider544	for RelayChainBlockNumberProvider<T>545{546	type BlockNumber = BlockNumber;547548	fn current_block_number() -> Self::BlockNumber {549		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()550			.map(|d| d.relay_parent_number)551			.unwrap_or_default()552	}553}554555parameter_types! {556	pub const MinVestedTransfer: Balance = 10 * UNIQUE;557	pub const MaxVestingSchedules: u32 = 28;558}559560impl orml_vesting::Config for Runtime {561	type Event = Event;562	type Currency = pallet_balances::Pallet<Runtime>;563	type MinVestedTransfer = MinVestedTransfer;564	type VestedTransferOrigin = EnsureSigned<AccountId>;565	type WeightInfo = ();566	type MaxVestingSchedules = MaxVestingSchedules;567	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;568}569570parameter_types! {571	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;572	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;573}574575impl cumulus_pallet_parachain_system::Config for Runtime {576	type Event = Event;577	type OnValidationData = ();578	type SelfParaId = parachain_info::Pallet<Self>;579	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<580	// 	MaxDownwardMessageWeight,581	// 	XcmExecutor<XcmConfig>,582	// 	Call,583	// >;584	type OutboundXcmpMessageSource = XcmpQueue;585	type DmpMessageHandler = DmpQueue;586	type ReservedDmpWeight = ReservedDmpWeight;587	type ReservedXcmpWeight = ReservedXcmpWeight;588	type XcmpMessageHandler = XcmpQueue;589}590591impl parachain_info::Config for Runtime {}592593impl cumulus_pallet_aura_ext::Config for Runtime {}594595parameter_types! {596	pub const RelayLocation: MultiLocation = MultiLocation::parent();597	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;598	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();599	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();600}601602/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used603/// when determining ownership of accounts for asset transacting and when attempting to use XCM604/// `Transact` in order to determine the dispatch Origin.605pub type LocationToAccountId = (606	// The parent (Relay-chain) origin converts to the default `AccountId`.607	ParentIsDefault<AccountId>,608	// Sibling parachain origins convert to AccountId via the `ParaId::into`.609	SiblingParachainConvertsVia<Sibling, AccountId>,610	// Straight up local `AccountId32` origins just alias directly to `AccountId`.611	AccountId32Aliases<RelayNetwork, AccountId>,612);613614/// Means for transacting assets on this chain.615pub type LocalAssetTransactor = CurrencyAdapter<616	// Use this currency:617	Balances,618	// Use this currency when it is a fungible asset matching the given location or name:619	IsConcrete<RelayLocation>,620	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:621	LocationToAccountId,622	// Our chain's account ID type (we can't get away without mentioning it explicitly):623	AccountId,624	// We don't track any teleports.625	(),626>;627628/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,629/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can630/// biases the kind of local `Origin` it will become.631pub type XcmOriginToTransactDispatchOrigin = (632	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location633	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for634	// foreign chains who want to have a local sovereign account on this chain which they control.635	SovereignSignedViaLocation<LocationToAccountId, Origin>,636	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when637	// recognised.638	RelayChainAsNative<RelayOrigin, Origin>,639	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when640	// recognised.641	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,642	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a643	// transaction from the Root origin.644	ParentAsSuperuser<Origin>,645	// Native signed account converter; this just converts an `AccountId32` origin into a normal646	// `Origin::Signed` origin of the same 32-byte value.647	SignedAccountId32AsNative<RelayNetwork, Origin>,648	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.649	XcmPassthrough<Origin>,650);651652parameter_types! {653	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.654	pub UnitWeightCost: Weight = 1_000_000;655	// 1200 UNIQUEs buy 1 second of weight.656	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);657	pub const MaxInstructions: u32 = 100;658	pub const MaxAuthorities: u32 = 100_000;659}660661match_type! {662	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {663		MultiLocation { parents: 1, interior: Here } |664		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }665	};666}667668pub type Barrier = (669	TakeWeightCredit,670	AllowTopLevelPaidExecutionFrom<Everything>,671	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,672	// ^^^ Parent & its unit plurality gets free execution673);674675pub struct XcmConfig;676impl Config for XcmConfig {677	type Call = Call;678	type XcmSender = XcmRouter;679	// How to withdraw and deposit an asset.680	type AssetTransactor = LocalAssetTransactor;681	type OriginConverter = XcmOriginToTransactDispatchOrigin;682	type IsReserve = NativeAsset;683	type IsTeleporter = (); // Teleportation is disabled684	type LocationInverter = LocationInverter<Ancestry>;685	type Barrier = Barrier;686	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;687	type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;688	type ResponseHandler = (); // Don't handle responses for now.689	type SubscriptionService = PolkadotXcm;690691	type AssetTrap = PolkadotXcm;692	type AssetClaims = PolkadotXcm;693}694695// parameter_types! {696// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;697// }698699/// No local origins on this chain are allowed to dispatch XCM sends/executions.700pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);701702/// The means for routing XCM messages which are not for local execution into the right message703/// queues.704pub type XcmRouter = (705	// Two routers - use UMP to communicate with the relay chain:706	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,707	// ..and XCMP to communicate with the sibling chains.708	XcmpQueue,709);710711impl pallet_evm_coder_substrate::Config for Runtime {712	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;713	type GasWeightMapping = FixedGasWeightMapping;714}715716impl pallet_xcm::Config for Runtime {717	type Event = Event;718	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;719	type XcmRouter = XcmRouter;720	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;721	type XcmExecuteFilter = Everything;722	type XcmExecutor = XcmExecutor<XcmConfig>;723	type XcmTeleportFilter = Everything;724	type XcmReserveTransferFilter = Everything;725	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;726	type LocationInverter = LocationInverter<Ancestry>;727	type Origin = Origin;728	type Call = Call;729	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;730	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;731}732733impl cumulus_pallet_xcm::Config for Runtime {734	type Event = Event;735	type XcmExecutor = XcmExecutor<XcmConfig>;736}737738impl cumulus_pallet_xcmp_queue::Config for Runtime {739	type Event = Event;740	type XcmExecutor = XcmExecutor<XcmConfig>;741	type ChannelInfo = ParachainSystem;742	type VersionWrapper = ();743}744745impl cumulus_pallet_dmp_queue::Config for Runtime {746	type Event = Event;747	type XcmExecutor = XcmExecutor<XcmConfig>;748	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;749}750751impl pallet_aura::Config for Runtime {752	type AuthorityId = AuraId;753	type DisabledValidators = ();754	type MaxAuthorities = MaxAuthorities;755}756757parameter_types! {758	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();759	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;760}761762impl pallet_common::Config for Runtime {763	type Event = Event;764	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;765	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;766	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;767768	type Currency = Balances;769	type CollectionCreationPrice = CollectionCreationPrice;770	type TreasuryAccountId = TreasuryAccountId;771}772773impl pallet_fungible::Config for Runtime {774	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;775}776impl pallet_refungible::Config for Runtime {777	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;778}779impl pallet_nonfungible::Config for Runtime {780	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;781}782783/// Used for the pallet nft in `./nft.rs`784impl pallet_nft::Config for Runtime {785	type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;786}787788parameter_types! {789	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied790}791792/// Used for the pallet inflation793impl pallet_inflation::Config for Runtime {794	type Currency = Balances;795	type TreasuryAccountId = TreasuryAccountId;796	type InflationBlockInterval = InflationBlockInterval;797}798799// parameter_types! {800// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *801// 		RuntimeBlockWeights::get().max_block;802// 	pub const MaxScheduledPerBlock: u32 = 50;803// }804805type EvmSponsorshipHandler = (806	pallet_nft::NftEthSponsorshipHandler<Runtime>,807	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,808);809type SponsorshipHandler = (810	pallet_nft::NftSponsorshipHandler<Runtime>,811	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,812	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,813);814815// impl pallet_unq_scheduler::Config for Runtime {816// 	type Event = Event;817// 	type Origin = Origin;818// 	type PalletsOrigin = OriginCaller;819// 	type Call = Call;820// 	type MaximumWeight = MaximumSchedulerWeight;821// 	type ScheduleOrigin = EnsureSigned<AccountId>;822// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;823// 	type SponsorshipHandler = SponsorshipHandler;824// 	type WeightInfo = ();825// }826827impl pallet_evm_transaction_payment::Config for Runtime {828	type EvmSponsorshipHandler = EvmSponsorshipHandler;829	type Currency = Balances;830	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;831	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;832}833834impl pallet_nft_charge_transaction::Config for Runtime {835	type SponsorshipHandler = SponsorshipHandler;836}837838// impl pallet_contract_helpers::Config for Runtime {839//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;840// }841842parameter_types! {843	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049844	pub const HelpersContractAddress: H160 = H160([845		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,846	]);847}848849impl pallet_evm_contract_helpers::Config for Runtime {850	type ContractAddress = HelpersContractAddress;851	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;852}853854construct_runtime!(855	pub enum Runtime where856		Block = Block,857		NodeBlock = opaque::Block,858		UncheckedExtrinsic = UncheckedExtrinsic859	{860		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,861		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,862863		Aura: pallet_aura::{Pallet, Config<T>} = 22,864		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,865866		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,867		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,868		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,869		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,870		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,871		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,872		System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,873		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,874		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,875		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,876877		// XCM helpers.878		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,879		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,880		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,881		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,882883		// Unique Pallets884		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,885		Nft: pallet_nft::{Pallet, Call, Storage} = 61,886		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,887		// free = 63888		Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage } = 64,889		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,890		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,891		Fungible: pallet_fungible::{Pallet, Storage} = 67,892		Refungible: pallet_refungible::{Pallet, Storage} = 68,893		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,894895		// Frontier896		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,897		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,898899		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,900		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,901		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,902		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,903	}904);905906pub struct TransactionConverter;907908impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {909	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {910		UncheckedExtrinsic::new_unsigned(911			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),912		)913	}914}915916impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {917	fn convert_transaction(918		&self,919		transaction: pallet_ethereum::Transaction,920	) -> opaque::UncheckedExtrinsic {921		let extrinsic = UncheckedExtrinsic::new_unsigned(922			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),923		);924		let encoded = extrinsic.encode();925		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])926			.expect("Encoded extrinsic is always valid")927	}928}929930/// The address format for describing accounts.931pub type Address = sp_runtime::MultiAddress<AccountId, ()>;932/// Block header type as expected by this runtime.933pub type Header = generic::Header<BlockNumber, BlakeTwo256>;934/// Block type as expected by this runtime.935pub type Block = generic::Block<Header, UncheckedExtrinsic>;936/// A Block signed with a Justification937pub type SignedBlock = generic::SignedBlock<Block>;938/// BlockId type as expected by this runtime.939pub type BlockId = generic::BlockId<Block>;940/// The SignedExtension to the basic transaction logic.941pub type SignedExtra = (942	system::CheckSpecVersion<Runtime>,943	// system::CheckTxVersion<Runtime>,944	system::CheckGenesis<Runtime>,945	system::CheckEra<Runtime>,946	system::CheckNonce<Runtime>,947	system::CheckWeight<Runtime>,948	pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,949	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,950);951/// Unchecked extrinsic type as expected by this runtime.952pub type UncheckedExtrinsic =953	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;954/// Extrinsic type that has already been checked.955pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;956/// Executive: handles dispatch to the various modules.957pub type Executive = frame_executive::Executive<958	Runtime,959	Block,960	frame_system::ChainContext<Runtime>,961	Runtime,962	AllPallets,963>;964965impl_opaque_keys! {966	pub struct SessionKeys {967		pub aura: Aura,968	}969}970971impl fp_self_contained::SelfContainedCall for Call {972	type SignedInfo = H160;973974	fn is_self_contained(&self) -> bool {975		match self {976			Call::Ethereum(call) => call.is_self_contained(),977			_ => false,978		}979	}980981	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {982		match self {983			Call::Ethereum(call) => call.check_self_contained(),984			_ => None,985		}986	}987988	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {989		match self {990			Call::Ethereum(call) => call.validate_self_contained(info),991			_ => None,992		}993	}994995	fn pre_dispatch_self_contained(996		&self,997		info: &Self::SignedInfo,998	) -> Option<Result<(), TransactionValidityError>> {999		match self {1000			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1001			_ => None,1002		}1003	}10041005	fn apply_self_contained(1006		self,1007		info: Self::SignedInfo,1008	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1009		match self {1010			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1011				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1012			)),1013			_ => None,1014		}1015	}1016}10171018macro_rules! dispatch_nft_runtime {1019	($collection:ident.$method:ident($($name:ident),*)) => {{1020		use pallet_nft::dispatch::Dispatched;10211022		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::new($collection).unwrap());1023		let dispatch = collection.as_dyn();10241025		dispatch.$method($($name),*)1026	}};1027}1028impl_runtime_apis! {1029	impl up_rpc::NftApi<Block, CrossAccountId, AccountId>1030		for Runtime1031	{1032		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId> {1033			dispatch_nft_runtime!(collection.account_tokens(account))1034		}1035		fn token_exists(collection: CollectionId, token: TokenId) -> bool {1036			dispatch_nft_runtime!(collection.token_exists(token))1037		}10381039		fn token_owner(collection: CollectionId, token: TokenId) -> CrossAccountId {1040			dispatch_nft_runtime!(collection.token_owner(token))1041		}1042		fn const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1043			dispatch_nft_runtime!(collection.const_metadata(token))1044		}1045		fn variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1046			dispatch_nft_runtime!(collection.variable_metadata(token))1047		}10481049		fn collection_tokens(collection: CollectionId) -> u32 {1050			dispatch_nft_runtime!(collection.collection_tokens())1051		}1052		fn account_balance(collection: CollectionId, account: CrossAccountId) -> u32 {1053			dispatch_nft_runtime!(collection.account_balance(account))1054		}1055		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> u128 {1056			dispatch_nft_runtime!(collection.balance(account, token))1057		}1058		fn allowance(1059			collection: CollectionId,1060			sender: CrossAccountId,1061			spender: CrossAccountId,1062			token: TokenId,1063		) -> u128 {1064			dispatch_nft_runtime!(collection.allowance(sender, spender, token))1065		}10661067		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1068			<pallet_nft::NftErcSupport<Runtime>>::get_code(&account)1069				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1070				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1071		}1072		fn adminlist(collection: CollectionId) -> Vec<CrossAccountId> {1073			<pallet_common::Pallet<Runtime>>::adminlist(collection)1074		}1075		fn allowlist(collection: CollectionId) -> Vec<CrossAccountId> {1076			<pallet_common::Pallet<Runtime>>::allowlist(collection)1077		}1078		fn allowed(collection: CollectionId, user: CrossAccountId) -> bool {1079			<pallet_common::Pallet<Runtime>>::allowed(collection, user)1080		}1081		fn last_token_id(collection: CollectionId) -> TokenId {1082			dispatch_nft_runtime!(collection.last_token_id())1083		}1084		fn collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>> {1085			<pallet_common::CollectionById<Runtime>>::get(collection)1086		}1087		fn collection_stats() -> CollectionStats {1088			<pallet_common::Pallet<Runtime>>::collection_stats()1089		}1090	}10911092	impl sp_api::Core<Block> for Runtime {1093		fn version() -> RuntimeVersion {1094			VERSION1095		}10961097		fn execute_block(block: Block) {1098			Executive::execute_block(block)1099		}11001101		fn initialize_block(header: &<Block as BlockT>::Header) {1102			Executive::initialize_block(header)1103		}1104	}11051106	impl sp_api::Metadata<Block> for Runtime {1107		fn metadata() -> OpaqueMetadata {1108			OpaqueMetadata::new(Runtime::metadata().into())1109		}1110	}11111112	impl sp_block_builder::BlockBuilder<Block> for Runtime {1113		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1114			Executive::apply_extrinsic(extrinsic)1115		}11161117		fn finalize_block() -> <Block as BlockT>::Header {1118			Executive::finalize_block()1119		}11201121		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1122			data.create_extrinsics()1123		}11241125		fn check_inherents(1126			block: Block,1127			data: sp_inherents::InherentData,1128		) -> sp_inherents::CheckInherentsResult {1129			data.check_extrinsics(&block)1130		}11311132		// fn random_seed() -> <Block as BlockT>::Hash {1133		//     RandomnessCollectiveFlip::random_seed().01134		// }1135	}11361137	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1138		fn validate_transaction(1139			source: TransactionSource,1140			tx: <Block as BlockT>::Extrinsic,1141			hash: <Block as BlockT>::Hash,1142		) -> TransactionValidity {1143			Executive::validate_transaction(source, tx, hash)1144		}1145	}11461147	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1148		fn offchain_worker(header: &<Block as BlockT>::Header) {1149			Executive::offchain_worker(header)1150		}1151	}11521153	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1154		fn chain_id() -> u64 {1155			<Runtime as pallet_evm::Config>::ChainId::get()1156		}11571158		fn account_basic(address: H160) -> EVMAccount {1159			EVM::account_basic(&address)1160		}11611162		fn gas_price() -> U256 {1163			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1164		}11651166		fn account_code_at(address: H160) -> Vec<u8> {1167			EVM::account_codes(address)1168		}11691170		fn author() -> H160 {1171			<pallet_evm::Pallet<Runtime>>::find_author()1172		}11731174		fn storage_at(address: H160, index: U256) -> H256 {1175			let mut tmp = [0u8; 32];1176			index.to_big_endian(&mut tmp);1177			EVM::account_storages(address, H256::from_slice(&tmp[..]))1178		}11791180		#[allow(clippy::redundant_closure)]1181		fn call(1182			from: H160,1183			to: H160,1184			data: Vec<u8>,1185			value: U256,1186			gas_limit: U256,1187			gas_price: Option<U256>,1188			nonce: Option<U256>,1189			estimate: bool,1190		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1191			let config = if estimate {1192				let mut config = <Runtime as pallet_evm::Config>::config().clone();1193				config.estimate = true;1194				Some(config)1195			} else {1196				None1197			};11981199			<Runtime as pallet_evm::Config>::Runner::call(1200				from,1201				to,1202				data,1203				value,1204				gas_limit.low_u64(),1205				gas_price,1206				nonce,1207				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1208			).map_err(|err| err.into())1209		}12101211		#[allow(clippy::redundant_closure)]1212		fn create(1213			from: H160,1214			data: Vec<u8>,1215			value: U256,1216			gas_limit: U256,1217			gas_price: Option<U256>,1218			nonce: Option<U256>,1219			estimate: bool,1220		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1221			let config = if estimate {1222				let mut config = <Runtime as pallet_evm::Config>::config().clone();1223				config.estimate = true;1224				Some(config)1225			} else {1226				None1227			};12281229			<Runtime as pallet_evm::Config>::Runner::create(1230				from,1231				data,1232				value,1233				gas_limit.low_u64(),1234				gas_price,1235				nonce,1236				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1237			).map_err(|err| err.into())1238		}12391240		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1241			Ethereum::current_transaction_statuses()1242		}12431244		fn current_block() -> Option<pallet_ethereum::Block> {1245			Ethereum::current_block()1246		}12471248		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1249			Ethereum::current_receipts()1250		}12511252		fn current_all() -> (1253			Option<pallet_ethereum::Block>,1254			Option<Vec<pallet_ethereum::Receipt>>,1255			Option<Vec<TransactionStatus>>1256		) {1257			(1258				Ethereum::current_block(),1259				Ethereum::current_receipts(),1260				Ethereum::current_transaction_statuses()1261			)1262		}12631264		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1265			xts.into_iter().filter_map(|xt| match xt.0.function {1266				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1267				_ => None1268			}).collect()1269		}1270	}12711272	impl sp_session::SessionKeys<Block> for Runtime {1273		fn decode_session_keys(1274			encoded: Vec<u8>,1275		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1276			SessionKeys::decode_into_raw_public_keys(&encoded)1277		}12781279		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1280			SessionKeys::generate(seed)1281		}1282	}12831284	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1285		fn slot_duration() -> sp_consensus_aura::SlotDuration {1286			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1287		}12881289		fn authorities() -> Vec<AuraId> {1290			Aura::authorities().to_vec()1291		}1292	}12931294	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1295		fn collect_collation_info() -> cumulus_primitives_core::CollationInfo {1296			ParachainSystem::collect_collation_info()1297		}1298	}12991300	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1301		fn account_nonce(account: AccountId) -> Index {1302			System::account_nonce(account)1303		}1304	}13051306	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1307		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1308			TransactionPayment::query_info(uxt, len)1309		}1310		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1311			TransactionPayment::query_fee_details(uxt, len)1312		}1313	}13141315	/*1316	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1317		for Runtime1318	{1319		fn call(1320			origin: AccountId,1321			dest: AccountId,1322			value: Balance,1323			gas_limit: u64,1324			input_data: Vec<u8>,1325		) -> pallet_contracts_primitives::ContractExecResult {1326			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1327		}13281329		fn instantiate(1330			origin: AccountId,1331			endowment: Balance,1332			gas_limit: u64,1333			code: pallet_contracts_primitives::Code<Hash>,1334			data: Vec<u8>,1335			salt: Vec<u8>,1336		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1337		{1338			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1339		}13401341		fn get_storage(1342			address: AccountId,1343			key: [u8; 32],1344		) -> pallet_contracts_primitives::GetStorageResult {1345			Contracts::get_storage(address, key)1346		}13471348		fn rent_projection(1349			address: AccountId,1350		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1351			Contracts::rent_projection(address)1352		}1353	}1354	*/13551356	#[cfg(feature = "runtime-benchmarks")]1357	impl frame_benchmarking::Benchmark<Block> for Runtime {1358		fn benchmark_metadata(extra: bool) -> (1359			Vec<frame_benchmarking::BenchmarkList>,1360			Vec<frame_support::traits::StorageInfo>,1361		) {1362			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1363			use frame_support::traits::StorageInfoTrait;13641365			let mut list = Vec::<BenchmarkList>::new();13661367			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1368			list_benchmark!(list, extra, pallet_nft, Nft);1369			list_benchmark!(list, extra, pallet_inflation, Inflation);1370			list_benchmark!(list, extra, pallet_fungible, Fungible);1371			list_benchmark!(list, extra, pallet_refungible, Refungible);1372			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1373			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);13741375			let storage_info = AllPalletsWithSystem::storage_info();13761377			return (list, storage_info)1378		}13791380		fn dispatch_benchmark(1381			config: frame_benchmarking::BenchmarkConfig1382		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1383			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};13841385			let allowlist: Vec<TrackedStorageKey> = vec![1386				// Block Number1387				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1388				// Total Issuance1389				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1390				// Execution Phase1391				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1392				// Event Count1393				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1394				// System Events1395				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1396			];13971398			let mut batches = Vec::<BenchmarkBatch>::new();1399			let params = (&config, &allowlist);14001401			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1402			add_benchmark!(params, batches, pallet_nft, Nft);1403			add_benchmark!(params, batches, pallet_inflation, Inflation);1404			add_benchmark!(params, batches, pallet_fungible, Fungible);1405			add_benchmark!(params, batches, pallet_refungible, Refungible);1406			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1407			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);14081409			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1410			Ok(batches)1411		}1412	}1413}14141415struct CheckInherents;14161417impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1418	fn check_inherents(1419		block: &Block,1420		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1421	) -> sp_inherents::CheckInherentsResult {1422		let relay_chain_slot = relay_state_proof1423			.read_slot()1424			.expect("Could not read the relay chain slot from the proof");14251426		let inherent_data =1427			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1428				relay_chain_slot,1429				sp_std::time::Duration::from_secs(6),1430			)1431			.create_inherent_data()1432			.expect("Could not create the timestamp inherent data");14331434		inherent_data.check_extrinsics(block)1435	}1436}14371438cumulus_pallet_parachain_system::register_validate_block!(1439	Runtime = Runtime,1440	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1441	CheckInherents = CheckInherents,1442);