git.delta.rocks / unique-network / refs/commits / 7e0ba1d9645e

difftreelog

Adjust node name according to used runtime

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

4 files changed

modifiednode/cli/src/command.rsdiffbeforeafterboth
--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -79,7 +79,7 @@
 impl SubstrateCli for Cli {
 	// TODO use args
 	fn impl_name() -> String {
-		"Opal Node".into()
+		format!("{} Node", runtime::RUNTIME_NAME)
 	}
 
 	fn impl_version() -> String {
@@ -88,10 +88,11 @@
 	// TODO use args
 	fn description() -> String {
 		format!(
-			"Opal Node\n\nThe command-line arguments provided first will be \
+			"{} Node\n\nThe command-line arguments provided first will be \
 		passed to the parachain node, while the arguments provided after -- will be passed \
 		to the relaychain node.\n\n\
 		{} [parachain-args] -- [relaychain-args]",
+			runtime::RUNTIME_NAME,
 			Self::executable_name()
 		)
 	}
@@ -121,7 +122,7 @@
 impl SubstrateCli for RelayChainCli {
 	// TODO use args
 	fn impl_name() -> String {
-		"Opal Node".into()
+		format!("{} Node", runtime::RUNTIME_NAME)
 	}
 
 	fn impl_version() -> String {
@@ -129,11 +130,13 @@
 	}
 	// TODO use args
 	fn description() -> String {
-		"Opal Node\n\nThe command-line arguments provided first will be \
+		format!(
+			"{} Node\n\nThe command-line arguments provided first will be \
 		passed to the parachain node, while the arguments provided after -- will be passed \
 		to the relaychain node.\n\n\
-		parachain-collator [parachain-args] -- [relaychain-args]"
-			.into()
+		parachain-collator [parachain-args] -- [relaychain-args]",
+			runtime::RUNTIME_NAME
+		)
 	}
 
 	fn author() -> String {
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
before · runtime/opal/src/lib.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;31// #[cfg(any(feature = "std", test))]32// pub use sp_runtime::BuildStorage;3334use sp_runtime::{35	Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,36	traits::{37		AccountIdLookup, BlakeTwo256, Block as BlockT,38		AccountIdConversion, Zero,39	},40	transaction_validity::{TransactionSource, TransactionValidity},41	ApplyExtrinsicResult, RuntimeAppPublic,42};4344use sp_std::prelude::*;4546#[cfg(feature = "std")]47use sp_version::NativeVersion;48use sp_version::RuntimeVersion;49pub use pallet_transaction_payment::{50	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,51};52// A few exports that help ease life for downstream crates.53pub use pallet_balances::Call as BalancesCall;54pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};55pub use frame_support::{56	construct_runtime, match_type,57	dispatch::DispatchResult,58	PalletId, parameter_types, StorageValue, ConsensusEngineId,59	traits::{60		tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,61		Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,62		OnUnbalanced, Randomness, FindAuthor,63	},64	weights::{65		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},66		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,67		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,68	},69};70use up_data_structs::*;71// use pallet_contracts::weights::WeightInfo;72// #[cfg(any(feature = "std", test))]73use frame_system::{74	self as frame_system, EnsureRoot, EnsureSigned,75	limits::{BlockWeights, BlockLength},76};77use sp_arithmetic::{78	traits::{BaseArithmetic, Unsigned},79};80use smallvec::smallvec;81use codec::{Encode, Decode};82use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};83use fp_rpc::TransactionStatus;84use sp_runtime::{85	traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},86	transaction_validity::TransactionValidityError,87	SaturatedConversion,88};8990// pub use pallet_timestamp::Call as TimestampCall;91pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;9293// Polkadot imports94use pallet_xcm::XcmPassthrough;95use polkadot_parachain::primitives::Sibling;96use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};97use xcm_builder::{98	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,99	EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,100	RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,101	SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,102	ParentIsPreset,103};104use xcm_executor::{Config, XcmExecutor, Assets};105use sp_std::{marker::PhantomData};106107use xcm::latest::{108	//	Xcm,109	AssetId::{Concrete},110	Fungibility::Fungible as XcmFungible,111	MultiAsset,112	Error as XcmError,113};114use xcm_executor::traits::{MatchesFungible, WeightTrader};115//use xcm_executor::traits::MatchesFungible;116use sp_runtime::traits::CheckedConversion;117118use unique_runtime_common::{119	types::*,120	constants::*,121};122123// mod chain_extension;124// use crate::chain_extension::{NFTExtension, Imbalance};125126pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;127128/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know129/// the specifics of the runtime. They can then be made to be agnostic over specific formats130/// of data like extrinsics, allowing for them to continue syncing the network through upgrades131/// to even the core data structures.132pub mod opaque {133	use sp_std::prelude::*;134	use sp_runtime::impl_opaque_keys;135	use super::Aura;136137	pub use unique_runtime_common::types::*;138	pub use super::CrossAccountId;139140	impl_opaque_keys! {141		pub struct SessionKeys {142			pub aura: Aura,143		}144	}145}146147/// This runtime version.148pub const VERSION: RuntimeVersion = RuntimeVersion {149	spec_name: create_runtime_str!("opal"),150	impl_name: create_runtime_str!("opal"),151	authoring_version: 1,152	spec_version: 917004,153	impl_version: 0,154	apis: RUNTIME_API_VERSIONS,155	transaction_version: 1,156	state_version: 0,157};158159#[derive(codec::Encode, codec::Decode)]160pub enum XCMPMessage<XAccountId, XBalance> {161	/// Transfer tokens to the given account from the Parachain account.162	TransferToken(XAccountId, XBalance),163}164165/// The version information used to identify this runtime when compiled natively.166#[cfg(feature = "std")]167pub fn native_version() -> NativeVersion {168	NativeVersion {169		runtime_version: VERSION,170		can_author_with: Default::default(),171	}172}173174type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;175176pub struct DealWithFees;177impl OnUnbalanced<NegativeImbalance> for DealWithFees {178	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {179		if let Some(fees) = fees_then_tips.next() {180			// for fees, 100% to treasury181			let mut split = fees.ration(100, 0);182			if let Some(tips) = fees_then_tips.next() {183				// for tips, if any, 100% to treasury184				tips.ration_merge_into(100, 0, &mut split);185			}186			Treasury::on_unbalanced(split.0);187			// Author::on_unbalanced(split.1);188		}189	}190}191192parameter_types! {193	pub const BlockHashCount: BlockNumber = 2400;194	pub RuntimeBlockLength: BlockLength =195		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);196	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);197	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;198	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()199		.base_block(BlockExecutionWeight::get())200		.for_class(DispatchClass::all(), |weights| {201			weights.base_extrinsic = ExtrinsicBaseWeight::get();202		})203		.for_class(DispatchClass::Normal, |weights| {204			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);205		})206		.for_class(DispatchClass::Operational, |weights| {207			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);208			// Operational transactions have some extra reserved space, so that they209			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.210			weights.reserved = Some(211				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT212			);213		})214		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)215		.build_or_panic();216	pub const Version: RuntimeVersion = VERSION;217	pub const SS58Prefix: u8 = 42;218}219220/*2218880 - Unique2228881 - Quartz2238882 - Opal224*/225parameter_types! {226	pub const ChainId: u64 = 8882;227}228229pub struct FixedFee;230impl FeeCalculator for FixedFee {231	fn min_gas_price() -> U256 {232		// Targeting 0.15 UNQ per transfer233		1_018_751_825_264u64.into()234	}235}236237// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case238// (contract, which only writes a lot of data),239// approximating on top of our real store write weight240parameter_types! {241	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;242	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;243	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();244}245246/// Limiting EVM execution to 50% of block for substrate users and management tasks247/// EVM transaction consumes more weight than substrate's, so we can't rely on them being248/// scheduled fairly249const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);250parameter_types! {251	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());252}253254pub enum FixedGasWeightMapping {}255impl GasWeightMapping for FixedGasWeightMapping {256	fn gas_to_weight(gas: u64) -> Weight {257		gas.saturating_mul(WeightPerGas::get())258	}259	fn weight_to_gas(weight: Weight) -> u64 {260		weight / WeightPerGas::get()261	}262}263264impl pallet_evm::Config for Runtime {265	type BlockGasLimit = BlockGasLimit;266	type FeeCalculator = FixedFee;267	type GasWeightMapping = FixedGasWeightMapping;268	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;269	type CallOrigin = EnsureAddressTruncated;270	type WithdrawOrigin = EnsureAddressTruncated;271	type AddressMapping = HashedAddressMapping<Self::Hashing>;272	type PrecompilesType = ();273	type PrecompilesValue = ();274	type Currency = Balances;275	type Event = Event;276	type OnMethodCall = (277		pallet_evm_migration::OnMethodCall<Self>,278		pallet_unique::UniqueErcSupport<Self>,279		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,280	);281	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;282	type ChainId = ChainId;283	type Runner = pallet_evm::runner::stack::Runner<Self>;284	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;285	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;286	type FindAuthor = EthereumFindAuthor<Aura>;287}288289impl pallet_evm_migration::Config for Runtime {290	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;291}292293pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);294impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {295	fn find_author<'a, I>(digests: I) -> Option<H160>296	where297		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,298	{299		if let Some(author_index) = F::find_author(digests) {300			let authority_id = Aura::authorities()[author_index as usize].clone();301			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));302		}303		None304	}305}306307impl pallet_ethereum::Config for Runtime {308	type Event = Event;309	type StateRoot = pallet_ethereum::IntermediateStateRoot;310}311312impl pallet_randomness_collective_flip::Config for Runtime {}313314impl frame_system::Config for Runtime {315	/// The data to be stored in an account.316	type AccountData = pallet_balances::AccountData<Balance>;317	/// The identifier used to distinguish between accounts.318	type AccountId = AccountId;319	/// The basic call filter to use in dispatchable.320	type BaseCallFilter = Everything;321	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).322	type BlockHashCount = BlockHashCount;323	/// The maximum length of a block (in bytes).324	type BlockLength = RuntimeBlockLength;325	/// The index type for blocks.326	type BlockNumber = BlockNumber;327	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.328	type BlockWeights = RuntimeBlockWeights;329	/// The aggregated dispatch type that is available for extrinsics.330	type Call = Call;331	/// The weight of database operations that the runtime can invoke.332	type DbWeight = RocksDbWeight;333	/// The ubiquitous event type.334	type Event = Event;335	/// The type for hashing blocks and tries.336	type Hash = Hash;337	/// The hashing algorithm used.338	type Hashing = BlakeTwo256;339	/// The header type.340	type Header = generic::Header<BlockNumber, BlakeTwo256>;341	/// The index type for storing how many extrinsics an account has signed.342	type Index = Index;343	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.344	type Lookup = AccountIdLookup<AccountId, ()>;345	/// What to do if an account is fully reaped from the system.346	type OnKilledAccount = ();347	/// What to do if a new account is created.348	type OnNewAccount = ();349	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;350	/// The ubiquitous origin type.351	type Origin = Origin;352	/// This type is being generated by `construct_runtime!`.353	type PalletInfo = PalletInfo;354	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.355	type SS58Prefix = SS58Prefix;356	/// Weight information for the extrinsics of this pallet.357	type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;358	/// Version of the runtime.359	type Version = Version;360	type MaxConsumers = ConstU32<16>;361}362363parameter_types! {364	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;365}366367impl pallet_timestamp::Config for Runtime {368	/// A timestamp: milliseconds since the unix epoch.369	type Moment = u64;370	type OnTimestampSet = ();371	type MinimumPeriod = MinimumPeriod;372	type WeightInfo = ();373}374375parameter_types! {376	// pub const ExistentialDeposit: u128 = 500;377	pub const ExistentialDeposit: u128 = 0;378	pub const MaxLocks: u32 = 50;379}380381impl pallet_balances::Config for Runtime {382	type MaxLocks = MaxLocks;383	type MaxReserves = ();384	type ReserveIdentifier = [u8; 8];385	/// The type for recording an account's balance.386	type Balance = Balance;387	/// The ubiquitous event type.388	type Event = Event;389	type DustRemoval = Treasury;390	type ExistentialDeposit = ExistentialDeposit;391	type AccountStore = System;392	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;393}394395pub const MICROUNIQUE: Balance = 1_000_000_000_000;396pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;397pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;398pub const UNIQUE: Balance = 100 * CENTIUNIQUE;399400pub const fn deposit(items: u32, bytes: u32) -> Balance {401	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE402}403404/*405parameter_types! {406	pub TombstoneDeposit: Balance = deposit(407		1,408		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,409	);410	pub DepositPerContract: Balance = TombstoneDeposit::get();411	pub const DepositPerStorageByte: Balance = deposit(0, 1);412	pub const DepositPerStorageItem: Balance = deposit(1, 0);413	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);414	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;415	pub const SignedClaimHandicap: u32 = 2;416	pub const MaxDepth: u32 = 32;417	pub const MaxValueSize: u32 = 16 * 1024;418	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb419	// The lazy deletion runs inside on_initialize.420	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *421		RuntimeBlockWeights::get().max_block;422	// The weight needed for decoding the queue should be less or equal than a fifth423	// of the overall weight dedicated to the lazy deletion.424	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (425			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -426			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)427		)) / 5) as u32;428	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();429}430431impl pallet_contracts::Config for Runtime {432	type Time = Timestamp;433	type Randomness = RandomnessCollectiveFlip;434	type Currency = Balances;435	type Event = Event;436	type RentPayment = ();437	type SignedClaimHandicap = SignedClaimHandicap;438	type TombstoneDeposit = TombstoneDeposit;439	type DepositPerContract = DepositPerContract;440	type DepositPerStorageByte = DepositPerStorageByte;441	type DepositPerStorageItem = DepositPerStorageItem;442	type RentFraction = RentFraction;443	type SurchargeReward = SurchargeReward;444	type WeightPrice = pallet_transaction_payment::Pallet<Self>;445	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;446	type ChainExtension = NFTExtension;447	type DeletionQueueDepth = DeletionQueueDepth;448	type DeletionWeightLimit = DeletionWeightLimit;449	type Schedule = Schedule;450	type CallStack = [pallet_contracts::Frame<Self>; 31];451}452*/453454parameter_types! {455	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer456	/// This value increases the priority of `Operational` transactions by adding457	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.458	pub const OperationalFeeMultiplier: u8 = 5;459}460461/// Linear implementor of `WeightToFeePolynomial`462pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);463464impl<T> WeightToFeePolynomial for LinearFee<T>465where466	T: BaseArithmetic + From<u32> + Copy + Unsigned,467{468	type Balance = T;469470	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {471		smallvec!(WeightToFeeCoefficient {472			// Targeting 0.1 Unique per NFT transfer473			coeff_integer: 142_688_000u32.into(),474			coeff_frac: Perbill::zero(),475			negative: false,476			degree: 1,477		})478	}479}480481impl pallet_transaction_payment::Config for Runtime {482	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;483	type TransactionByteFee = TransactionByteFee;484	type OperationalFeeMultiplier = OperationalFeeMultiplier;485	type WeightToFee = LinearFee<Balance>;486	type FeeMultiplierUpdate = ();487}488489parameter_types! {490	pub const ProposalBond: Permill = Permill::from_percent(5);491	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;492	pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;493	pub const SpendPeriod: BlockNumber = 5 * MINUTES;494	pub const Burn: Permill = Permill::from_percent(0);495	pub const TipCountdown: BlockNumber = 1 * DAYS;496	pub const TipFindersFee: Percent = Percent::from_percent(20);497	pub const TipReportDepositBase: Balance = 1 * UNIQUE;498	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;499	pub const BountyDepositBase: Balance = 1 * UNIQUE;500	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;501	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");502	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;503	pub const MaximumReasonLength: u32 = 16384;504	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);505	pub const BountyValueMinimum: Balance = 5 * UNIQUE;506	pub const MaxApprovals: u32 = 100;507}508509impl pallet_treasury::Config for Runtime {510	type PalletId = TreasuryModuleId;511	type Currency = Balances;512	type ApproveOrigin = EnsureRoot<AccountId>;513	type RejectOrigin = EnsureRoot<AccountId>;514	type Event = Event;515	type OnSlash = ();516	type ProposalBond = ProposalBond;517	type ProposalBondMinimum = ProposalBondMinimum;518	type ProposalBondMaximum = ProposalBondMaximum;519	type SpendPeriod = SpendPeriod;520	type Burn = Burn;521	type BurnDestination = ();522	type SpendFunds = ();523	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;524	type MaxApprovals = MaxApprovals;525}526527impl pallet_sudo::Config for Runtime {528	type Event = Event;529	type Call = Call;530}531532pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);533534impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider535	for RelayChainBlockNumberProvider<T>536{537	type BlockNumber = BlockNumber;538539	fn current_block_number() -> Self::BlockNumber {540		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()541			.map(|d| d.relay_parent_number)542			.unwrap_or_default()543	}544}545546parameter_types! {547	pub const MinVestedTransfer: Balance = 10 * UNIQUE;548	pub const MaxVestingSchedules: u32 = 28;549}550551impl orml_vesting::Config for Runtime {552	type Event = Event;553	type Currency = pallet_balances::Pallet<Runtime>;554	type MinVestedTransfer = MinVestedTransfer;555	type VestedTransferOrigin = EnsureSigned<AccountId>;556	type WeightInfo = ();557	type MaxVestingSchedules = MaxVestingSchedules;558	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;559}560561parameter_types! {562	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;563	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;564}565566impl cumulus_pallet_parachain_system::Config for Runtime {567	type Event = Event;568	type SelfParaId = parachain_info::Pallet<Self>;569	type OnSystemEvent = ();570	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<571	// 	MaxDownwardMessageWeight,572	// 	XcmExecutor<XcmConfig>,573	// 	Call,574	// >;575	type OutboundXcmpMessageSource = XcmpQueue;576	type DmpMessageHandler = DmpQueue;577	type ReservedDmpWeight = ReservedDmpWeight;578	type ReservedXcmpWeight = ReservedXcmpWeight;579	type XcmpMessageHandler = XcmpQueue;580}581582impl parachain_info::Config for Runtime {}583584impl cumulus_pallet_aura_ext::Config for Runtime {}585586parameter_types! {587	pub const RelayLocation: MultiLocation = MultiLocation::parent();588	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;589	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();590	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();591}592593/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used594/// when determining ownership of accounts for asset transacting and when attempting to use XCM595/// `Transact` in order to determine the dispatch Origin.596pub type LocationToAccountId = (597	// The parent (Relay-chain) origin converts to the default `AccountId`.598	ParentIsPreset<AccountId>,599	// Sibling parachain origins convert to AccountId via the `ParaId::into`.600	SiblingParachainConvertsVia<Sibling, AccountId>,601	// Straight up local `AccountId32` origins just alias directly to `AccountId`.602	AccountId32Aliases<RelayNetwork, AccountId>,603);604605pub struct OnlySelfCurrency;606impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {607	fn matches_fungible(a: &MultiAsset) -> Option<B> {608		match (&a.id, &a.fun) {609			(Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),610			_ => None,611		}612	}613}614615/// Means for transacting assets on this chain.616pub type LocalAssetTransactor = CurrencyAdapter<617	// Use this currency:618	Balances,619	// Use this currency when it is a fungible asset matching the given location or name:620	OnlySelfCurrency,621	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:622	LocationToAccountId,623	// Our chain's account ID type (we can't get away without mentioning it explicitly):624	AccountId,625	// We don't track any teleports.626	(),627>;628629/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,630/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can631/// biases the kind of local `Origin` it will become.632pub type XcmOriginToTransactDispatchOrigin = (633	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location634	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for635	// foreign chains who want to have a local sovereign account on this chain which they control.636	SovereignSignedViaLocation<LocationToAccountId, Origin>,637	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when638	// recognised.639	RelayChainAsNative<RelayOrigin, Origin>,640	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when641	// recognised.642	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,643	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a644	// transaction from the Root origin.645	ParentAsSuperuser<Origin>,646	// Native signed account converter; this just converts an `AccountId32` origin into a normal647	// `Origin::Signed` origin of the same 32-byte value.648	SignedAccountId32AsNative<RelayNetwork, Origin>,649	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.650	XcmPassthrough<Origin>,651);652653parameter_types! {654	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.655	pub UnitWeightCost: Weight = 1_000_000;656	// 1200 UNIQUEs buy 1 second of weight.657	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);658	pub const MaxInstructions: u32 = 100;659	pub const MaxAuthorities: u32 = 100_000;660}661662match_type! {663	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {664		MultiLocation { parents: 1, interior: Here } |665		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }666	};667}668669pub type Barrier = (670	TakeWeightCredit,671	AllowTopLevelPaidExecutionFrom<Everything>,672	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,673	// ^^^ Parent & its unit plurality gets free execution674);675676pub struct UsingOnlySelfCurrencyComponents<677	WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,678	AssetId: Get<MultiLocation>,679	AccountId,680	Currency: CurrencyT<AccountId>,681	OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,682>(683	Weight,684	Currency::Balance,685	PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,686);687impl<688		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,689		AssetId: Get<MultiLocation>,690		AccountId,691		Currency: CurrencyT<AccountId>,692		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,693	> WeightTrader694	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>695{696	fn new() -> Self {697		Self(0, Zero::zero(), PhantomData)698	}699700	fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {701		let amount = WeightToFee::calc(&weight);702		let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;703704		// location to this parachain through relay chain705		let option1: xcm::v1::AssetId = Concrete(MultiLocation {706			parents: 1,707			interior: X1(Parachain(ParachainInfo::parachain_id().into())),708		});709		// direct location710		let option2: xcm::v1::AssetId = Concrete(MultiLocation {711			parents: 0,712			interior: Here,713		});714715		let required = if payment.fungible.contains_key(&option1) {716			(option1, u128_amount).into()717		} else if payment.fungible.contains_key(&option2) {718			(option2, u128_amount).into()719		} else {720			(Concrete(MultiLocation::default()), u128_amount).into()721		};722723		let unused = payment724			.checked_sub(required)725			.map_err(|_| XcmError::TooExpensive)?;726		self.0 = self.0.saturating_add(weight);727		self.1 = self.1.saturating_add(amount);728		Ok(unused)729	}730731	fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {732		let weight = weight.min(self.0);733		let amount = WeightToFee::calc(&weight);734		self.0 -= weight;735		self.1 = self.1.saturating_sub(amount);736		let amount: u128 = amount.saturated_into();737		if amount > 0 {738			Some((AssetId::get(), amount).into())739		} else {740			None741		}742	}743}744impl<745		WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,746		AssetId: Get<MultiLocation>,747		AccountId,748		Currency: CurrencyT<AccountId>,749		OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,750	> Drop751	for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>752{753	fn drop(&mut self) {754		OnUnbalanced::on_unbalanced(Currency::issue(self.1));755	}756}757758pub struct XcmConfig;759impl Config for XcmConfig {760	type Call = Call;761	type XcmSender = XcmRouter;762	// How to withdraw and deposit an asset.763	type AssetTransactor = LocalAssetTransactor;764	type OriginConverter = XcmOriginToTransactDispatchOrigin;765	type IsReserve = NativeAsset;766	type IsTeleporter = (); // Teleportation is disabled767	type LocationInverter = LocationInverter<Ancestry>;768	type Barrier = Barrier;769	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;770	type Trader = UsingOnlySelfCurrencyComponents<771		IdentityFee<Balance>,772		RelayLocation,773		AccountId,774		Balances,775		(),776	>;777	type ResponseHandler = (); // Don't handle responses for now.778	type SubscriptionService = PolkadotXcm;779780	type AssetTrap = PolkadotXcm;781	type AssetClaims = PolkadotXcm;782}783784// parameter_types! {785// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;786// }787788/// No local origins on this chain are allowed to dispatch XCM sends/executions.789pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);790791/// The means for routing XCM messages which are not for local execution into the right message792/// queues.793pub type XcmRouter = (794	// Two routers - use UMP to communicate with the relay chain:795	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,796	// ..and XCMP to communicate with the sibling chains.797	XcmpQueue,798);799800impl pallet_evm_coder_substrate::Config for Runtime {801	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;802	type GasWeightMapping = FixedGasWeightMapping;803}804805impl pallet_xcm::Config for Runtime {806	type Event = Event;807	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;808	type XcmRouter = XcmRouter;809	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;810	type XcmExecuteFilter = Everything;811	type XcmExecutor = XcmExecutor<XcmConfig>;812	type XcmTeleportFilter = Everything;813	type XcmReserveTransferFilter = Everything;814	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;815	type LocationInverter = LocationInverter<Ancestry>;816	type Origin = Origin;817	type Call = Call;818	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;819	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;820}821822impl cumulus_pallet_xcm::Config for Runtime {823	type Event = Event;824	type XcmExecutor = XcmExecutor<XcmConfig>;825}826827impl cumulus_pallet_xcmp_queue::Config for Runtime {828	type Event = Event;829	type XcmExecutor = XcmExecutor<XcmConfig>;830	type ChannelInfo = ParachainSystem;831	type VersionWrapper = ();832	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;833	type ControllerOrigin = EnsureRoot<AccountId>;834	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;835}836837impl cumulus_pallet_dmp_queue::Config for Runtime {838	type Event = Event;839	type XcmExecutor = XcmExecutor<XcmConfig>;840	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;841}842843impl pallet_aura::Config for Runtime {844	type AuthorityId = AuraId;845	type DisabledValidators = ();846	type MaxAuthorities = MaxAuthorities;847}848849parameter_types! {850	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();851	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;852}853854impl pallet_common::Config for Runtime {855	type Event = Event;856	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;857	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;858	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;859860	type Currency = Balances;861	type CollectionCreationPrice = CollectionCreationPrice;862	type TreasuryAccountId = TreasuryAccountId;863}864865impl pallet_fungible::Config for Runtime {866	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;867}868impl pallet_refungible::Config for Runtime {869	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;870}871impl pallet_nonfungible::Config for Runtime {872	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;873}874875impl pallet_unique::Config for Runtime {876	type Event = Event;877	type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;878}879880parameter_types! {881	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied882}883884/// Used for the pallet inflation885impl pallet_inflation::Config for Runtime {886	type Currency = Balances;887	type TreasuryAccountId = TreasuryAccountId;888	type InflationBlockInterval = InflationBlockInterval;889	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;890}891892// parameter_types! {893// 	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *894// 		RuntimeBlockWeights::get().max_block;895// 	pub const MaxScheduledPerBlock: u32 = 50;896// }897898type EvmSponsorshipHandler = (899	pallet_unique::UniqueEthSponsorshipHandler<Runtime>,900	pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,901);902type SponsorshipHandler = (903	pallet_unique::UniqueSponsorshipHandler<Runtime>,904	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,905	pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,906);907908// impl pallet_unq_scheduler::Config for Runtime {909// 	type Event = Event;910// 	type Origin = Origin;911// 	type PalletsOrigin = OriginCaller;912// 	type Call = Call;913// 	type MaximumWeight = MaximumSchedulerWeight;914// 	type ScheduleOrigin = EnsureSigned<AccountId>;915// 	type MaxScheduledPerBlock = MaxScheduledPerBlock;916// 	type SponsorshipHandler = SponsorshipHandler;917// 	type WeightInfo = ();918// }919920impl pallet_evm_transaction_payment::Config for Runtime {921	type EvmSponsorshipHandler = EvmSponsorshipHandler;922	type Currency = Balances;923	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;924	type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;925}926927impl pallet_charge_transaction::Config for Runtime {928	type SponsorshipHandler = SponsorshipHandler;929}930931// impl pallet_contract_helpers::Config for Runtime {932//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;933// }934935parameter_types! {936	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049937	pub const HelpersContractAddress: H160 = H160([938		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,939	]);940}941942impl pallet_evm_contract_helpers::Config for Runtime {943	type ContractAddress = HelpersContractAddress;944	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;945}946947construct_runtime!(948	pub enum Runtime where949		Block = Block,950		NodeBlock = opaque::Block,951		UncheckedExtrinsic = UncheckedExtrinsic952	{953		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,954		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,955956		Aura: pallet_aura::{Pallet, Config<T>} = 22,957		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,958959		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,960		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,961		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,962		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,963		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,964		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,965		System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,966		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,967		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,968		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,969970		// XCM helpers.971		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,972		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,973		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,974		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,975976		// Unique Pallets977		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,978		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,979		// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,980		// free = 63981		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,982		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,983		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,984		Fungible: pallet_fungible::{Pallet, Storage} = 67,985		Refungible: pallet_refungible::{Pallet, Storage} = 68,986		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,987988		// Frontier989		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,990		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,991992		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,993		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,994		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,995		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,996	}997);998999pub struct TransactionConverter;10001001impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {1002	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {1003		UncheckedExtrinsic::new_unsigned(1004			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1005		)1006	}1007}10081009impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1010	fn convert_transaction(1011		&self,1012		transaction: pallet_ethereum::Transaction,1013	) -> opaque::UncheckedExtrinsic {1014		let extrinsic = UncheckedExtrinsic::new_unsigned(1015			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1016		);1017		let encoded = extrinsic.encode();1018		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1019			.expect("Encoded extrinsic is always valid")1020	}1021}10221023/// The address format for describing accounts.1024pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1025/// Block header type as expected by this runtime.1026pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1027/// Block type as expected by this runtime.1028pub type Block = generic::Block<Header, UncheckedExtrinsic>;1029/// A Block signed with a Justification1030pub type SignedBlock = generic::SignedBlock<Block>;1031/// BlockId type as expected by this runtime.1032pub type BlockId = generic::BlockId<Block>;1033/// The SignedExtension to the basic transaction logic.1034pub type SignedExtra = (1035	frame_system::CheckSpecVersion<Runtime>,1036	// system::CheckTxVersion<Runtime>,1037	frame_system::CheckGenesis<Runtime>,1038	frame_system::CheckEra<Runtime>,1039	frame_system::CheckNonce<Runtime>,1040	frame_system::CheckWeight<Runtime>,1041	pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1042	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,1043);1044/// Unchecked extrinsic type as expected by this runtime.1045pub type UncheckedExtrinsic =1046	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1047/// Extrinsic type that has already been checked.1048pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1049/// Executive: handles dispatch to the various modules.1050pub type Executive = frame_executive::Executive<1051	Runtime,1052	Block,1053	frame_system::ChainContext<Runtime>,1054	Runtime,1055	AllPalletsReversedWithSystemFirst,1056>;10571058impl_opaque_keys! {1059	pub struct SessionKeys {1060		pub aura: Aura,1061	}1062}10631064impl fp_self_contained::SelfContainedCall for Call {1065	type SignedInfo = H160;10661067	fn is_self_contained(&self) -> bool {1068		match self {1069			Call::Ethereum(call) => call.is_self_contained(),1070			_ => false,1071		}1072	}10731074	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1075		match self {1076			Call::Ethereum(call) => call.check_self_contained(),1077			_ => None,1078		}1079	}10801081	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1082		match self {1083			Call::Ethereum(call) => call.validate_self_contained(info),1084			_ => None,1085		}1086	}10871088	fn pre_dispatch_self_contained(1089		&self,1090		info: &Self::SignedInfo,1091	) -> Option<Result<(), TransactionValidityError>> {1092		match self {1093			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1094			_ => None,1095		}1096	}10971098	fn apply_self_contained(1099		self,1100		info: Self::SignedInfo,1101	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1102		match self {1103			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1104				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1105			)),1106			_ => None,1107		}1108	}1109}11101111macro_rules! dispatch_unique_runtime {1112	($collection:ident.$method:ident($($name:ident),*)) => {{1113		use pallet_unique::dispatch::Dispatched;11141115		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1116		let dispatch = collection.as_dyn();11171118		Ok(dispatch.$method($($name),*))1119	}};1120}1121impl_runtime_apis! {1122	impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1123		for Runtime1124	{1125		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1126			dispatch_unique_runtime!(collection.account_tokens(account))1127		}1128		fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1129			dispatch_unique_runtime!(collection.token_exists(token))1130		}11311132		fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1133			dispatch_unique_runtime!(collection.token_owner(token))1134		}1135		fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1136			dispatch_unique_runtime!(collection.const_metadata(token))1137		}1138		fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1139			dispatch_unique_runtime!(collection.variable_metadata(token))1140		}11411142		fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1143			dispatch_unique_runtime!(collection.collection_tokens())1144		}1145		fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1146			dispatch_unique_runtime!(collection.account_balance(account))1147		}1148		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1149			dispatch_unique_runtime!(collection.balance(account, token))1150		}1151		fn allowance(1152			collection: CollectionId,1153			sender: CrossAccountId,1154			spender: CrossAccountId,1155			token: TokenId,1156		) -> Result<u128, DispatchError> {1157			dispatch_unique_runtime!(collection.allowance(sender, spender, token))1158		}11591160		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1161			<pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1162				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1163				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1164		}1165		fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1166			Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1167		}1168		fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1169			Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1170		}1171		fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1172			Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1173		}1174		fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1175			dispatch_unique_runtime!(collection.last_token_id())1176		}1177		fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1178			Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1179		}1180		fn collection_stats() -> Result<CollectionStats, DispatchError> {1181			Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1182		}1183	}11841185	impl sp_api::Core<Block> for Runtime {1186		fn version() -> RuntimeVersion {1187			VERSION1188		}11891190		fn execute_block(block: Block) {1191			Executive::execute_block(block)1192		}11931194		fn initialize_block(header: &<Block as BlockT>::Header) {1195			Executive::initialize_block(header)1196		}1197	}11981199	impl sp_api::Metadata<Block> for Runtime {1200		fn metadata() -> OpaqueMetadata {1201			OpaqueMetadata::new(Runtime::metadata().into())1202		}1203	}12041205	impl sp_block_builder::BlockBuilder<Block> for Runtime {1206		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1207			Executive::apply_extrinsic(extrinsic)1208		}12091210		fn finalize_block() -> <Block as BlockT>::Header {1211			Executive::finalize_block()1212		}12131214		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1215			data.create_extrinsics()1216		}12171218		fn check_inherents(1219			block: Block,1220			data: sp_inherents::InherentData,1221		) -> sp_inherents::CheckInherentsResult {1222			data.check_extrinsics(&block)1223		}12241225		// fn random_seed() -> <Block as BlockT>::Hash {1226		//     RandomnessCollectiveFlip::random_seed().01227		// }1228	}12291230	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1231		fn validate_transaction(1232			source: TransactionSource,1233			tx: <Block as BlockT>::Extrinsic,1234			hash: <Block as BlockT>::Hash,1235		) -> TransactionValidity {1236			Executive::validate_transaction(source, tx, hash)1237		}1238	}12391240	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1241		fn offchain_worker(header: &<Block as BlockT>::Header) {1242			Executive::offchain_worker(header)1243		}1244	}12451246	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1247		fn chain_id() -> u64 {1248			<Runtime as pallet_evm::Config>::ChainId::get()1249		}12501251		fn account_basic(address: H160) -> EVMAccount {1252			EVM::account_basic(&address)1253		}12541255		fn gas_price() -> U256 {1256			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1257		}12581259		fn account_code_at(address: H160) -> Vec<u8> {1260			EVM::account_codes(address)1261		}12621263		fn author() -> H160 {1264			<pallet_evm::Pallet<Runtime>>::find_author()1265		}12661267		fn storage_at(address: H160, index: U256) -> H256 {1268			let mut tmp = [0u8; 32];1269			index.to_big_endian(&mut tmp);1270			EVM::account_storages(address, H256::from_slice(&tmp[..]))1271		}12721273		#[allow(clippy::redundant_closure)]1274		fn call(1275			from: H160,1276			to: H160,1277			data: Vec<u8>,1278			value: U256,1279			gas_limit: U256,1280			max_fee_per_gas: Option<U256>,1281			max_priority_fee_per_gas: Option<U256>,1282			nonce: Option<U256>,1283			estimate: bool,1284			access_list: Option<Vec<(H160, Vec<H256>)>>,1285		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1286			let config = if estimate {1287				let mut config = <Runtime as pallet_evm::Config>::config().clone();1288				config.estimate = true;1289				Some(config)1290			} else {1291				None1292			};12931294			<Runtime as pallet_evm::Config>::Runner::call(1295				from,1296				to,1297				data,1298				value,1299				gas_limit.low_u64(),1300				max_fee_per_gas,1301				max_priority_fee_per_gas,1302				nonce,1303				access_list.unwrap_or_default(),1304				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1305			).map_err(|err| err.into())1306		}13071308		#[allow(clippy::redundant_closure)]1309		fn create(1310			from: H160,1311			data: Vec<u8>,1312			value: U256,1313			gas_limit: U256,1314			max_fee_per_gas: Option<U256>,1315			max_priority_fee_per_gas: Option<U256>,1316			nonce: Option<U256>,1317			estimate: bool,1318			access_list: Option<Vec<(H160, Vec<H256>)>>,1319		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1320			let config = if estimate {1321				let mut config = <Runtime as pallet_evm::Config>::config().clone();1322				config.estimate = true;1323				Some(config)1324			} else {1325				None1326			};13271328			<Runtime as pallet_evm::Config>::Runner::create(1329				from,1330				data,1331				value,1332				gas_limit.low_u64(),1333				max_fee_per_gas,1334				max_priority_fee_per_gas,1335				nonce,1336				access_list.unwrap_or_default(),1337				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1338			).map_err(|err| err.into())1339		}13401341		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1342			Ethereum::current_transaction_statuses()1343		}13441345		fn current_block() -> Option<pallet_ethereum::Block> {1346			Ethereum::current_block()1347		}13481349		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1350			Ethereum::current_receipts()1351		}13521353		fn current_all() -> (1354			Option<pallet_ethereum::Block>,1355			Option<Vec<pallet_ethereum::Receipt>>,1356			Option<Vec<TransactionStatus>>1357		) {1358			(1359				Ethereum::current_block(),1360				Ethereum::current_receipts(),1361				Ethereum::current_transaction_statuses()1362			)1363		}13641365		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1366			xts.into_iter().filter_map(|xt| match xt.0.function {1367				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1368				_ => None1369			}).collect()1370		}13711372		fn elasticity() -> Option<Permill> {1373			None1374		}1375	}13761377	impl sp_session::SessionKeys<Block> for Runtime {1378		fn decode_session_keys(1379			encoded: Vec<u8>,1380		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1381			SessionKeys::decode_into_raw_public_keys(&encoded)1382		}13831384		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1385			SessionKeys::generate(seed)1386		}1387	}13881389	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1390		fn slot_duration() -> sp_consensus_aura::SlotDuration {1391			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1392		}13931394		fn authorities() -> Vec<AuraId> {1395			Aura::authorities().to_vec()1396		}1397	}13981399	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1400		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1401			ParachainSystem::collect_collation_info(header)1402		}1403	}14041405	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1406		fn account_nonce(account: AccountId) -> Index {1407			System::account_nonce(account)1408		}1409	}14101411	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1412		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1413			TransactionPayment::query_info(uxt, len)1414		}1415		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1416			TransactionPayment::query_fee_details(uxt, len)1417		}1418	}14191420	/*1421	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1422		for Runtime1423	{1424		fn call(1425			origin: AccountId,1426			dest: AccountId,1427			value: Balance,1428			gas_limit: u64,1429			input_data: Vec<u8>,1430		) -> pallet_contracts_primitives::ContractExecResult {1431			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1432		}14331434		fn instantiate(1435			origin: AccountId,1436			endowment: Balance,1437			gas_limit: u64,1438			code: pallet_contracts_primitives::Code<Hash>,1439			data: Vec<u8>,1440			salt: Vec<u8>,1441		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1442		{1443			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1444		}14451446		fn get_storage(1447			address: AccountId,1448			key: [u8; 32],1449		) -> pallet_contracts_primitives::GetStorageResult {1450			Contracts::get_storage(address, key)1451		}14521453		fn rent_projection(1454			address: AccountId,1455		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1456			Contracts::rent_projection(address)1457		}1458	}1459	*/14601461	#[cfg(feature = "runtime-benchmarks")]1462	impl frame_benchmarking::Benchmark<Block> for Runtime {1463		fn benchmark_metadata(extra: bool) -> (1464			Vec<frame_benchmarking::BenchmarkList>,1465			Vec<frame_support::traits::StorageInfo>,1466		) {1467			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1468			use frame_support::traits::StorageInfoTrait;14691470			let mut list = Vec::<BenchmarkList>::new();14711472			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1473			list_benchmark!(list, extra, pallet_unique, Unique);1474			list_benchmark!(list, extra, pallet_inflation, Inflation);1475			list_benchmark!(list, extra, pallet_fungible, Fungible);1476			list_benchmark!(list, extra, pallet_refungible, Refungible);1477			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1478			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);14791480			let storage_info = AllPalletsReversedWithSystemFirst::storage_info();14811482			return (list, storage_info)1483		}14841485		fn dispatch_benchmark(1486			config: frame_benchmarking::BenchmarkConfig1487		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1488			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};14891490			let allowlist: Vec<TrackedStorageKey> = vec![1491				// Block Number1492				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1493				// Total Issuance1494				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1495				// Execution Phase1496				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1497				// Event Count1498				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1499				// System Events1500				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1501			];15021503			let mut batches = Vec::<BenchmarkBatch>::new();1504			let params = (&config, &allowlist);15051506			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1507			add_benchmark!(params, batches, pallet_unique, Unique);1508			add_benchmark!(params, batches, pallet_inflation, Inflation);1509			add_benchmark!(params, batches, pallet_fungible, Fungible);1510			add_benchmark!(params, batches, pallet_refungible, Refungible);1511			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1512			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);15131514			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1515			Ok(batches)1516		}1517	}1518}15191520struct CheckInherents;15211522impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1523	fn check_inherents(1524		block: &Block,1525		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1526	) -> sp_inherents::CheckInherentsResult {1527		let relay_chain_slot = relay_state_proof1528			.read_slot()1529			.expect("Could not read the relay chain slot from the proof");15301531		let inherent_data =1532			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1533				relay_chain_slot,1534				sp_std::time::Duration::from_secs(6),1535			)1536			.create_inherent_data()1537			.expect("Could not create the timestamp inherent data");15381539		inherent_data.check_extrinsics(block)1540	}1541}15421543cumulus_pallet_parachain_system::register_validate_block!(1544	Runtime = Runtime,1545	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1546	CheckInherents = CheckInherents,1547);
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -111,6 +111,8 @@
 // mod chain_extension;
 // use crate::chain_extension::{NFTExtension, Imbalance};
 
+pub const RUNTIME_NAME: &'static str = "Quartz";
+
 pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
 
 /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -111,6 +111,8 @@
 // mod chain_extension;
 // use crate::chain_extension::{NFTExtension, Imbalance};
 
+pub const RUNTIME_NAME: &'static str = "Unique";
+
 pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
 
 /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know