git.delta.rocks / unique-network / refs/commits / 32023b145527

difftreelog

Merge remote-tracking branch 'origin/develop' into feature/evm-coder-weights

Yaroslav Bolyukin2021-11-19parents: #ec4bf05 #51e104f.patch.diff
in: master

18 files changed

modifiedlaunch-config.jsondiffbeforeafterboth
--- a/launch-config.json
+++ b/launch-config.json
@@ -9,7 +9,6 @@
                 "rpcPort": 9843,
                 "port": 30444,
                 "flags": [
-                    "--rpc-port=9843",
                     "-lparachain::candidate_validation=debug"
                 ]
             },
@@ -19,7 +18,6 @@
                 "rpcPort": 9854,
                 "port": 30555,
                 "flags": [
-                    "--rpc-port=9854",
                     "-lparachain::candidate_validation=debug"
                 ]
             },
@@ -29,7 +27,6 @@
                 "rpcPort": 9865,
                 "port": 30666,
                 "flags": [
-                    "--rpc-port=9865",
                     "-lparachain::candidate_validation=debug"
                 ]
             },
@@ -39,7 +36,6 @@
                 "rpcPort": 9876,
                 "port": 30777,
                 "flags": [
-                    "--rpc-port=9876",
                     "-lparachain::candidate_validation=debug"
                 ]
             }
@@ -70,7 +66,6 @@
                     "name": "alice",
                     "flags": [
                         "--rpc-cors=all",
-                        "--rpc-port=9933",
                         "--unsafe-rpc-external",
                         "--unsafe-ws-external"
                     ]
@@ -82,7 +77,6 @@
                     "name": "bob",
                     "flags": [
                         "--rpc-cors=all",
-                        "--rpc-port=9934",
                         "--unsafe-rpc-external",
                         "--unsafe-ws-external"
                     ]
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -323,7 +323,7 @@
 			.checked_add(data.len() as u32)
 			.ok_or(ArithmeticError::Overflow)?;
 		ensure!(
-			tokens_minted < collection.limits.token_limit(),
+			tokens_minted <= collection.limits.token_limit(),
 			<CommonError<T>>::CollectionTokenLimitExceeded
 		);
 
modifiedruntime/Cargo.tomldiffbeforeafterboth
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -62,7 +62,7 @@
     'pallet-transaction-payment/std',
     'pallet-transaction-payment-rpc-runtime-api/std',
     'pallet-treasury/std',
-    'pallet-vesting/std',
+    # 'pallet-vesting/std',
     'pallet-evm/std',
     'pallet-evm-migration/std',
     'pallet-evm-contract-helpers/std',
@@ -99,6 +99,8 @@
     'xcm/std',
     'xcm-builder/std',
     'xcm-executor/std',
+
+    "orml-vesting/std",
 ]
 limit-testing = ['pallet-nft/limit-testing', 'nft-data-structs/limit-testing']
 
@@ -212,10 +214,10 @@
 git = 'https://github.com/paritytech/substrate.git'
 branch = 'polkadot-v0.9.12'
 
-[dependencies.pallet-vesting]
-default-features = false
-git = 'https://github.com/paritytech/substrate.git'
-branch = 'polkadot-v0.9.12'
+# [dependencies.pallet-vesting]
+# default-features = false
+# git = 'https://github.com/paritytech/substrate.git'
+# branch = 'polkadot-v0.9.12'
 
 [dependencies.sp-arithmetic]
 default-features = false
@@ -361,6 +363,10 @@
 branch = 'release-v0.9.12'
 default-features = false
 
+[dependencies.orml-vesting]
+git = "https://github.com/open-web3-stack/open-runtime-module-library"
+version = "0.4.1-dev" 
+default-features = false
 
 ################################################################################
 # local dependencies
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, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify,26		AccountIdConversion,27	},28	transaction_validity::{TransactionSource, TransactionValidity},29	ApplyExtrinsicResult, MultiSignature,30};3132use sp_std::prelude::*;3334#[cfg(feature = "std")]35use sp_version::NativeVersion;36use sp_version::RuntimeVersion;37pub use pallet_transaction_payment::{38	Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,39};40// A few exports that help ease life for downstream crates.41pub use pallet_balances::Call as BalancesCall;42pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};43pub use frame_support::{44	construct_runtime, match_type,45	dispatch::DispatchResult,46	PalletId, parameter_types, StorageValue, ConsensusEngineId,47	traits::{48		Everything, Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem,49		LockIdentifier, OnUnbalanced, Randomness, FindAuthor,50	},51	weights::{52		constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},53		DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,54		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,55	},56};57use nft_data_structs::*;58// use pallet_contracts::weights::WeightInfo;59// #[cfg(any(feature = "std", test))]60use frame_system::{61	self as system, EnsureRoot, EnsureSigned,62	limits::{BlockWeights, BlockLength},63};64use sp_arithmetic::{65	traits::{BaseArithmetic, Unsigned},66};67use smallvec::smallvec;68use codec::{Encode, Decode};69use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};70use fp_rpc::TransactionStatus;71use sp_core::crypto::Public;72use sp_runtime::{73	traits::{Dispatchable, PostDispatchInfoOf},74	transaction_validity::TransactionValidityError,75};7677// pub use pallet_timestamp::Call as TimestampCall;78pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;7980// Polkadot imports81use pallet_xcm::XcmPassthrough;82use polkadot_parachain::primitives::Sibling;83use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};84use xcm_builder::{85	AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,86	EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,87	ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,88	SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,89	SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,90};91use xcm_executor::{Config, XcmExecutor};9293// mod chain_extension;94// use crate::chain_extension::{NFTExtension, Imbalance};9596/// An index to a block.97pub type BlockNumber = u32;9899/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.100pub type Signature = MultiSignature;101102/// Some way of identifying an account on the chain. We intentionally make it equivalent103/// to the public key of our transaction signing scheme.104pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;105106pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;107108/// The type for looking up accounts. We don't expect more than 4 billion of them, but you109/// never know...110pub type AccountIndex = u32;111112/// Balance of an account.113pub type Balance = u128;114115/// Index of a transaction in the chain.116pub type Index = u32;117118/// A hash of some data used by the chain.119pub type Hash = sp_core::H256;120121/// Digest item type.122pub type DigestItem = generic::DigestItem<Hash>;123124/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know125/// the specifics of the runtime. They can then be made to be agnostic over specific formats126/// of data like extrinsics, allowing for them to continue syncing the network through upgrades127/// to even the core data structures.128pub mod opaque {129	use super::*;130131	pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;132133	/// Opaque block type.134	pub type Block = generic::Block<Header, UncheckedExtrinsic>;135136	pub type SessionHandlers = ();137138	impl_opaque_keys! {139		pub struct SessionKeys {140			pub aura: Aura,141		}142	}143}144145/// This runtime version.146pub const VERSION: RuntimeVersion = RuntimeVersion {147	spec_name: create_runtime_str!("opal"),148	impl_name: create_runtime_str!("opal"),149	authoring_version: 1,150	spec_version: 912202,151	impl_version: 1,152	apis: RUNTIME_API_VERSIONS,153	transaction_version: 1,154};155156pub const MILLISECS_PER_BLOCK: u64 = 12000;157158pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;159160// These time units are defined in number of blocks.161pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);162pub const HOURS: BlockNumber = MINUTES * 60;163pub const DAYS: BlockNumber = HOURS * 24;164165parameter_types! {166	pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;167}168169#[derive(codec::Encode, codec::Decode)]170pub enum XCMPMessage<XAccountId, XBalance> {171	/// Transfer tokens to the given account from the Parachain account.172	TransferToken(XAccountId, XBalance),173}174175/// The version information used to identify this runtime when compiled natively.176#[cfg(feature = "std")]177pub fn native_version() -> NativeVersion {178	NativeVersion {179		runtime_version: VERSION,180		can_author_with: Default::default(),181	}182}183184type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;185186pub struct DealWithFees;187impl OnUnbalanced<NegativeImbalance> for DealWithFees {188	fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {189		if let Some(fees) = fees_then_tips.next() {190			// for fees, 100% to treasury191			let mut split = fees.ration(100, 0);192			if let Some(tips) = fees_then_tips.next() {193				// for tips, if any, 100% to treasury194				tips.ration_merge_into(100, 0, &mut split);195			}196			Treasury::on_unbalanced(split.0);197			// Author::on_unbalanced(split.1);198		}199	}200}201202/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.203/// This is used to limit the maximal weight of a single extrinsic.204const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);205/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used206/// by  Operational  extrinsics.207const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);208/// We allow for 2 seconds of compute with a 6 second average block time.209const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;210211parameter_types! {212	pub const BlockHashCount: BlockNumber = 2400;213	pub RuntimeBlockLength: BlockLength =214		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);215	pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);216	pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;217	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()218		.base_block(BlockExecutionWeight::get())219		.for_class(DispatchClass::all(), |weights| {220			weights.base_extrinsic = ExtrinsicBaseWeight::get();221		})222		.for_class(DispatchClass::Normal, |weights| {223			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);224		})225		.for_class(DispatchClass::Operational, |weights| {226			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);227			// Operational transactions have some extra reserved space, so that they228			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.229			weights.reserved = Some(230				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT231			);232		})233		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)234		.build_or_panic();235	pub const Version: RuntimeVersion = VERSION;236	pub const SS58Prefix: u8 = 42;237}238239parameter_types! {240	pub const ChainId: u64 = 8888;241}242243pub struct FixedFee;244impl FeeCalculator for FixedFee {245	fn min_gas_price() -> U256 {246		// Targeting 0.15 UNQ per transfer247		(1 * MICROUNIQUE).into()248	}249}250251// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case252// (contract, which only writes a lot of data),253// approximating on top of our real store write weight254parameter_types! {255	pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;256	pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;257	pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();258}259260/// Limiting EVM execution to 50% of block for substrate users and management tasks261/// EVM transaction consumes more weight than substrate's, so we can't rely on them being262/// scheduled fairly263const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);264parameter_types! {265	pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());266}267268pub enum FixedGasWeightMapping {}269impl GasWeightMapping for FixedGasWeightMapping {270	fn gas_to_weight(gas: u64) -> Weight {271		gas.saturating_mul(WeightPerGas::get())272	}273	fn weight_to_gas(weight: Weight) -> u64 {274		weight / WeightPerGas::get()275	}276}277278impl pallet_evm::Config for Runtime {279	type BlockGasLimit = BlockGasLimit;280	type FeeCalculator = FixedFee;281	type GasWeightMapping = FixedGasWeightMapping;282	type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;283	type CallOrigin = EnsureAddressTruncated;284	type WithdrawOrigin = EnsureAddressTruncated;285	type AddressMapping = HashedAddressMapping<Self::Hashing>;286	type Precompiles = ();287	type Currency = Balances;288	type Event = Event;289	type OnMethodCall = (290		pallet_evm_migration::OnMethodCall<Self>,291		pallet_nft::NftErcSupport<Self>,292		pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,293	);294	type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;295	type ChainId = ChainId;296	type Runner = pallet_evm::runner::stack::Runner<Self>;297	type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;298	type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;299	type FindAuthor = EthereumFindAuthor<Aura>;300}301302impl pallet_evm_migration::Config for Runtime {303	type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;304}305306pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);307impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {308	fn find_author<'a, I>(digests: I) -> Option<H160>309	where310		I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,311	{312		if let Some(author_index) = F::find_author(digests) {313			let authority_id = Aura::authorities()[author_index as usize].clone();314			return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));315		}316		None317	}318}319320impl pallet_ethereum::Config for Runtime {321	type Event = Event;322	type StateRoot = pallet_ethereum::IntermediateStateRoot;323}324325impl pallet_randomness_collective_flip::Config for Runtime {}326327impl system::Config for Runtime {328	/// The data to be stored in an account.329	type AccountData = pallet_balances::AccountData<Balance>;330	/// The identifier used to distinguish between accounts.331	type AccountId = AccountId;332	/// The basic call filter to use in dispatchable.333	type BaseCallFilter = Everything;334	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).335	type BlockHashCount = BlockHashCount;336	/// The maximum length of a block (in bytes).337	type BlockLength = RuntimeBlockLength;338	/// The index type for blocks.339	type BlockNumber = BlockNumber;340	/// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.341	type BlockWeights = RuntimeBlockWeights;342	/// The aggregated dispatch type that is available for extrinsics.343	type Call = Call;344	/// The weight of database operations that the runtime can invoke.345	type DbWeight = RocksDbWeight;346	/// The ubiquitous event type.347	type Event = Event;348	/// The type for hashing blocks and tries.349	type Hash = Hash;350	/// The hashing algorithm used.351	type Hashing = BlakeTwo256;352	/// The header type.353	type Header = generic::Header<BlockNumber, BlakeTwo256>;354	/// The index type for storing how many extrinsics an account has signed.355	type Index = Index;356	/// The lookup mechanism to get account ID from whatever is passed in dispatchers.357	type Lookup = AccountIdLookup<AccountId, ()>;358	/// What to do if an account is fully reaped from the system.359	type OnKilledAccount = ();360	/// What to do if a new account is created.361	type OnNewAccount = ();362	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;363	/// The ubiquitous origin type.364	type Origin = Origin;365	/// This type is being generated by `construct_runtime!`.366	type PalletInfo = PalletInfo;367	/// This is used as an identifier of the chain. 42 is the generic substrate prefix.368	type SS58Prefix = SS58Prefix;369	/// Weight information for the extrinsics of this pallet.370	type SystemWeightInfo = system::weights::SubstrateWeight<Self>;371	/// Version of the runtime.372	type Version = Version;373}374375parameter_types! {376	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;377}378379impl pallet_timestamp::Config for Runtime {380	/// A timestamp: milliseconds since the unix epoch.381	type Moment = u64;382	type OnTimestampSet = ();383	type MinimumPeriod = MinimumPeriod;384	type WeightInfo = ();385}386387parameter_types! {388	// pub const ExistentialDeposit: u128 = 500;389	pub const ExistentialDeposit: u128 = 0;390	pub const MaxLocks: u32 = 50;391}392393impl pallet_balances::Config for Runtime {394	type MaxLocks = MaxLocks;395	type MaxReserves = ();396	type ReserveIdentifier = [u8; 8];397	/// The type for recording an account's balance.398	type Balance = Balance;399	/// The ubiquitous event type.400	type Event = Event;401	type DustRemoval = Treasury;402	type ExistentialDeposit = ExistentialDeposit;403	type AccountStore = System;404	type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;405}406407pub const MICROUNIQUE: Balance = 1_000_000_000;408pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;409pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;410pub const UNIQUE: Balance = 100 * CENTIUNIQUE;411412pub const fn deposit(items: u32, bytes: u32) -> Balance {413	items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE414}415416/*417parameter_types! {418	pub TombstoneDeposit: Balance = deposit(419		1,420		sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,421	);422	pub DepositPerContract: Balance = TombstoneDeposit::get();423	pub const DepositPerStorageByte: Balance = deposit(0, 1);424	pub const DepositPerStorageItem: Balance = deposit(1, 0);425	pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);426	pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;427	pub const SignedClaimHandicap: u32 = 2;428	pub const MaxDepth: u32 = 32;429	pub const MaxValueSize: u32 = 16 * 1024;430	pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb431	// The lazy deletion runs inside on_initialize.432	pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *433		RuntimeBlockWeights::get().max_block;434	// The weight needed for decoding the queue should be less or equal than a fifth435	// of the overall weight dedicated to the lazy deletion.436	pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (437			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -438			<Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)439		)) / 5) as u32;440	pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();441}442443impl pallet_contracts::Config for Runtime {444	type Time = Timestamp;445	type Randomness = RandomnessCollectiveFlip;446	type Currency = Balances;447	type Event = Event;448	type RentPayment = ();449	type SignedClaimHandicap = SignedClaimHandicap;450	type TombstoneDeposit = TombstoneDeposit;451	type DepositPerContract = DepositPerContract;452	type DepositPerStorageByte = DepositPerStorageByte;453	type DepositPerStorageItem = DepositPerStorageItem;454	type RentFraction = RentFraction;455	type SurchargeReward = SurchargeReward;456	type WeightPrice = pallet_transaction_payment::Pallet<Self>;457	type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;458	type ChainExtension = NFTExtension;459	type DeletionQueueDepth = DeletionQueueDepth;460	type DeletionWeightLimit = DeletionWeightLimit;461	type Schedule = Schedule;462	type CallStack = [pallet_contracts::Frame<Self>; 31];463}464*/465466parameter_types! {467	pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer468	/// This value increases the priority of `Operational` transactions by adding469	/// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.470	pub const OperationalFeeMultiplier: u8 = 5;471}472473/// Linear implementor of `WeightToFeePolynomial`474pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);475476impl<T> WeightToFeePolynomial for LinearFee<T>477where478	T: BaseArithmetic + From<u32> + Copy + Unsigned,479{480	type Balance = T;481482	fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {483		smallvec!(WeightToFeeCoefficient {484			coeff_integer: 146_700u32.into(), // Targeting 0.1 Unique per NFT transfer485			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}540541parameter_types! {542	pub const MinVestedTransfer: Balance = 10 * UNIQUE;543}544545impl pallet_vesting::Config for Runtime {546	type Event = Event;547	type Currency = Balances;548	type BlockNumberToBalance = ConvertInto;549	type MinVestedTransfer = MinVestedTransfer;550	type WeightInfo = ();551	const MAX_VESTING_SCHEDULES: u32 = 28;552}553554parameter_types! {555	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;556	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;557}558559impl cumulus_pallet_parachain_system::Config for Runtime {560	type Event = Event;561	type OnValidationData = ();562	type SelfParaId = parachain_info::Pallet<Self>;563	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<564	// 	MaxDownwardMessageWeight,565	// 	XcmExecutor<XcmConfig>,566	// 	Call,567	// >;568	type OutboundXcmpMessageSource = XcmpQueue;569	type DmpMessageHandler = DmpQueue;570	type ReservedDmpWeight = ReservedDmpWeight;571	type ReservedXcmpWeight = ReservedXcmpWeight;572	type XcmpMessageHandler = XcmpQueue;573}574575impl parachain_info::Config for Runtime {}576577impl cumulus_pallet_aura_ext::Config for Runtime {}578579parameter_types! {580	pub const RelayLocation: MultiLocation = MultiLocation::parent();581	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;582	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();583	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();584}585586/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used587/// when determining ownership of accounts for asset transacting and when attempting to use XCM588/// `Transact` in order to determine the dispatch Origin.589pub type LocationToAccountId = (590	// The parent (Relay-chain) origin converts to the default `AccountId`.591	ParentIsDefault<AccountId>,592	// Sibling parachain origins convert to AccountId via the `ParaId::into`.593	SiblingParachainConvertsVia<Sibling, AccountId>,594	// Straight up local `AccountId32` origins just alias directly to `AccountId`.595	AccountId32Aliases<RelayNetwork, AccountId>,596);597598/// Means for transacting assets on this chain.599pub type LocalAssetTransactor = CurrencyAdapter<600	// Use this currency:601	Balances,602	// Use this currency when it is a fungible asset matching the given location or name:603	IsConcrete<RelayLocation>,604	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:605	LocationToAccountId,606	// Our chain's account ID type (we can't get away without mentioning it explicitly):607	AccountId,608	// We don't track any teleports.609	(),610>;611612/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,613/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can614/// biases the kind of local `Origin` it will become.615pub type XcmOriginToTransactDispatchOrigin = (616	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location617	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for618	// foreign chains who want to have a local sovereign account on this chain which they control.619	SovereignSignedViaLocation<LocationToAccountId, Origin>,620	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when621	// recognised.622	RelayChainAsNative<RelayOrigin, Origin>,623	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when624	// recognised.625	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,626	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a627	// transaction from the Root origin.628	ParentAsSuperuser<Origin>,629	// Native signed account converter; this just converts an `AccountId32` origin into a normal630	// `Origin::Signed` origin of the same 32-byte value.631	SignedAccountId32AsNative<RelayNetwork, Origin>,632	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.633	XcmPassthrough<Origin>,634);635636parameter_types! {637	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.638	pub UnitWeightCost: Weight = 1_000_000;639	// 1200 UNIQUEs buy 1 second of weight.640	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);641	pub const MaxInstructions: u32 = 100;642	pub const MaxAuthorities: u32 = 100_000;643}644645match_type! {646	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {647		MultiLocation { parents: 1, interior: Here } |648		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }649	};650}651652pub type Barrier = (653	TakeWeightCredit,654	AllowTopLevelPaidExecutionFrom<Everything>,655	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,656	// ^^^ Parent & its unit plurality gets free execution657);658659pub struct XcmConfig;660impl Config for XcmConfig {661	type Call = Call;662	type XcmSender = XcmRouter;663	// How to withdraw and deposit an asset.664	type AssetTransactor = LocalAssetTransactor;665	type OriginConverter = XcmOriginToTransactDispatchOrigin;666	type IsReserve = NativeAsset;667	type IsTeleporter = (); // Teleportation is disabled668	type LocationInverter = LocationInverter<Ancestry>;669	type Barrier = Barrier;670	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;671	type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;672	type ResponseHandler = (); // Don't handle responses for now.673	type SubscriptionService = PolkadotXcm;674675	type AssetTrap = PolkadotXcm;676	type AssetClaims = PolkadotXcm;677}678679// parameter_types! {680// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;681// }682683/// No local origins on this chain are allowed to dispatch XCM sends/executions.684pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);685686/// The means for routing XCM messages which are not for local execution into the right message687/// queues.688pub type XcmRouter = (689	// Two routers - use UMP to communicate with the relay chain:690	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,691	// ..and XCMP to communicate with the sibling chains.692	XcmpQueue,693);694695impl pallet_evm_coder_substrate::Config for Runtime {696	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;697	type GasWeightMapping = FixedGasWeightMapping;698}699700impl pallet_xcm::Config for Runtime {701	type Event = Event;702	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;703	type XcmRouter = XcmRouter;704	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;705	type XcmExecuteFilter = Everything;706	type XcmExecutor = XcmExecutor<XcmConfig>;707	type XcmTeleportFilter = Everything;708	type XcmReserveTransferFilter = Everything;709	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;710	type LocationInverter = LocationInverter<Ancestry>;711	type Origin = Origin;712	type Call = Call;713	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;714	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;715}716717impl cumulus_pallet_xcm::Config for Runtime {718	type Event = Event;719	type XcmExecutor = XcmExecutor<XcmConfig>;720}721722impl cumulus_pallet_xcmp_queue::Config for Runtime {723	type Event = Event;724	type XcmExecutor = XcmExecutor<XcmConfig>;725	type ChannelInfo = ParachainSystem;726	type VersionWrapper = ();727}728729impl cumulus_pallet_dmp_queue::Config for Runtime {730	type Event = Event;731	type XcmExecutor = XcmExecutor<XcmConfig>;732	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;733}734735impl pallet_aura::Config for Runtime {736	type AuthorityId = AuraId;737	type DisabledValidators = ();738	type MaxAuthorities = MaxAuthorities;739}740741parameter_types! {742	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();743	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;744}745746impl pallet_common::Config for Runtime {747	type Event = Event;748	type EvmBackwardsAddressMapping = pallet_common::account::MapBackwardsAddressTruncated;749	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;750	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;751752	type Currency = Balances;753	type CollectionCreationPrice = CollectionCreationPrice;754	type TreasuryAccountId = TreasuryAccountId;755}756757impl pallet_fungible::Config for Runtime {758	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;759}760impl pallet_refungible::Config for Runtime {761	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;762}763impl pallet_nonfungible::Config for Runtime {764	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;765}766767/// Used for the pallet nft in `./nft.rs`768impl pallet_nft::Config for Runtime {769	type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;770}771772parameter_types! {773	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied774}775776/// Used for the pallet inflation777impl pallet_inflation::Config for Runtime {778	type Currency = Balances;779	type TreasuryAccountId = TreasuryAccountId;780	type InflationBlockInterval = InflationBlockInterval;781}782783parameter_types! {784	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *785		RuntimeBlockWeights::get().max_block;786	pub const MaxScheduledPerBlock: u32 = 50;787}788789pub struct Sponsoring;790impl SponsoringResolve<AccountId, Call> for Sponsoring {791	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>792	where793		Call: Dispatchable<Info = DispatchInfo>,794		AccountId: AsRef<[u8]>,795	{796		pallet_nft_transaction_payment::Module::<Runtime>::withdraw_type(who, call)797	}798}799800type SponsorshipHandler = (801	pallet_nft::NftSponsorshipHandler<Runtime>,802	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,803);804805impl pallet_unq_scheduler::Config for Runtime {806	type Event = Event;807	type Origin = Origin;808	type PalletsOrigin = OriginCaller;809	type Call = Call;810	type MaximumWeight = MaximumSchedulerWeight;811	type ScheduleOrigin = EnsureSigned<AccountId>;812	type MaxScheduledPerBlock = MaxScheduledPerBlock;813	type SponsorshipHandler = SponsorshipHandler;814	type WeightInfo = ();815}816817impl pallet_nft_transaction_payment::Config for Runtime {818	type SponsorshipHandler = SponsorshipHandler;819}820821impl pallet_evm_transaction_payment::Config for Runtime {822	type SponsorshipHandler = (823		pallet_nft::NftEthSponsorshipHandler<Self>,824		pallet_evm_contract_helpers::HelpersContractSponsoring<Self>,825	);826	type Currency = Balances;827}828829impl pallet_nft_charge_transaction::Config for Runtime {830	type SponsorshipHandler = pallet_nft::NftSponsorshipHandler<Runtime>;831}832833// impl pallet_contract_helpers::Config for Runtime {834//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;835// }836837parameter_types! {838	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049839	pub const HelpersContractAddress: H160 = H160([840		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,841	]);842}843844impl pallet_evm_contract_helpers::Config for Runtime {845	type ContractAddress = HelpersContractAddress;846	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;847}848849construct_runtime!(850	pub enum Runtime where851		Block = Block,852		NodeBlock = opaque::Block,853		UncheckedExtrinsic = UncheckedExtrinsic854	{855		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,856		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,857858		Aura: pallet_aura::{Pallet, Config<T>} = 22,859		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,860861		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,862		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,863		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,864		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,865		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,866		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,867		System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,868		Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,869		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,870871		// XCM helpers.872		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,873		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,874		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,875		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,876877		// Unique Pallets878		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,879		Nft: pallet_nft::{Pallet, Call, Storage} = 61,880		Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,881		NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage} = 63,882		Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage } = 64,883		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,884		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,885		Fungible: pallet_fungible::{Pallet, Storage} = 67,886		Refungible: pallet_refungible::{Pallet, Storage} = 68,887		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,888889		// Frontier890		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,891		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,892893		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,894		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,895		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,896		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,897	}898);899900pub struct TransactionConverter;901902impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {903	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {904		UncheckedExtrinsic::new_unsigned(905			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),906		)907	}908}909910impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {911	fn convert_transaction(912		&self,913		transaction: pallet_ethereum::Transaction,914	) -> opaque::UncheckedExtrinsic {915		let extrinsic = UncheckedExtrinsic::new_unsigned(916			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),917		);918		let encoded = extrinsic.encode();919		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])920			.expect("Encoded extrinsic is always valid")921	}922}923924/// The address format for describing accounts.925pub type Address = sp_runtime::MultiAddress<AccountId, ()>;926/// Block header type as expected by this runtime.927pub type Header = generic::Header<BlockNumber, BlakeTwo256>;928/// Block type as expected by this runtime.929pub type Block = generic::Block<Header, UncheckedExtrinsic>;930/// A Block signed with a Justification931pub type SignedBlock = generic::SignedBlock<Block>;932/// BlockId type as expected by this runtime.933pub type BlockId = generic::BlockId<Block>;934/// The SignedExtension to the basic transaction logic.935pub type SignedExtra = (936	system::CheckSpecVersion<Runtime>,937	// system::CheckTxVersion<Runtime>,938	system::CheckGenesis<Runtime>,939	system::CheckEra<Runtime>,940	system::CheckNonce<Runtime>,941	system::CheckWeight<Runtime>,942	pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,943	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,944);945/// Unchecked extrinsic type as expected by this runtime.946pub type UncheckedExtrinsic =947	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;948/// Extrinsic type that has already been checked.949pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;950/// Executive: handles dispatch to the various modules.951pub type Executive = frame_executive::Executive<952	Runtime,953	Block,954	frame_system::ChainContext<Runtime>,955	Runtime,956	AllPallets,957>;958959impl_opaque_keys! {960	pub struct SessionKeys {961		pub aura: Aura,962	}963}964965impl fp_self_contained::SelfContainedCall for Call {966	type SignedInfo = H160;967968	fn is_self_contained(&self) -> bool {969		match self {970			Call::Ethereum(call) => call.is_self_contained(),971			_ => false,972		}973	}974975	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {976		match self {977			Call::Ethereum(call) => call.check_self_contained(),978			_ => None,979		}980	}981982	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {983		match self {984			Call::Ethereum(call) => call.validate_self_contained(info),985			_ => None,986		}987	}988989	fn pre_dispatch_self_contained(990		&self,991		info: &Self::SignedInfo,992	) -> Option<Result<(), TransactionValidityError>> {993		match self {994			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),995			_ => None,996		}997	}998999	fn apply_self_contained(1000		self,1001		info: Self::SignedInfo,1002	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1003		match self {1004			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1005				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1006			)),1007			_ => None,1008		}1009	}1010}10111012macro_rules! dispatch_nft_runtime {1013	($collection:ident.$method:ident($($name:ident),*)) => {{1014		use pallet_nft::dispatch::Dispatched;10151016		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::new($collection).unwrap());1017		let dispatch = collection.as_dyn();10181019		dispatch.$method($($name),*)1020	}};1021}1022impl_runtime_apis! {1023	impl up_rpc::NftApi<Block, CrossAccountId, AccountId>1024		for Runtime1025	{1026		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId> {1027			dispatch_nft_runtime!(collection.account_tokens(account))1028		}1029		fn token_exists(collection: CollectionId, token: TokenId) -> bool {1030			dispatch_nft_runtime!(collection.token_exists(token))1031		}10321033		fn token_owner(collection: CollectionId, token: TokenId) -> CrossAccountId {1034			dispatch_nft_runtime!(collection.token_owner(token))1035		}1036		fn const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1037			dispatch_nft_runtime!(collection.const_metadata(token))1038		}1039		fn variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1040			dispatch_nft_runtime!(collection.variable_metadata(token))1041		}10421043		fn collection_tokens(collection: CollectionId) -> u32 {1044			dispatch_nft_runtime!(collection.collection_tokens())1045		}1046		fn account_balance(collection: CollectionId, account: CrossAccountId) -> u32 {1047			dispatch_nft_runtime!(collection.account_balance(account))1048		}1049		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> u128 {1050			dispatch_nft_runtime!(collection.balance(account, token))1051		}1052		fn allowance(1053			collection: CollectionId,1054			sender: CrossAccountId,1055			spender: CrossAccountId,1056			token: TokenId,1057		) -> u128 {1058			dispatch_nft_runtime!(collection.allowance(sender, spender, token))1059		}10601061		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1062			<pallet_nft::NftErcSupport<Runtime>>::get_code(&account)1063				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1064				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1065		}1066		fn adminlist(collection: CollectionId) -> Vec<CrossAccountId> {1067			<pallet_nft::Pallet<Runtime>>::adminlist(collection)1068		}1069		fn allowlist(collection: CollectionId) -> Vec<CrossAccountId> {1070			<pallet_nft::Pallet<Runtime>>::allowlist(collection)1071		}1072		fn last_token_id(collection: CollectionId) -> TokenId {1073			dispatch_nft_runtime!(collection.last_token_id())1074		}1075	}10761077	impl sp_api::Core<Block> for Runtime {1078		fn version() -> RuntimeVersion {1079			VERSION1080		}10811082		fn execute_block(block: Block) {1083			Executive::execute_block(block)1084		}10851086		fn initialize_block(header: &<Block as BlockT>::Header) {1087			Executive::initialize_block(header)1088		}1089	}10901091	impl sp_api::Metadata<Block> for Runtime {1092		fn metadata() -> OpaqueMetadata {1093			OpaqueMetadata::new(Runtime::metadata().into())1094		}1095	}10961097	impl sp_block_builder::BlockBuilder<Block> for Runtime {1098		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1099			Executive::apply_extrinsic(extrinsic)1100		}11011102		fn finalize_block() -> <Block as BlockT>::Header {1103			Executive::finalize_block()1104		}11051106		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1107			data.create_extrinsics()1108		}11091110		fn check_inherents(1111			block: Block,1112			data: sp_inherents::InherentData,1113		) -> sp_inherents::CheckInherentsResult {1114			data.check_extrinsics(&block)1115		}11161117		// fn random_seed() -> <Block as BlockT>::Hash {1118		//     RandomnessCollectiveFlip::random_seed().01119		// }1120	}11211122	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1123		fn validate_transaction(1124			source: TransactionSource,1125			tx: <Block as BlockT>::Extrinsic,1126			hash: <Block as BlockT>::Hash,1127		) -> TransactionValidity {1128			Executive::validate_transaction(source, tx, hash)1129		}1130	}11311132	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1133		fn offchain_worker(header: &<Block as BlockT>::Header) {1134			Executive::offchain_worker(header)1135		}1136	}11371138	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1139		fn chain_id() -> u64 {1140			<Runtime as pallet_evm::Config>::ChainId::get()1141		}11421143		fn account_basic(address: H160) -> EVMAccount {1144			EVM::account_basic(&address)1145		}11461147		fn gas_price() -> U256 {1148			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1149		}11501151		fn account_code_at(address: H160) -> Vec<u8> {1152			EVM::account_codes(address)1153		}11541155		fn author() -> H160 {1156			<pallet_evm::Pallet<Runtime>>::find_author()1157		}11581159		fn storage_at(address: H160, index: U256) -> H256 {1160			let mut tmp = [0u8; 32];1161			index.to_big_endian(&mut tmp);1162			EVM::account_storages(address, H256::from_slice(&tmp[..]))1163		}11641165		fn call(1166			from: H160,1167			to: H160,1168			data: Vec<u8>,1169			value: U256,1170			gas_limit: U256,1171			gas_price: Option<U256>,1172			nonce: Option<U256>,1173			estimate: bool,1174		) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1175			let config = if estimate {1176				let mut config = <Runtime as pallet_evm::Config>::config().clone();1177				config.estimate = true;1178				Some(config)1179			} else {1180				None1181			};11821183			<Runtime as pallet_evm::Config>::Runner::call(1184				from,1185				to,1186				data,1187				value,1188				gas_limit.low_u64(),1189				gas_price,1190				nonce,1191				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1192			).map_err(|err| err.into())1193		}11941195		fn create(1196			from: H160,1197			data: Vec<u8>,1198			value: U256,1199			gas_limit: U256,1200			gas_price: Option<U256>,1201			nonce: Option<U256>,1202			estimate: bool,1203		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1204			let config = if estimate {1205				let mut config = <Runtime as pallet_evm::Config>::config().clone();1206				config.estimate = true;1207				Some(config)1208			} else {1209				None1210			};12111212			<Runtime as pallet_evm::Config>::Runner::create(1213				from,1214				data,1215				value,1216				gas_limit.low_u64(),1217				gas_price,1218				nonce,1219				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1220			).map_err(|err| err.into())1221		}12221223		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1224			Ethereum::current_transaction_statuses()1225		}12261227		fn current_block() -> Option<pallet_ethereum::Block> {1228			Ethereum::current_block()1229		}12301231		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1232			Ethereum::current_receipts()1233		}12341235		fn current_all() -> (1236			Option<pallet_ethereum::Block>,1237			Option<Vec<pallet_ethereum::Receipt>>,1238			Option<Vec<TransactionStatus>>1239		) {1240			(1241				Ethereum::current_block(),1242				Ethereum::current_receipts(),1243				Ethereum::current_transaction_statuses()1244			)1245		}12461247		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1248			xts.into_iter().filter_map(|xt| match xt.0.function {1249				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1250				_ => None1251			}).collect()1252		}1253	}12541255	impl sp_session::SessionKeys<Block> for Runtime {1256		fn decode_session_keys(1257			encoded: Vec<u8>,1258		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1259			SessionKeys::decode_into_raw_public_keys(&encoded)1260		}12611262		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1263			SessionKeys::generate(seed)1264		}1265	}12661267	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1268		fn slot_duration() -> sp_consensus_aura::SlotDuration {1269			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1270		}12711272		fn authorities() -> Vec<AuraId> {1273			Aura::authorities().to_vec()1274		}1275	}12761277	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1278		fn collect_collation_info() -> cumulus_primitives_core::CollationInfo {1279			ParachainSystem::collect_collation_info()1280		}1281	}12821283	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1284		fn account_nonce(account: AccountId) -> Index {1285			System::account_nonce(account)1286		}1287	}12881289	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1290		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1291			TransactionPayment::query_info(uxt, len)1292		}1293		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1294			TransactionPayment::query_fee_details(uxt, len)1295		}1296	}12971298	/*1299	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1300		for Runtime1301	{1302		fn call(1303			origin: AccountId,1304			dest: AccountId,1305			value: Balance,1306			gas_limit: u64,1307			input_data: Vec<u8>,1308		) -> pallet_contracts_primitives::ContractExecResult {1309			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1310		}13111312		fn instantiate(1313			origin: AccountId,1314			endowment: Balance,1315			gas_limit: u64,1316			code: pallet_contracts_primitives::Code<Hash>,1317			data: Vec<u8>,1318			salt: Vec<u8>,1319		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1320		{1321			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1322		}13231324		fn get_storage(1325			address: AccountId,1326			key: [u8; 32],1327		) -> pallet_contracts_primitives::GetStorageResult {1328			Contracts::get_storage(address, key)1329		}13301331		fn rent_projection(1332			address: AccountId,1333		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1334			Contracts::rent_projection(address)1335		}1336	}1337	*/13381339	#[cfg(feature = "runtime-benchmarks")]1340	impl frame_benchmarking::Benchmark<Block> for Runtime {1341		fn benchmark_metadata(extra: bool) -> (1342			Vec<frame_benchmarking::BenchmarkList>,1343			Vec<frame_support::traits::StorageInfo>,1344		) {1345			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1346			use frame_support::traits::StorageInfoTrait;13471348			let mut list = Vec::<BenchmarkList>::new();13491350			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1351			list_benchmark!(list, extra, pallet_nft, Nft);1352			list_benchmark!(list, extra, pallet_inflation, Inflation);1353			list_benchmark!(list, extra, pallet_fungible, Fungible);1354			list_benchmark!(list, extra, pallet_refungible, Refungible);1355			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1356			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);13571358			let storage_info = AllPalletsWithSystem::storage_info();13591360			return (list, storage_info)1361		}13621363		fn dispatch_benchmark(1364			config: frame_benchmarking::BenchmarkConfig1365		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1366			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};13671368			let allowlist: Vec<TrackedStorageKey> = vec![1369				// Block Number1370				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1371				// Total Issuance1372				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1373				// Execution Phase1374				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1375				// Event Count1376				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1377				// System Events1378				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1379			];13801381			let mut batches = Vec::<BenchmarkBatch>::new();1382			let params = (&config, &allowlist);13831384			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1385			add_benchmark!(params, batches, pallet_nft, Nft);1386			add_benchmark!(params, batches, pallet_inflation, Inflation);1387			add_benchmark!(params, batches, pallet_fungible, Fungible);1388			add_benchmark!(params, batches, pallet_refungible, Refungible);1389			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1390			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);13911392			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1393			Ok(batches)1394		}1395	}1396}13971398struct CheckInherents;13991400impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1401	fn check_inherents(1402		block: &Block,1403		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1404	) -> sp_inherents::CheckInherentsResult {1405		let relay_chain_slot = relay_state_proof1406			.read_slot()1407			.expect("Could not read the relay chain slot from the proof");14081409		let inherent_data =1410			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1411				relay_chain_slot,1412				sp_std::time::Duration::from_secs(6),1413			)1414			.create_inherent_data()1415			.expect("Could not create the timestamp inherent data");14161417		inherent_data.check_extrinsics(block)1418	}1419}14201421cumulus_pallet_parachain_system::register_validate_block!(1422	Runtime = Runtime,1423	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1424	CheckInherents = CheckInherents,1425);
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 * MICROUNIQUE).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			coeff_integer: 146_700u32.into(), // Targeting 0.1 Unique per NFT transfer484			coeff_frac: Perbill::zero(),485			negative: false,486			degree: 1,487		})488	}489}490491impl pallet_transaction_payment::Config for Runtime {492	type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;493	type TransactionByteFee = TransactionByteFee;494	type OperationalFeeMultiplier = OperationalFeeMultiplier;495	type WeightToFee = LinearFee<Balance>;496	type FeeMultiplierUpdate = ();497}498499parameter_types! {500	pub const ProposalBond: Permill = Permill::from_percent(5);501	pub const ProposalBondMinimum: Balance = 1 * UNIQUE;502	pub const SpendPeriod: BlockNumber = 5 * MINUTES;503	pub const Burn: Permill = Permill::from_percent(0);504	pub const TipCountdown: BlockNumber = 1 * DAYS;505	pub const TipFindersFee: Percent = Percent::from_percent(20);506	pub const TipReportDepositBase: Balance = 1 * UNIQUE;507	pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;508	pub const BountyDepositBase: Balance = 1 * UNIQUE;509	pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;510	pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");511	pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;512	pub const MaximumReasonLength: u32 = 16384;513	pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);514	pub const BountyValueMinimum: Balance = 5 * UNIQUE;515	pub const MaxApprovals: u32 = 100;516}517518impl pallet_treasury::Config for Runtime {519	type PalletId = TreasuryModuleId;520	type Currency = Balances;521	type ApproveOrigin = EnsureRoot<AccountId>;522	type RejectOrigin = EnsureRoot<AccountId>;523	type Event = Event;524	type OnSlash = ();525	type ProposalBond = ProposalBond;526	type ProposalBondMinimum = ProposalBondMinimum;527	type SpendPeriod = SpendPeriod;528	type Burn = Burn;529	type BurnDestination = ();530	type SpendFunds = ();531	type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;532	type MaxApprovals = MaxApprovals;533}534535impl pallet_sudo::Config for Runtime {536	type Event = Event;537	type Call = Call;538}539540pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);541542impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider543	for RelayChainBlockNumberProvider<T>544{545	type BlockNumber = BlockNumber;546547	fn current_block_number() -> Self::BlockNumber {548		cumulus_pallet_parachain_system::Pallet::<T>::validation_data()549			.map(|d| d.relay_parent_number)550			.unwrap_or_default()551	}552}553554parameter_types! {555	pub const MinVestedTransfer: Balance = 10 * UNIQUE;556	pub const MaxVestingSchedules: u32 = 28;557}558559impl orml_vesting::Config for Runtime {560	type Event = Event;561	type Currency = pallet_balances::Pallet<Runtime>;562	type MinVestedTransfer = MinVestedTransfer;563	type VestedTransferOrigin = EnsureSigned<AccountId>;564	type WeightInfo = ();565	type MaxVestingSchedules = MaxVestingSchedules;566	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;567}568569parameter_types! {570	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;571	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;572}573574impl cumulus_pallet_parachain_system::Config for Runtime {575	type Event = Event;576	type OnValidationData = ();577	type SelfParaId = parachain_info::Pallet<Self>;578	// type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<579	// 	MaxDownwardMessageWeight,580	// 	XcmExecutor<XcmConfig>,581	// 	Call,582	// >;583	type OutboundXcmpMessageSource = XcmpQueue;584	type DmpMessageHandler = DmpQueue;585	type ReservedDmpWeight = ReservedDmpWeight;586	type ReservedXcmpWeight = ReservedXcmpWeight;587	type XcmpMessageHandler = XcmpQueue;588}589590impl parachain_info::Config for Runtime {}591592impl cumulus_pallet_aura_ext::Config for Runtime {}593594parameter_types! {595	pub const RelayLocation: MultiLocation = MultiLocation::parent();596	pub const RelayNetwork: NetworkId = NetworkId::Polkadot;597	pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();598	pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();599}600601/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used602/// when determining ownership of accounts for asset transacting and when attempting to use XCM603/// `Transact` in order to determine the dispatch Origin.604pub type LocationToAccountId = (605	// The parent (Relay-chain) origin converts to the default `AccountId`.606	ParentIsDefault<AccountId>,607	// Sibling parachain origins convert to AccountId via the `ParaId::into`.608	SiblingParachainConvertsVia<Sibling, AccountId>,609	// Straight up local `AccountId32` origins just alias directly to `AccountId`.610	AccountId32Aliases<RelayNetwork, AccountId>,611);612613/// Means for transacting assets on this chain.614pub type LocalAssetTransactor = CurrencyAdapter<615	// Use this currency:616	Balances,617	// Use this currency when it is a fungible asset matching the given location or name:618	IsConcrete<RelayLocation>,619	// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:620	LocationToAccountId,621	// Our chain's account ID type (we can't get away without mentioning it explicitly):622	AccountId,623	// We don't track any teleports.624	(),625>;626627/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,628/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can629/// biases the kind of local `Origin` it will become.630pub type XcmOriginToTransactDispatchOrigin = (631	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location632	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for633	// foreign chains who want to have a local sovereign account on this chain which they control.634	SovereignSignedViaLocation<LocationToAccountId, Origin>,635	// Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when636	// recognised.637	RelayChainAsNative<RelayOrigin, Origin>,638	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when639	// recognised.640	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,641	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a642	// transaction from the Root origin.643	ParentAsSuperuser<Origin>,644	// Native signed account converter; this just converts an `AccountId32` origin into a normal645	// `Origin::Signed` origin of the same 32-byte value.646	SignedAccountId32AsNative<RelayNetwork, Origin>,647	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.648	XcmPassthrough<Origin>,649);650651parameter_types! {652	// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.653	pub UnitWeightCost: Weight = 1_000_000;654	// 1200 UNIQUEs buy 1 second of weight.655	pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);656	pub const MaxInstructions: u32 = 100;657	pub const MaxAuthorities: u32 = 100_000;658}659660match_type! {661	pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {662		MultiLocation { parents: 1, interior: Here } |663		MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }664	};665}666667pub type Barrier = (668	TakeWeightCredit,669	AllowTopLevelPaidExecutionFrom<Everything>,670	AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,671	// ^^^ Parent & its unit plurality gets free execution672);673674pub struct XcmConfig;675impl Config for XcmConfig {676	type Call = Call;677	type XcmSender = XcmRouter;678	// How to withdraw and deposit an asset.679	type AssetTransactor = LocalAssetTransactor;680	type OriginConverter = XcmOriginToTransactDispatchOrigin;681	type IsReserve = NativeAsset;682	type IsTeleporter = (); // Teleportation is disabled683	type LocationInverter = LocationInverter<Ancestry>;684	type Barrier = Barrier;685	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;686	type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;687	type ResponseHandler = (); // Don't handle responses for now.688	type SubscriptionService = PolkadotXcm;689690	type AssetTrap = PolkadotXcm;691	type AssetClaims = PolkadotXcm;692}693694// parameter_types! {695// 	pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;696// }697698/// No local origins on this chain are allowed to dispatch XCM sends/executions.699pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);700701/// The means for routing XCM messages which are not for local execution into the right message702/// queues.703pub type XcmRouter = (704	// Two routers - use UMP to communicate with the relay chain:705	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,706	// ..and XCMP to communicate with the sibling chains.707	XcmpQueue,708);709710impl pallet_evm_coder_substrate::Config for Runtime {711	type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;712	type GasWeightMapping = FixedGasWeightMapping;713}714715impl pallet_xcm::Config for Runtime {716	type Event = Event;717	type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;718	type XcmRouter = XcmRouter;719	type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;720	type XcmExecuteFilter = Everything;721	type XcmExecutor = XcmExecutor<XcmConfig>;722	type XcmTeleportFilter = Everything;723	type XcmReserveTransferFilter = Everything;724	type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;725	type LocationInverter = LocationInverter<Ancestry>;726	type Origin = Origin;727	type Call = Call;728	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;729	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;730}731732impl cumulus_pallet_xcm::Config for Runtime {733	type Event = Event;734	type XcmExecutor = XcmExecutor<XcmConfig>;735}736737impl cumulus_pallet_xcmp_queue::Config for Runtime {738	type Event = Event;739	type XcmExecutor = XcmExecutor<XcmConfig>;740	type ChannelInfo = ParachainSystem;741	type VersionWrapper = ();742}743744impl cumulus_pallet_dmp_queue::Config for Runtime {745	type Event = Event;746	type XcmExecutor = XcmExecutor<XcmConfig>;747	type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;748}749750impl pallet_aura::Config for Runtime {751	type AuthorityId = AuraId;752	type DisabledValidators = ();753	type MaxAuthorities = MaxAuthorities;754}755756parameter_types! {757	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();758	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;759}760761impl pallet_common::Config for Runtime {762	type Event = Event;763	type EvmBackwardsAddressMapping = pallet_common::account::MapBackwardsAddressTruncated;764	type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;765	type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;766767	type Currency = Balances;768	type CollectionCreationPrice = CollectionCreationPrice;769	type TreasuryAccountId = TreasuryAccountId;770}771772impl pallet_fungible::Config for Runtime {773	type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;774}775impl pallet_refungible::Config for Runtime {776	type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;777}778impl pallet_nonfungible::Config for Runtime {779	type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;780}781782/// Used for the pallet nft in `./nft.rs`783impl pallet_nft::Config for Runtime {784	type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;785}786787parameter_types! {788	pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied789}790791/// Used for the pallet inflation792impl pallet_inflation::Config for Runtime {793	type Currency = Balances;794	type TreasuryAccountId = TreasuryAccountId;795	type InflationBlockInterval = InflationBlockInterval;796}797798parameter_types! {799	pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *800		RuntimeBlockWeights::get().max_block;801	pub const MaxScheduledPerBlock: u32 = 50;802}803804pub struct Sponsoring;805impl SponsoringResolve<AccountId, Call> for Sponsoring {806	fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>807	where808		Call: Dispatchable<Info = DispatchInfo>,809		AccountId: AsRef<[u8]>,810	{811		pallet_nft_transaction_payment::Module::<Runtime>::withdraw_type(who, call)812	}813}814815type SponsorshipHandler = (816	pallet_nft::NftSponsorshipHandler<Runtime>,817	//pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,818);819820impl pallet_unq_scheduler::Config for Runtime {821	type Event = Event;822	type Origin = Origin;823	type PalletsOrigin = OriginCaller;824	type Call = Call;825	type MaximumWeight = MaximumSchedulerWeight;826	type ScheduleOrigin = EnsureSigned<AccountId>;827	type MaxScheduledPerBlock = MaxScheduledPerBlock;828	type SponsorshipHandler = SponsorshipHandler;829	type WeightInfo = ();830}831832impl pallet_nft_transaction_payment::Config for Runtime {833	type SponsorshipHandler = SponsorshipHandler;834}835836impl pallet_evm_transaction_payment::Config for Runtime {837	type SponsorshipHandler = (838		pallet_nft::NftEthSponsorshipHandler<Self>,839		pallet_evm_contract_helpers::HelpersContractSponsoring<Self>,840	);841	type Currency = Balances;842}843844impl pallet_nft_charge_transaction::Config for Runtime {845	type SponsorshipHandler = pallet_nft::NftSponsorshipHandler<Runtime>;846}847848// impl pallet_contract_helpers::Config for Runtime {849//	 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;850// }851852parameter_types! {853	// 0x842899ECF380553E8a4de75bF534cdf6fBF64049854	pub const HelpersContractAddress: H160 = H160([855		0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,856	]);857}858859impl pallet_evm_contract_helpers::Config for Runtime {860	type ContractAddress = HelpersContractAddress;861	type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;862}863864construct_runtime!(865	pub enum Runtime where866		Block = Block,867		NodeBlock = opaque::Block,868		UncheckedExtrinsic = UncheckedExtrinsic869	{870		ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,871		ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,872873		Aura: pallet_aura::{Pallet, Config<T>} = 22,874		AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,875876		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,877		RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,878		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,879		TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,880		Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,881		Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,882		System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,883		Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,884		// Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,885		// Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,886887		// XCM helpers.888		XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,889		PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,890		CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,891		DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,892893		// Unique Pallets894		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,895		Nft: pallet_nft::{Pallet, Call, Storage} = 61,896		Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,897		NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage} = 63,898		Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage } = 64,899		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,900		Common: pallet_common::{Pallet, Storage, Event<T>} = 66,901		Fungible: pallet_fungible::{Pallet, Storage} = 67,902		Refungible: pallet_refungible::{Pallet, Storage} = 68,903		Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,904905		// Frontier906		EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,907		Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,908909		EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,910		EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,911		EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,912		EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,913	}914);915916pub struct TransactionConverter;917918impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {919	fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {920		UncheckedExtrinsic::new_unsigned(921			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),922		)923	}924}925926impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {927	fn convert_transaction(928		&self,929		transaction: pallet_ethereum::Transaction,930	) -> opaque::UncheckedExtrinsic {931		let extrinsic = UncheckedExtrinsic::new_unsigned(932			pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),933		);934		let encoded = extrinsic.encode();935		opaque::UncheckedExtrinsic::decode(&mut &encoded[..])936			.expect("Encoded extrinsic is always valid")937	}938}939940/// The address format for describing accounts.941pub type Address = sp_runtime::MultiAddress<AccountId, ()>;942/// Block header type as expected by this runtime.943pub type Header = generic::Header<BlockNumber, BlakeTwo256>;944/// Block type as expected by this runtime.945pub type Block = generic::Block<Header, UncheckedExtrinsic>;946/// A Block signed with a Justification947pub type SignedBlock = generic::SignedBlock<Block>;948/// BlockId type as expected by this runtime.949pub type BlockId = generic::BlockId<Block>;950/// The SignedExtension to the basic transaction logic.951pub type SignedExtra = (952	system::CheckSpecVersion<Runtime>,953	// system::CheckTxVersion<Runtime>,954	system::CheckGenesis<Runtime>,955	system::CheckEra<Runtime>,956	system::CheckNonce<Runtime>,957	system::CheckWeight<Runtime>,958	pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,959	//pallet_contract_helpers::ContractHelpersExtension<Runtime>,960);961/// Unchecked extrinsic type as expected by this runtime.962pub type UncheckedExtrinsic =963	fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;964/// Extrinsic type that has already been checked.965pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;966/// Executive: handles dispatch to the various modules.967pub type Executive = frame_executive::Executive<968	Runtime,969	Block,970	frame_system::ChainContext<Runtime>,971	Runtime,972	AllPallets,973>;974975impl_opaque_keys! {976	pub struct SessionKeys {977		pub aura: Aura,978	}979}980981impl fp_self_contained::SelfContainedCall for Call {982	type SignedInfo = H160;983984	fn is_self_contained(&self) -> bool {985		match self {986			Call::Ethereum(call) => call.is_self_contained(),987			_ => false,988		}989	}990991	fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {992		match self {993			Call::Ethereum(call) => call.check_self_contained(),994			_ => None,995		}996	}997998	fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {999		match self {1000			Call::Ethereum(call) => call.validate_self_contained(info),1001			_ => None,1002		}1003	}10041005	fn pre_dispatch_self_contained(1006		&self,1007		info: &Self::SignedInfo,1008	) -> Option<Result<(), TransactionValidityError>> {1009		match self {1010			Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1011			_ => None,1012		}1013	}10141015	fn apply_self_contained(1016		self,1017		info: Self::SignedInfo,1018	) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1019		match self {1020			call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1021				Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1022			)),1023			_ => None,1024		}1025	}1026}10271028macro_rules! dispatch_nft_runtime {1029	($collection:ident.$method:ident($($name:ident),*)) => {{1030		use pallet_nft::dispatch::Dispatched;10311032		let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::new($collection).unwrap());1033		let dispatch = collection.as_dyn();10341035		dispatch.$method($($name),*)1036	}};1037}1038impl_runtime_apis! {1039	impl up_rpc::NftApi<Block, CrossAccountId, AccountId>1040		for Runtime1041	{1042		fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Vec<TokenId> {1043			dispatch_nft_runtime!(collection.account_tokens(account))1044		}1045		fn token_exists(collection: CollectionId, token: TokenId) -> bool {1046			dispatch_nft_runtime!(collection.token_exists(token))1047		}10481049		fn token_owner(collection: CollectionId, token: TokenId) -> CrossAccountId {1050			dispatch_nft_runtime!(collection.token_owner(token))1051		}1052		fn const_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1053			dispatch_nft_runtime!(collection.const_metadata(token))1054		}1055		fn variable_metadata(collection: CollectionId, token: TokenId) -> Vec<u8> {1056			dispatch_nft_runtime!(collection.variable_metadata(token))1057		}10581059		fn collection_tokens(collection: CollectionId) -> u32 {1060			dispatch_nft_runtime!(collection.collection_tokens())1061		}1062		fn account_balance(collection: CollectionId, account: CrossAccountId) -> u32 {1063			dispatch_nft_runtime!(collection.account_balance(account))1064		}1065		fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> u128 {1066			dispatch_nft_runtime!(collection.balance(account, token))1067		}1068		fn allowance(1069			collection: CollectionId,1070			sender: CrossAccountId,1071			spender: CrossAccountId,1072			token: TokenId,1073		) -> u128 {1074			dispatch_nft_runtime!(collection.allowance(sender, spender, token))1075		}10761077		fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1078			<pallet_nft::NftErcSupport<Runtime>>::get_code(&account)1079				.or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1080				.or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1081		}1082		fn adminlist(collection: CollectionId) -> Vec<CrossAccountId> {1083			<pallet_nft::Pallet<Runtime>>::adminlist(collection)1084		}1085		fn allowlist(collection: CollectionId) -> Vec<CrossAccountId> {1086			<pallet_nft::Pallet<Runtime>>::allowlist(collection)1087		}1088		fn last_token_id(collection: CollectionId) -> TokenId {1089			dispatch_nft_runtime!(collection.last_token_id())1090		}1091	}10921093	impl sp_api::Core<Block> for Runtime {1094		fn version() -> RuntimeVersion {1095			VERSION1096		}10971098		fn execute_block(block: Block) {1099			Executive::execute_block(block)1100		}11011102		fn initialize_block(header: &<Block as BlockT>::Header) {1103			Executive::initialize_block(header)1104		}1105	}11061107	impl sp_api::Metadata<Block> for Runtime {1108		fn metadata() -> OpaqueMetadata {1109			OpaqueMetadata::new(Runtime::metadata().into())1110		}1111	}11121113	impl sp_block_builder::BlockBuilder<Block> for Runtime {1114		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1115			Executive::apply_extrinsic(extrinsic)1116		}11171118		fn finalize_block() -> <Block as BlockT>::Header {1119			Executive::finalize_block()1120		}11211122		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1123			data.create_extrinsics()1124		}11251126		fn check_inherents(1127			block: Block,1128			data: sp_inherents::InherentData,1129		) -> sp_inherents::CheckInherentsResult {1130			data.check_extrinsics(&block)1131		}11321133		// fn random_seed() -> <Block as BlockT>::Hash {1134		//     RandomnessCollectiveFlip::random_seed().01135		// }1136	}11371138	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1139		fn validate_transaction(1140			source: TransactionSource,1141			tx: <Block as BlockT>::Extrinsic,1142			hash: <Block as BlockT>::Hash,1143		) -> TransactionValidity {1144			Executive::validate_transaction(source, tx, hash)1145		}1146	}11471148	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1149		fn offchain_worker(header: &<Block as BlockT>::Header) {1150			Executive::offchain_worker(header)1151		}1152	}11531154	impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1155		fn chain_id() -> u64 {1156			<Runtime as pallet_evm::Config>::ChainId::get()1157		}11581159		fn account_basic(address: H160) -> EVMAccount {1160			EVM::account_basic(&address)1161		}11621163		fn gas_price() -> U256 {1164			<Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1165		}11661167		fn account_code_at(address: H160) -> Vec<u8> {1168			EVM::account_codes(address)1169		}11701171		fn author() -> H160 {1172			<pallet_evm::Pallet<Runtime>>::find_author()1173		}11741175		fn storage_at(address: H160, index: U256) -> H256 {1176			let mut tmp = [0u8; 32];1177			index.to_big_endian(&mut tmp);1178			EVM::account_storages(address, H256::from_slice(&tmp[..]))1179		}11801181		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		fn create(1212			from: H160,1213			data: Vec<u8>,1214			value: U256,1215			gas_limit: U256,1216			gas_price: Option<U256>,1217			nonce: Option<U256>,1218			estimate: bool,1219		) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1220			let config = if estimate {1221				let mut config = <Runtime as pallet_evm::Config>::config().clone();1222				config.estimate = true;1223				Some(config)1224			} else {1225				None1226			};12271228			<Runtime as pallet_evm::Config>::Runner::create(1229				from,1230				data,1231				value,1232				gas_limit.low_u64(),1233				gas_price,1234				nonce,1235				config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1236			).map_err(|err| err.into())1237		}12381239		fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1240			Ethereum::current_transaction_statuses()1241		}12421243		fn current_block() -> Option<pallet_ethereum::Block> {1244			Ethereum::current_block()1245		}12461247		fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1248			Ethereum::current_receipts()1249		}12501251		fn current_all() -> (1252			Option<pallet_ethereum::Block>,1253			Option<Vec<pallet_ethereum::Receipt>>,1254			Option<Vec<TransactionStatus>>1255		) {1256			(1257				Ethereum::current_block(),1258				Ethereum::current_receipts(),1259				Ethereum::current_transaction_statuses()1260			)1261		}12621263		fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1264			xts.into_iter().filter_map(|xt| match xt.0.function {1265				Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1266				_ => None1267			}).collect()1268		}1269	}12701271	impl sp_session::SessionKeys<Block> for Runtime {1272		fn decode_session_keys(1273			encoded: Vec<u8>,1274		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1275			SessionKeys::decode_into_raw_public_keys(&encoded)1276		}12771278		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1279			SessionKeys::generate(seed)1280		}1281	}12821283	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1284		fn slot_duration() -> sp_consensus_aura::SlotDuration {1285			sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1286		}12871288		fn authorities() -> Vec<AuraId> {1289			Aura::authorities().to_vec()1290		}1291	}12921293	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1294		fn collect_collation_info() -> cumulus_primitives_core::CollationInfo {1295			ParachainSystem::collect_collation_info()1296		}1297	}12981299	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1300		fn account_nonce(account: AccountId) -> Index {1301			System::account_nonce(account)1302		}1303	}13041305	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1306		fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1307			TransactionPayment::query_info(uxt, len)1308		}1309		fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1310			TransactionPayment::query_fee_details(uxt, len)1311		}1312	}13131314	/*1315	impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1316		for Runtime1317	{1318		fn call(1319			origin: AccountId,1320			dest: AccountId,1321			value: Balance,1322			gas_limit: u64,1323			input_data: Vec<u8>,1324		) -> pallet_contracts_primitives::ContractExecResult {1325			Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1326		}13271328		fn instantiate(1329			origin: AccountId,1330			endowment: Balance,1331			gas_limit: u64,1332			code: pallet_contracts_primitives::Code<Hash>,1333			data: Vec<u8>,1334			salt: Vec<u8>,1335		) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1336		{1337			Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1338		}13391340		fn get_storage(1341			address: AccountId,1342			key: [u8; 32],1343		) -> pallet_contracts_primitives::GetStorageResult {1344			Contracts::get_storage(address, key)1345		}13461347		fn rent_projection(1348			address: AccountId,1349		) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1350			Contracts::rent_projection(address)1351		}1352	}1353	*/13541355	#[cfg(feature = "runtime-benchmarks")]1356	impl frame_benchmarking::Benchmark<Block> for Runtime {1357		fn benchmark_metadata(extra: bool) -> (1358			Vec<frame_benchmarking::BenchmarkList>,1359			Vec<frame_support::traits::StorageInfo>,1360		) {1361			use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1362			use frame_support::traits::StorageInfoTrait;13631364			let mut list = Vec::<BenchmarkList>::new();13651366			list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1367			list_benchmark!(list, extra, pallet_nft, Nft);1368			list_benchmark!(list, extra, pallet_inflation, Inflation);1369			list_benchmark!(list, extra, pallet_fungible, Fungible);1370			list_benchmark!(list, extra, pallet_refungible, Refungible);1371			list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1372			// list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);13731374			let storage_info = AllPalletsWithSystem::storage_info();13751376			return (list, storage_info)1377		}13781379		fn dispatch_benchmark(1380			config: frame_benchmarking::BenchmarkConfig1381		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1382			use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};13831384			let allowlist: Vec<TrackedStorageKey> = vec![1385				// Block Number1386				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1387				// Total Issuance1388				hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1389				// Execution Phase1390				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1391				// Event Count1392				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1393				// System Events1394				hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1395			];13961397			let mut batches = Vec::<BenchmarkBatch>::new();1398			let params = (&config, &allowlist);13991400			add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1401			add_benchmark!(params, batches, pallet_nft, Nft);1402			add_benchmark!(params, batches, pallet_inflation, Inflation);1403			add_benchmark!(params, batches, pallet_fungible, Fungible);1404			add_benchmark!(params, batches, pallet_refungible, Refungible);1405			add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1406			// add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);14071408			if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1409			Ok(batches)1410		}1411	}1412}14131414struct CheckInherents;14151416impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1417	fn check_inherents(1418		block: &Block,1419		relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1420	) -> sp_inherents::CheckInherentsResult {1421		let relay_chain_slot = relay_state_proof1422			.read_slot()1423			.expect("Could not read the relay chain slot from the proof");14241425		let inherent_data =1426			cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1427				relay_chain_slot,1428				sp_std::time::Duration::from_secs(6),1429			)1430			.create_inherent_data()1431			.expect("Could not create the timestamp inherent data");14321433		inherent_data.check_extrinsics(block)1434	}1435}14361437cumulus_pallet_parachain_system::register_validate_block!(1438	Runtime = Runtime,1439	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1440	CheckInherents = CheckInherents,1441);
addedtests/src/eth/marketplace/MarketPlace.abidiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/marketplace/MarketPlace.abi
@@ -0,0 +1 @@
+[{"inputs":[{"internalType":"address","name":"_escrow","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_price","type":"uint256"},{"indexed":false,"internalType":"address","name":"_currencyCode","type":"address"},{"indexed":false,"internalType":"address","name":"_idCollection","type":"address"},{"indexed":false,"internalType":"uint256","name":"_idNFT","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"AddedAsk","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_idCollection","type":"address"},{"indexed":false,"internalType":"uint256","name":"_idNFT","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"orderID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"orderPrice","type":"uint256"}],"name":"BoughtNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_idCollection","type":"address"},{"indexed":false,"internalType":"uint256","name":"_idNFT","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"orderID","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"orderPrice","type":"uint256"}],"name":"BoughtNFT4KSM","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_idCollection","type":"address"},{"indexed":false,"internalType":"uint256","name":"_idNFT","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"CanceledAsk","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"DepositedKSM","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_price","type":"uint256"},{"indexed":false,"internalType":"address","name":"_currencyCode","type":"address"},{"indexed":false,"internalType":"address","name":"_idCollection","type":"address"},{"indexed":false,"internalType":"uint256","name":"_idNFT","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"_active","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"}],"name":"EditedAsk","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_currencyCode","type":"address"},{"indexed":false,"internalType":"address","name":"_sender","type":"address"}],"name":"Withdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"}],"name":"WithdrawnAllKSM","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"address","name":"_currencyCode","type":"address"},{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"}],"name":"addAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"asks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"asksbySeller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceKSM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"}],"name":"buy","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"},{"internalType":"address","name":"_buyer","type":"address"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"buyKSM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"}],"name":"cancelAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_sender","type":"address"}],"name":"depositKSM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"address","name":"_currencyCode","type":"address"},{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"},{"internalType":"uint8","name":"_active","type":"uint8"}],"name":"editAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"}],"name":"getOrder","outputs":[{"components":[{"internalType":"uint256","name":"idNFT","type":"uint256"},{"internalType":"address","name":"currencyCode","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"address","name":"idCollection","type":"address"},{"internalType":"address","name":"ownerAddr","type":"address"},{"internalType":"uint8","name":"flagActive","type":"uint8"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"tokenURI","type":"string"}],"internalType":"struct MarketPlace.Order","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOrdersLen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"orders","outputs":[{"internalType":"uint256","name":"idNFT","type":"uint256"},{"internalType":"address","name":"currencyCode","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"address","name":"idCollection","type":"address"},{"internalType":"address","name":"ownerAddr","type":"address"},{"internalType":"uint8","name":"flagActive","type":"uint8"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"tokenURI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newEscrow","type":"address"}],"name":"setEscrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_coin","type":"address"}],"name":"setNativeCoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newEscrow","type":"address"}],"name":"setowner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_currencyCode","type":"address"},{"internalType":"address payable","name":"_sender","type":"address"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"}],"name":"withdrawAllKSM","outputs":[{"internalType":"uint256","name":"lastBalance","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
\ No newline at end of file
addedtests/src/eth/marketplace/MarketPlace.bindiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/marketplace/MarketPlace.bin
@@ -0,0 +1 @@
+60806040523480156200001157600080fd5b50604051620029b8380380620029b8833981016040819052620000349162000327565b600580546001600160a01b038084166001600160a01b03199283161790925560068054821633179055604080516101408101825260008082526020808301828152838501838152606085018481526080860185815260a0870186815260c0880187815289518088018b5288815260e08a019081528a518089018c528981526101008b01528a51808901909b52888b526101208a019a909a528754600181018955978052885160099098027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563810198895595517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56487018054918e16918d1691909117905593517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56586015591517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e566850155517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56784018054918b16919099161790975595517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56882018054975160ff16600160a01b026001600160a81b0319909816919098161795909517909555915180519194929362000239937f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5699091019291019062000281565b5061010082015180516200025891600784019160209091019062000281565b5061012082015180516200027791600884019160209091019062000281565b5050505062000396565b8280546200028f9062000359565b90600052602060002090601f016020900481019282620002b35760008555620002fe565b82601f10620002ce57805160ff1916838001178555620002fe565b82800160010185558215620002fe579182015b82811115620002fe578251825591602001919060010190620002e1565b506200030c92915062000310565b5090565b5b808211156200030c576000815560010162000311565b6000602082840312156200033a57600080fd5b81516001600160a01b03811681146200035257600080fd5b9392505050565b600181811c908216806200036e57607f821691505b602082108114156200039057634e487b7160e01b600052602260045260246000fd5b50919050565b61261280620003a66000396000f3fe6080604052600436106101025760003560e01c806399f2d4eb11610095578063c10c354611610064578063c10c354614610221578063cce7ec1314610378578063e22d4f7d1461038b578063edb25841146103c3578063fd8868c7146103f057610184565b806399f2d4eb146102c5578063a85c38ef146102e5578063b460af941461031b578063b4c3e8ea1461034b57610184565b80636b084b25116100d15780636b084b2514610241578063791bd866146102615780638c088f001461028157806393cdd334146102a557610184565b806337c4eb58146101bf5780633ce61756146101e157806340b8074614610201578063592bd7051461022157610184565b366101845760405162461bcd60e51b815260206004820152604160248201527f43616e277420616363657074207061796d656e7420776974686f757420636f6c60448201527f6c656374696f6e20616e64204944732c20757365206441707020746f2073656e6064820152601960fa1b608482015260a4015b60405180910390fd5b60405162461bcd60e51b815260206004820152601060248201526f27379039bab1b410333ab731ba34b7b760811b604482015260640161017b565b3480156101cb57600080fd5b506101df6101da366004612054565b610410565b005b3480156101ed57600080fd5b506101df6101fc36600461209c565b610979565b34801561020d57600080fd5b506101df61021c3660046120c0565b6109c5565b34801561022d57600080fd5b506101df61023c36600461209c565b610c27565b34801561024d57600080fd5b506101df61025c3660046120ec565b610c73565b34801561026d57600080fd5b506101df61027c366004612151565b610ee6565b34801561028d57600080fd5b506000545b6040519081526020015b60405180910390f35b3480156102b157600080fd5b506102926102c036600461209c565b610fb1565b3480156102d157600080fd5b506102926102e03660046120c0565b61105e565b3480156102f157600080fd5b50610305610300366004612181565b61108f565b60405161029c9a999897969594939291906121f6565b34801561032757600080fd5b5061033b610336366004612283565b6112a0565b604051901515815260200161029c565b34801561035757600080fd5b5061029261036636600461209c565b60026020526000908152604090205481565b61033b6103863660046120c0565b6113d2565b34801561039757600080fd5b506102926103a63660046120c0565b600360209081526000928352604080842090915290825290205481565b3480156103cf57600080fd5b506103e36103de3660046120c0565b61181b565b60405161029c91906122c5565b3480156103fc57600080fd5b506101df61040b3660046123a5565b611b0c565b6040516331a9108f60e11b8152600481018290526000906001600160a01b03841690636352211e90602401602060405180830381865afa158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c91906123f8565b90506001600160a01b03811633146104d65760405162461bcd60e51b815260206004820152601d60248201527f4f6e6c7920746f6b656e206f776e65722063616e206d616b652061736b000000604482015260640161017b565b6060806060856001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561053a57506040513d6000823e601f3d908101601f19168201604052610537919081019061242b565b60015b61055557604051806020016040528060008152509250610558565b92505b856001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa9250505080156105b757506040513d6000823e601f3d908101601f191682016040526105b4919081019061242b565b60015b6105d2576040518060200160405280600081525091506105d5565b91505b60405163c87b56dd60e01b8152600481018690526001600160a01b0387169063c87b56dd90602401600060405180830381865afa92505050801561063b57506040513d6000823e601f3d908101601f19168201604052610638919081019061242b565b60015b6106545750604080516020810190915260008152610657565b90505b60408051610140810182528681526001600160a01b03808a1660208084019182529383018c815242606085019081528b8416608086019081523360a08701908152600160c0880181815260e089018d81526101008a018d90526101208a018c90526000805493840181558052895160099093027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563810193845597517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56489018054918b166001600160a01b031992831617905596517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56589015594517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56688015592517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567870180549189169190961617909455517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56885018054925160ff16600160a01b026001600160a81b03199093169190961617179093559151805193949293610828937f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e569909301929190910190611fa3565b506101008201518051610845916007840191602090910190611fa3565b506101208201518051610862916008840191602090910190611fa3565b505060008054909150610877906001906124ee565b6001600160a01b03881660008181526003602090815260408083208b84528252808320859055338084526004808452828520805460018101825590865293909420909201859055516323b872dd60e01b815293945091926323b872dd926108e492909130918c9101612505565b600060405180830381600087803b1580156108fe57600080fd5b505af1158015610912573d6000803e3d6000fd5b5050604080518c81526001600160a01b038c811660208301528b1681830152606081018a90526080810185905290517f83b3a8754d705365b581ab63c329c1e55255a22aa78c67b5fcef378bfb2d9b9993509081900360a0019150a1505050505050505050565b6006546001600160a01b031633146109a35760405162461bcd60e51b815260040161017b90612529565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0382166000908152600360209081526040808320848452909152812054815490913391839081106109ff576109ff612551565b60009182526020909120600560099092020101546001600160a01b031614610a695760405162461bcd60e51b815260206004820152601d60248201527f4f6e6c7920746f6b656e206f776e65722063616e20656469742061736b000000604482015260640161017b565b60008181548110610a7c57610a7c612551565b6000918252602090912060099091020160050154600160a01b900460ff16610adb5760405162461bcd60e51b8152602060048201526012602482015271151a1a5cc8185cdac81a5cc818db1bdcd95960721b604482015260640161017b565b4260008281548110610aef57610aef612551565b9060005260206000209060090201600301819055506000808281548110610b1857610b18612551565b906000526020600020906009020160050160146101000a81548160ff021916908360ff160217905550826001600160a01b03166323b872dd3060008481548110610b6457610b64612551565b60009182526020909120600560099092020101546040516001600160e01b031960e085901b168152610ba592916001600160a01b0316908790600401612505565b600060405180830381600087803b158015610bbf57600080fd5b505af1158015610bd3573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018690529081018490527f6330f58b476cc7f9dd8db8130a0fbb49b291ebc32531eb36e9646f56ee20174b9250606001905060405180910390a1505050565b6006546001600160a01b03163314610c515760405162461bcd60e51b815260040161017b90612529565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316600090815260036020908152604080832085845290915281205481549091339183908110610cad57610cad612551565b60009182526020909120600560099092020101546001600160a01b031614610d175760405162461bcd60e51b815260206004820152601d60248201527f4f6e6c7920746f6b656e206f776e65722063616e20656469742061736b000000604482015260640161017b565b60008181548110610d2a57610d2a612551565b6000918252602090912060099091020160050154600160a01b900460ff16610d895760405162461bcd60e51b8152602060048201526012602482015271151a1a5cc8185cdac81a5cc818db1bdcd95960721b604482015260640161017b565b8515610db9578560008281548110610da357610da3612551565b9060005260206000209060090201600201819055505b6001600160a01b03851615610e12578460008281548110610ddc57610ddc612551565b906000526020600020906009020160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b4260008281548110610e2657610e26612551565b9060005260206000209060090201600301819055508160008281548110610e4f57610e4f612551565b600091825260209182902060099190910201600501805460ff60a01b1916600160a01b60ff94851602179055604080518981526001600160a01b03898116938201939093529187169082015260608101859052908316608082015260a081018290527f04211d838289b72af597bf28a4ccff5a30d6056f5fce2eddb127ab4ffea0963d9060c00160405180910390a1505050505050565b6005546001600160a01b03163314610f325760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9032b9b1b937bb9031b0b760891b604482015260640161017b565b6001600160a01b038116600090815260026020526040902054610f56908390612567565b6001600160a01b038216600081815260026020908152604091829020939093558051858152928301919091527f291ce0b690061cb1b3f1111bf6500efe526983251fb0f863251ec3670d035fc4910160405180910390a15050565b6005546000906001600160a01b031633146110005760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9032b9b1b937bb9031b0b760891b604482015260640161017b565b506001600160a01b03811660008181526002602090815260408083208054939055805193845290830182905290917f027aeacbc6fbfa7fe735ff8f14a600469ad1a3197ce1c8c8a159641cf68fe592910160405180910390a1919050565b6004602052816000526040600020818154811061107a57600080fd5b90600052602060002001600091509150505481565b6000818154811061109f57600080fd5b600091825260209091206009909102018054600182015460028301546003840154600485015460058601546006870180549698506001600160a01b0395861697949693959283169492821693600160a01b90920460ff1692916111019061257f565b80601f016020809104026020016040519081016040528092919081815260200182805461112d9061257f565b801561117a5780601f1061114f5761010080835404028352916020019161117a565b820191906000526020600020905b81548152906001019060200180831161115d57829003601f168201915b50505050509080600701805461118f9061257f565b80601f01602080910402602001604051908101604052809291908181526020018280546111bb9061257f565b80156112085780601f106111dd57610100808354040283529160200191611208565b820191906000526020600020905b8154815290600101906020018083116111eb57829003601f168201915b50505050509080600801805461121d9061257f565b80601f01602080910402602001604051908101604052809291908181526020018280546112499061257f565b80156112965780601f1061126b57610100808354040283529160200191611296565b820191906000526020600020905b81548152906001019060200180831161127957829003601f168201915b505050505090508a565b6006546000906001600160a01b031633146112cd5760405162461bcd60e51b815260040161017b90612529565b6007546001600160a01b0384811691161461135b5760405163a9059cbb60e01b81526001600160a01b0383811660048301526024820186905284169063a9059cbb906044016020604051808303816000875af1158015611331573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135591906125ba565b50611382565b6040516001600160a01b0383169085156108fc029086906000818181858888f19450505050505b604080518581526001600160a01b03858116602083015284168183015290517fb524bace85e4ce0f8da306e32f39263c5724780ca00b7551c051c8e3dc36adaf9181900360600190a19392505050565b6001600160a01b0382166000908152600360209081526040808320848452909152812054815482918291811061140a5761140a612551565b600091825260209182902060408051610140810182526009939093029091018054835260018101546001600160a01b039081169484019490945260028101549183019190915260038101546060830152600481015483166080830152600581015492831660a0830152600160a01b90920460ff1660c082015260068201805491929160e08401919061149b9061257f565b80601f01602080910402602001604051908101604052809291908181526020018280546114c79061257f565b80156115145780601f106114e957610100808354040283529160200191611514565b820191906000526020600020905b8154815290600101906020018083116114f757829003601f168201915b5050505050815260200160078201805461152d9061257f565b80601f01602080910402602001604051908101604052809291908181526020018280546115599061257f565b80156115a65780601f1061157b576101008083540402835291602001916115a6565b820191906000526020600020905b81548152906001019060200180831161158957829003601f168201915b505050505081526020016008820180546115bf9061257f565b80601f01602080910402602001604051908101604052809291908181526020018280546115eb9061257f565b80156116385780601f1061160d57610100808354040283529160200191611638565b820191906000526020600020905b81548152906001019060200180831161161b57829003601f168201915b5050505050815250509050806040015134146116ac5760405162461bcd60e51b815260206004820152602d60248201527f4e6f7420726967687420616d6f756e742073656e742c206861766520746f206260448201526c6520657175616c20707269636560981b606482015260840161017b565b6001600160a01b0384166000908152600360209081526040808320868452909152812054815482919081106116e3576116e3612551565b906000526020600020906009020160050160146101000a81548160ff021916908360ff160217905550836001600160a01b03166323b872dd3033866040518463ffffffff1660e01b815260040161173c93929190612505565b600060405180830381600087803b15801561175657600080fd5b505af115801561176a573d6000803e3d6000fd5b505050508060a001516001600160a01b03166108fc82604001519081150290604051600060405180830381858888f16001600160a01b03891660008181526003602090815260408083208c8452825291829020548983015183519485529184018c90529183019190915260608201529096507fc220cf2a12d6492e23ed1141c55018997799699d009b00ebd5a4874c60f5c31e9450608001925061180c915050565b60405180910390a15092915050565b61188f6040518061014001604052806000815260200160006001600160a01b03168152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600060ff1681526020016060815260200160608152602001606081525090565b6001600160a01b038316600090815260036020908152604080832085845290915281205481549091908190839081106118ca576118ca612551565b600091825260209182902060408051610140810182526009939093029091018054835260018101546001600160a01b039081169484019490945260028101549183019190915260038101546060830152600481015483166080830152600581015492831660a0830152600160a01b90920460ff1660c082015260068201805491929160e08401919061195b9061257f565b80601f01602080910402602001604051908101604052809291908181526020018280546119879061257f565b80156119d45780601f106119a9576101008083540402835291602001916119d4565b820191906000526020600020905b8154815290600101906020018083116119b757829003601f168201915b505050505081526020016007820180546119ed9061257f565b80601f0160208091040260200160405190810160405280929190818152602001828054611a199061257f565b8015611a665780601f10611a3b57610100808354040283529160200191611a66565b820191906000526020600020905b815481529060010190602001808311611a4957829003601f168201915b50505050508152602001600882018054611a7f9061257f565b80601f0160208091040260200160405190810160405280929190818152602001828054611aab9061257f565b8015611af85780601f10611acd57610100808354040283529160200191611af8565b820191906000526020600020905b815481529060010190602001808311611adb57829003601f168201915b505050919092525091979650505050505050565b6001600160a01b038416600090815260036020908152604080832086845290915281205481548291908110611b4357611b43612551565b600091825260209182902060408051610140810182526009939093029091018054835260018101546001600160a01b039081169484019490945260028101549183019190915260038101546060830152600481015483166080830152600581015492831660a0830152600160a01b90920460ff1660c082015260068201805491929160e084019190611bd49061257f565b80601f0160208091040260200160405190810160405280929190818152602001828054611c009061257f565b8015611c4d5780601f10611c2257610100808354040283529160200191611c4d565b820191906000526020600020905b815481529060010190602001808311611c3057829003601f168201915b50505050508152602001600782018054611c669061257f565b80601f0160208091040260200160405190810160405280929190818152602001828054611c929061257f565b8015611cdf5780601f10611cb457610100808354040283529160200191611cdf565b820191906000526020600020905b815481529060010190602001808311611cc257829003601f168201915b50505050508152602001600882018054611cf89061257f565b80601f0160208091040260200160405190810160405280929190818152602001828054611d249061257f565b8015611d715780601f10611d4657610100808354040283529160200191611d71565b820191906000526020600020905b815481529060010190602001808311611d5457829003601f168201915b505050919092525050600554919250506001600160a01b0316331480611d9f5750336001600160a01b038416145b611df75760405162461bcd60e51b8152602060048201526024808201527f4f6e6c7920657363726f77206f722062757965722063616e2063616c6c206275604482015263794b534d60e01b606482015260840161017b565b6040808201516001600160a01b038516600090815260026020529190912054611e2091906124ee565b6001600160a01b03808516600090815260026020526040808220939093558383015160a085015190921681529190912054611e5b9190612567565b60a08201516001600160a01b039081166000908152600260209081526040808320949094559188168152600382528281208782529091529081205481548291908110611ea957611ea9612551565b906000526020600020906009020160050160146101000a81548160ff021916908360ff160217905550846001600160a01b03166323b872dd3084876040518463ffffffff1660e01b8152600401611f0293929190612505565b600060405180830381600087803b158015611f1c57600080fd5b505af1158015611f30573d6000803e3d6000fd5b505050506001600160a01b038516600081815260036020908152604080832088845282529182902054848301518351948552918401889052838301526060830152517f68bdd3548f3f05742b376651745ca73472eb18f2230f64b893d7a48e575eb0149181900360800190a15050505050565b828054611faf9061257f565b90600052602060002090601f016020900481019282611fd15760008555612017565b82601f10611fea57805160ff1916838001178555612017565b82800160010185558215612017579182015b82811115612017578251825591602001919060010190611ffc565b50612023929150612027565b5090565b5b808211156120235760008155600101612028565b6001600160a01b038116811461205157600080fd5b50565b6000806000806080858703121561206a57600080fd5b84359350602085013561207c8161203c565b9250604085013561208c8161203c565b9396929550929360600135925050565b6000602082840312156120ae57600080fd5b81356120b98161203c565b9392505050565b600080604083850312156120d357600080fd5b82356120de8161203c565b946020939093013593505050565b600080600080600060a0868803121561210457600080fd5b8535945060208601356121168161203c565b935060408601356121268161203c565b925060608601359150608086013560ff8116811461214357600080fd5b809150509295509295909350565b6000806040838503121561216457600080fd5b8235915060208301356121768161203c565b809150509250929050565b60006020828403121561219357600080fd5b5035919050565b60005b838110156121b557818101518382015260200161219d565b838111156121c4576000848401525b50505050565b600081518084526121e281602086016020860161219a565b601f01601f19169290920160200192915050565b8a81526001600160a01b038a81166020830152604082018a9052606082018990528781166080830152861660a082015260ff851660c082015261014060e08201819052600090612248838201876121ca565b905082810361010084015261225d81866121ca565b905082810361012084015261227281856121ca565b9d9c50505050505050505050505050565b60008060006060848603121561229857600080fd5b8335925060208401356122aa8161203c565b915060408401356122ba8161203c565b809150509250925092565b6020815281516020820152600060208301516122ec60408401826001600160a01b03169052565b506040830151606083015260608301516080830152608083015161231b60a08401826001600160a01b03169052565b5060a08301516001600160a01b03811660c08401525060c083015160ff811660e08401525060e0830151610140610100818186015261235e6101608601846121ca565b9250808601519050601f1961012081878603018188015261237f85846121ca565b90880151878203909201848801529350905061239b83826121ca565b9695505050505050565b600080600080608085870312156123bb57600080fd5b84356123c68161203c565b93506020850135925060408501356123dd8161203c565b915060608501356123ed8161203c565b939692955090935050565b60006020828403121561240a57600080fd5b81516120b98161203c565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561243d57600080fd5b815167ffffffffffffffff8082111561245557600080fd5b818401915084601f83011261246957600080fd5b81518181111561247b5761247b612415565b604051601f8201601f19908116603f011681019083821181831017156124a3576124a3612415565b816040528281528760208487010111156124bc57600080fd5b6124cd83602083016020880161219a565b979650505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015612500576125006124d8565b500390565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252600e908201526d27b7363c9037bbb732b91031b0b760911b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000821982111561257a5761257a6124d8565b500190565b600181811c9082168061259357607f821691505b602082108114156125b457634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156125cc57600080fd5b815180151581146120b957600080fdfea26469706673582212205a8295bbb792776496ccaaa9cb7384efe95af6490ca8015ceb6eb22e5ab3ae6b64736f6c634300080a0033
\ No newline at end of file
addedtests/src/eth/marketplace/MarketPlace.soldiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/marketplace/MarketPlace.sol
@@ -0,0 +1,390 @@
+// SPDX-License-Identifier:  Apache License
+pragma solidity >=0.8.0;
+import "../api/UniqueNFT.sol";
+
+// Inline
+interface ERC20Events {
+    event Transfer(address indexed from, address indexed to, uint256 value);
+    event Approval(
+        address indexed owner,
+        address indexed spender,
+        uint256 value
+    );
+}
+
+interface ERC20 is Dummy, ERC165, ERC20Events {
+    // Selector: name() 06fdde03
+    function name() external view returns (string memory);
+
+    // Selector: symbol() 95d89b41
+    function symbol() external view returns (string memory);
+
+    // Selector: totalSupply() 18160ddd
+    function totalSupply() external view returns (uint256);
+
+    // Selector: decimals() 313ce567
+    function decimals() external view returns (uint8);
+
+    // Selector: balanceOf(address) 70a08231
+    function balanceOf(address owner) external view returns (uint256);
+
+    // Selector: transfer(address,uint256) a9059cbb
+    function transfer(address to, uint256 amount) external returns (bool);
+
+    // Selector: transferFrom(address,address,uint256) 23b872dd
+    function transferFrom(
+        address from,
+        address to,
+        uint256 amount
+    ) external returns (bool);
+
+    // Selector: approve(address,uint256) 095ea7b3
+    function approve(address spender, uint256 amount) external returns (bool);
+
+    // Selector: allowance(address,address) dd62ed3e
+    function allowance(address owner, address spender)
+        external
+        view
+        returns (uint256);
+}
+
+interface UniqueFungible is Dummy, ERC165, ERC20 {}
+
+contract MarketPlace {
+    struct Order {
+        uint256 idNFT;
+        address currencyCode; // UNIQ tokens as address address (1); wKSM
+        uint256 price;
+        uint256 time;
+        address idCollection;
+        address ownerAddr;
+        uint8 flagActive;
+        string name;
+        string symbol;
+        string tokenURI;
+    }
+    Order[] public orders;
+    uint256 test;
+    mapping(address => uint256) public balanceKSM; //  [ownerAddr][currency] => [KSMs]
+    mapping(address => mapping(uint256 => uint256)) public asks; // [buyer][idCollection][idNFT] => idorder
+
+    mapping(address => uint256[]) public asksbySeller; // [addressSeller] =>idorder
+
+    address escrow;
+    address owner;
+    address nativecoin;
+
+    constructor(address _escrow) {
+        escrow = _escrow;
+        owner = msg.sender;
+
+        orders.push(
+            Order(0, address(0), 0, 0, address(0), address(0), 0, "", "", "")
+        );
+    }
+
+    function setowner(address _newEscrow) public onlyOwner {
+        escrow = _newEscrow;
+    }
+
+    function setEscrow(address _newEscrow) public onlyOwner {
+        escrow = _newEscrow;
+    }
+
+    function setNativeCoin(address _coin) public onlyOwner {
+        nativecoin = _coin;
+    }
+
+    modifier onlyEscrow() {
+        require(msg.sender == escrow, "Only escrow can");
+        _;
+    }
+
+    modifier onlyOwner() {
+        require(msg.sender == owner, "Only owner can");
+        _;
+    }
+
+    /**
+     * Make bids (orders) to sell NFTs
+     */
+
+    receive() external payable {
+        revert(
+            "Can't accept payment without collection and IDs, use dApp to send"
+        );
+    }
+
+    fallback() external payable {
+        revert("No such function");
+    }
+
+    event AddedAsk(
+        uint256 _price,
+        address _currencyCode,
+        address _idCollection,
+        uint256 _idNFT,
+        uint256 orderId
+    );
+    event EditedAsk(
+        uint256 _price,
+        address _currencyCode,
+        address _idCollection,
+        uint256 _idNFT,
+        uint8 _active,
+        uint256 orderId
+    );
+
+    event CanceledAsk(address _idCollection, uint256 _idNFT, uint256 orderId);
+
+    event DepositedKSM(uint256 _amount, address _sender);
+
+    event BoughtNFT4KSM(
+        address _idCollection,
+        uint256 _idNFT,
+        uint256 orderID,
+        uint256 orderPrice
+    );
+
+    event BoughtNFT(
+        address _idCollection,
+        uint256 _idNFT,
+        uint256 orderID,
+        uint256 orderPrice
+    );
+
+    event WithdrawnAllKSM(address _sender, uint256 balance);
+
+    event Withdrawn(uint256 _amount, address _currencyCode, address _sender);
+
+    function addAsk(
+        uint256 _price,
+        address _currencyCode,
+        address _idCollection,
+        uint256 _idNFT
+    ) public {
+        //
+        address ownerNFT = UniqueNFT(_idCollection).ownerOf(_idNFT);
+        require(ownerNFT == msg.sender, "Only token owner can make ask");
+        string memory nameNFT;
+        string memory symbolNFT;
+        string memory uriNFT;
+        try UniqueNFT(_idCollection).name() returns (string memory name_) {
+            nameNFT = name_;
+        } catch {
+            nameNFT = "";
+        }
+        try UniqueNFT(_idCollection).symbol() returns (string memory symbol_) {
+            symbolNFT = symbol_;
+        } catch {
+            symbolNFT = "";
+        }
+        try UniqueNFT(_idCollection).tokenURI(_idNFT) returns (
+            string memory uri_
+        ) {
+            uriNFT = uri_;
+        } catch {
+            uriNFT = "";
+        }
+        orders.push(
+            Order(
+                _idNFT,
+                _currencyCode,
+                _price,
+                block.timestamp,
+                _idCollection,
+                msg.sender,
+                1, // 1 = is active
+                nameNFT,
+                symbolNFT,
+                uriNFT
+            )
+        );
+
+        uint256 orderId = orders.length - 1;
+        asks[_idCollection][_idNFT] = orderId;
+        asksbySeller[msg.sender].push(orderId);
+        UniqueNFT(_idCollection).transferFrom(
+            msg.sender,
+            address(this),
+            _idNFT
+        );
+        emit AddedAsk(_price, _currencyCode, _idCollection, _idNFT, orderId);
+    }
+
+    function editAsk(
+        uint256 _price,
+        address _currencyCode,
+        address _idCollection,
+        uint256 _idNFT,
+        uint8 _active
+    ) public {
+        uint256 orderID = asks[_idCollection][_idNFT];
+
+        require(
+            orders[orderID].ownerAddr == msg.sender,
+            "Only token owner can edit ask"
+        );
+        require(orders[orderID].flagActive != 0, "This ask is closed");
+        if (_price > 0) {
+            orders[orderID].price = _price;
+        }
+
+        if (_currencyCode != address(0)) {
+            orders[orderID].currencyCode = _currencyCode;
+        }
+
+        orders[orderID].time = block.timestamp;
+        orders[orderID].flagActive = _active;
+
+        emit EditedAsk(
+            _price,
+            _currencyCode,
+            _idCollection,
+            _idNFT,
+            _active,
+            orderID
+        );
+    }
+
+    function cancelAsk(address _idCollection, uint256 _idNFT) public {
+        uint256 orderID = asks[_idCollection][_idNFT];
+
+        require(
+            orders[orderID].ownerAddr == msg.sender,
+            "Only token owner can edit ask"
+        );
+        require(orders[orderID].flagActive != 0, "This ask is closed");
+
+        orders[orderID].time = block.timestamp;
+        orders[orderID].flagActive = 0;
+        UniqueNFT(_idCollection).transferFrom(
+            address(this),
+            orders[orderID].ownerAddr,
+            _idNFT
+        );
+        emit CanceledAsk(_idCollection, _idNFT, orderID);
+    }
+
+    function depositKSM(uint256 _amount, address _sender) public onlyEscrow {
+        balanceKSM[_sender] = balanceKSM[_sender] + _amount;
+        emit DepositedKSM(_amount, _sender);
+    }
+
+    function buyKSM(
+        address _idCollection,
+        uint256 _idNFT,
+        address _buyer,
+        address _receiver
+    ) public {
+        Order memory order = orders[asks[_idCollection][_idNFT]];
+        require(msg.sender == escrow || msg.sender == _buyer, "Only escrow or buyer can call buyKSM" );
+        //1. reduce balance
+        balanceKSM[_buyer] = balanceKSM[_buyer] - order.price;
+        balanceKSM[order.ownerAddr] = balanceKSM[order.ownerAddr] + order.price;
+        // 2. close order
+        orders[asks[_idCollection][_idNFT]].flagActive = 0;
+        // 3. transfer NFT to buyer
+        UniqueNFT(_idCollection).transferFrom(address(this), _receiver, _idNFT);
+        emit BoughtNFT4KSM(
+            _idCollection,
+            _idNFT,
+            asks[_idCollection][_idNFT],
+            order.price
+        );
+    }
+
+    function buy(address _idCollection, uint256 _idNFT)
+        public
+        payable
+        returns (bool result)
+    {
+        //buing for UNQ like as ethers
+
+        Order memory order = orders[asks[_idCollection][_idNFT]];
+        //1. check sent amount and send to seller
+        require(
+            msg.value == order.price,
+            "Not right amount sent, have to be equal price"
+        );
+        // 2. close order
+        orders[asks[_idCollection][_idNFT]].flagActive = 0;
+
+        // 3. transfer NFT to buyer
+        UniqueNFT(_idCollection).transferFrom(
+            address(this),
+            msg.sender,
+            _idNFT
+        );
+        //uint balance  = address(this).balance;
+        result = payable(order.ownerAddr).send(order.price);
+        emit BoughtNFT(
+            _idCollection,
+            _idNFT,
+            asks[_idCollection][_idNFT],
+            order.price
+        );
+    }
+
+    /*
+        function buyOther (address _idCollection, uint256 _idNFT, address _currencyCode, uint _amount ) public  { //buy for sny token if seller wants
+
+            Order memory order = orders[ asks[_idCollection][_idNFT]];
+            //1. check sent amount and transfer from buyer to seller
+            require (order.price == _amount && order.currencyCode == _currencyCode, "Not right amount or currency sent, have to be equal currency and price" );
+            // !!! transfer have to be approved to marketplace!
+            IERC20(order.currencyCode).transferFrom(msg.sender, address(this), order.price); //to not disclojure buyer's address
+            IERC20(order.currencyCode).transfer(order.ownerAddr, order.price);
+            // 2. close order
+            orders[ asks[_idCollection][_idNFT]].flagActive = 0;
+            // 3. transfer NFT to buyer
+            IERC721ext(_idCollection).transferFrom(address(this), msg.sender, _idNFT);
+
+
+        }
+    */
+
+    function withdrawAllKSM(address _sender)
+        public
+        onlyEscrow
+        returns (uint256 lastBalance)
+    {
+        lastBalance = balanceKSM[_sender];
+        balanceKSM[_sender] = 0;
+        emit WithdrawnAllKSM(_sender, lastBalance);
+    }
+
+    function withdraw(
+        uint256 _amount,
+        address _currencyCode,
+        address payable _sender
+    ) public onlyOwner returns (bool result) {
+        if (_currencyCode != nativecoin) {
+            //erc20 compat. tokens on UNIQUE chain
+            // uint balance = IERC20(_currencyCode).balanceOf(address(this));
+            UniqueFungible(_currencyCode).transfer(_sender, _amount);
+        } else {
+            // uint balance  = address(this).balance;
+
+            result = (_sender).send(_amount); // for UNQ like as ethers
+        }
+        emit Withdrawn(_amount, _currencyCode, _sender);
+        return result;
+    }
+
+    // event GettedOrder(uint , Order);
+    function getOrder(address _idCollection, uint256 _idNFT)
+        public
+        view
+        returns (Order memory)
+    {
+        uint256 orderId = asks[_idCollection][_idNFT];
+        Order memory order = orders[orderId];
+        //       emit GettedOrder (orderId, order);
+        return order;
+    }
+
+    function getOrdersLen() public view returns (uint256) {
+        return orders.length;
+    }
+}
deletedtests/src/eth/marketplace/MarketPlaceKSM.abidiffbeforeafterboth
--- a/tests/src/eth/marketplace/MarketPlaceKSM.abi
+++ /dev/null
@@ -1 +0,0 @@
-[{"inputs":[{"internalType":"address","name":"_escrow","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"asks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"asksbySeller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"balanceKSM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"}],"name":"buy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_currencyCode","type":"uint256"},{"internalType":"address","name":"_sender","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_currencyCode","type":"uint256"},{"internalType":"address","name":"_sender","type":"address"}],"name":"escrowBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"offers","outputs":[{"internalType":"uint256","name":"idNFT","type":"uint256"},{"internalType":"uint256","name":"currencyCode","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"address","name":"idCollection","type":"address"},{"internalType":"address","name":"userAddr","type":"address"},{"internalType":"uint8","name":"flagActive","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_currencyCode","type":"uint256"},{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"},{"internalType":"uint8","name":"_active","type":"uint8"}],"name":"setAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newEscrow","type":"address"}],"name":"setEscrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newEscrow","type":"address"}],"name":"setowner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_currencyCode","type":"uint256"},{"internalType":"address","name":"_sender","type":"address"}],"name":"withdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
\ No newline at end of file
deletedtests/src/eth/marketplace/MarketPlaceKSM.bindiffbeforeafterboth
--- a/tests/src/eth/marketplace/MarketPlaceKSM.bin
+++ /dev/null
@@ -1 +0,0 @@
-608060405234801561001057600080fd5b50604051610e27380380610e2783398101604081905261002f9161005d565b600480546001600160a01b039092166001600160a01b0319928316179055600580549091163317905561008d565b60006020828403121561006f57600080fd5b81516001600160a01b038116811461008657600080fd5b9392505050565b610d8b8061009c6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806399f2d4eb1161007157806399f2d4eb1461018e5780639df55f52146101a1578063c10c35461461010f578063cce7ec13146101b4578063db87db52146101c7578063e22d4f7d146101fa57600080fd5b80630ad58d2f146100ae57806310a5ff17146100d6578063592bd7051461010f5780638a72ea6a146101245780638dbdbe6d1461017b575b600080fd5b6100c16100bc366004610c4d565b610225565b60405190151581526020015b60405180910390f35b6101016100e4366004610bd8565b600160209081526000928352604080842090915290825290205481565b6040519081526020016100cd565b61012261011d366004610b97565b6102d8565b005b610137610132366004610c04565b610345565b6040805197885260208801969096529486019390935260608501919091526001600160a01b0390811660808501521660a083015260ff1660c082015260e0016100cd565b610122610189366004610c4d565b6103a4565b61010161019c366004610bd8565b610449565b6101226101af366004610c86565b61047a565b6101226101c2366004610bd8565b610984565b6101016101d5366004610c1d565b6001600160a01b03166000908152600160209081526040808320938352929052205490565b610101610208366004610bd8565b600260209081526000928352604080842090915290825290205481565b6004546000906001600160a01b031633146102795760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9032b9b1b937bb9031b0b760891b60448201526064015b60405180910390fd5b6001600160a01b03821660009081526001602090815260408083208684529091529020546102a8908590610cfa565b6001600160a01b039290921660009081526001602081815260408084209684529590529390209190915550919050565b6005546001600160a01b031633146103235760405162461bcd60e51b815260206004820152600e60248201526d27b7363c9037bbb732b91031b0b760911b6044820152606401610270565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000818154811061035557600080fd5b6000918252602090912060069091020180546001820154600283015460038401546004850154600590950154939550919390926001600160a01b0391821691811690600160a01b900460ff1687565b6004546001600160a01b031633146103f05760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9032b9b1b937bb9031b0b760891b6044820152606401610270565b6001600160a01b038116600090815260016020908152604080832085845290915290205461041f908490610ce2565b6001600160a01b039091166000908152600160209081526040808320948352939052919091205550565b6003602052816000526040600020818154811061046557600080fd5b90600052602060002001600091509150505481565b6040516331a9108f60e11b81526004810183905233906001600160a01b03851690636352211e9060240160206040518083038186803b1580156104bc57600080fd5b505afa1580156104d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f49190610bbb565b6001600160a01b0316146105425760405162461bcd60e51b81526020600482015260156024820152742737ba103934b3b43a103a37b5b2b71037bbb732b960591b6044820152606401610270565b6001600160a01b0383166000908152600260209081526040808320858452909152812054905415806105ac575060006001600160a01b03166000828154811061058d5761058d610d27565b60009182526020909120600460069092020101546001600160a01b0316145b15610793576040805160e0810182528481526020810187815291810188815242606083019081526001600160a01b03808916608085019081523360a0860190815260ff808a1660c088019081526000805460018181018355828052995160069091027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381019190915599517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5648b015596517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5658a015594517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56689015591517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e567880180549185166001600160a01b0319909216919091179055517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56890960180549351909116600160a01b026001600160a81b031990931695909116949094171790925590546107399190610cfa565b6001600160a01b038516600090815260026020908152604080832087845282528083209390935533825260039052908120905461077890600190610cfa565b81546001810183556000928352602090922090910155610916565b6040805160e0810182526001600160a01b03861660009081526002602090815283822087835290529182205482549192839290919081106107d6576107d6610d27565b60009182526020808320600690920290910154835282810189905260408084018b90524260608501526001600160a01b0389168352600282528083208884529091528120548154608090930192811061083157610831610d27565b60009182526020808320600460069093020191909101546001600160a01b039081168452338483015260ff871660409485015288168252600281528282208783529052908120548154811061088857610888610d27565b60009182526020918290208351600690920201908155908201516001820155604082015160028201556060820151600382015560808201516004820180546001600160a01b039283166001600160a01b031990911617905560a08301516005909201805460c09094015160ff16600160a01b026001600160a81b031990941692909116919091179190911790555b6040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b038516906323b872dd90606401600060405180830381600087803b15801561096457600080fd5b505af1158015610978573d6000803e3d6000fd5b50505050505050505050565b6001600160a01b0382166000908152600260209081526040808320848452909152812054815482919081106109bb576109bb610d27565b600091825260208083206040805160e0810182526006949094029091018054845260018082015485850190815260028301548685018190526003840154606088015260048401546001600160a01b03908116608089015260059094015493841660a0880152600160a01b90930460ff1660c08701523387529084528286209051865290925290922054909250610a519190610cfa565b33600090815260016020818152604080842086830180518652908352818520959095558581015160a08701516001600160a01b031685529282528084209451845293905291902054610aa39190610ce2565b60a08201516001600160a01b0390811660009081526001602090815260408083208287015184528252808320949094559186168152600282528281208582529091529081205481548291908110610afc57610afc610d27565b60009182526020909120600560069092020101805460ff92909216600160a01b0260ff60a01b199092169190911790556040516323b872dd60e01b8152306004820152336024820152604481018390526001600160a01b038416906323b872dd90606401600060405180830381600087803b158015610b7a57600080fd5b505af1158015610b8e573d6000803e3d6000fd5b50505050505050565b600060208284031215610ba957600080fd5b8135610bb481610d3d565b9392505050565b600060208284031215610bcd57600080fd5b8151610bb481610d3d565b60008060408385031215610beb57600080fd5b8235610bf681610d3d565b946020939093013593505050565b600060208284031215610c1657600080fd5b5035919050565b60008060408385031215610c3057600080fd5b823591506020830135610c4281610d3d565b809150509250929050565b600080600060608486031215610c6257600080fd5b83359250602084013591506040840135610c7b81610d3d565b809150509250925092565b600080600080600060a08688031215610c9e57600080fd5b85359450602086013593506040860135610cb781610d3d565b925060608601359150608086013560ff81168114610cd457600080fd5b809150509295509295909350565b60008219821115610cf557610cf5610d11565b500190565b600082821015610d0c57610d0c610d11565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114610d5257600080fd5b5056fea2646970667358221220d098ae4e0cc7bdbb7de1061c03402a667836f903122c1c606ca2c65db1ab78e964736f6c63430008070033
\ No newline at end of file
deletedtests/src/eth/marketplace/MarketPlaceKSM.soldiffbeforeafterboth
--- a/tests/src/eth/marketplace/MarketPlaceKSM.sol
+++ /dev/null
@@ -1,179 +0,0 @@
-// SPDX-License-Identifier:  Apache License
-pragma solidity >=0.8.0;
-
-interface IERC721 {
-    event Transfer(
-        address indexed from,
-        address indexed to,
-        uint256 indexed tokenId
-    );
-    event Approval(
-        address indexed owner,
-        address indexed approved,
-        uint256 indexed tokenId
-    );
-
-    function ownerOf(uint256 tokenId) external view returns (address owner);
-
-    function transferFrom(
-        address from,
-        address to,
-        uint256 tokenId
-    ) external;
-
-    function debug(string memory value) external;
-}
-
-interface IERC20 {
-    event Transfer(address indexed from, address indexed to, uint256 value);
-    event Approval(
-        address indexed owner,
-        address indexed spender,
-        uint256 value
-    );
-
-    function transfer(address recipient, uint256 amount)
-        external
-        returns (bool);
-
-    function transferFrom(
-        address sender,
-        address recipient,
-        uint256 amount
-    ) external returns (bool);
-}
-
-contract MarketPlaceKSM {
-    struct Offer {
-        uint256 idNFT;
-        uint256 currencyCode;
-        uint256 price;
-        uint256 time;
-        address idCollection;
-        address userAddr;
-        uint8 flagActive;
-    }
-    Offer[] public offers;
-
-    mapping(address => mapping(uint256 => uint256)) public balanceKSM; //  [userAddr] => [KSMs]
-    mapping(address => mapping(uint256 => uint256)) public asks; // [buyer][idCollection][idNFT] => idOffer
-
-    mapping(address => uint256[]) public asksbySeller; // [addressSeller] =>idOffer
-
-    address escrow;
-    address owner;
-
-    constructor(address _escrow) {
-        escrow = _escrow;
-        owner = msg.sender;
-    }
-
-    function setowner(address _newEscrow) public onlyOwner {
-        escrow = _newEscrow;
-    }
-
-    function setEscrow(address _newEscrow) public onlyOwner {
-        escrow = _newEscrow;
-    }
-
-    modifier onlyEscrow() {
-        require(msg.sender == escrow, "Only escrow can");
-        _;
-    }
-
-    modifier onlyOwner() {
-        require(msg.sender == owner, "Only owner can");
-        _;
-    }
-
-    /**
-     * Make bids (offers) to sell NFTs
-     */
-    function setAsk(
-        uint256 _price,
-        uint256 _currencyCode,
-        address _idCollection,
-        uint256 _idNFT,
-        uint8 _active
-    ) public {
-        require(
-            IERC721(_idCollection).ownerOf(_idNFT) == msg.sender,
-            "Not right token owner"
-        );
-        uint256 offerID = asks[_idCollection][_idNFT];
-        if (offers.length == 0 || offers[offerID].idCollection == address(0)) {
-            offers.push(
-                Offer(
-                    _idNFT,
-                    _currencyCode,
-                    _price,
-                    block.timestamp,
-                    _idCollection,
-                    msg.sender,
-                    _active
-                )
-            );
-            asks[_idCollection][_idNFT] = offers.length - 1;
-            asksbySeller[msg.sender].push(offers.length - 1);
-        }
-        //edit existing offer
-        else {
-            offers[asks[_idCollection][_idNFT]] = Offer(
-                offers[asks[_idCollection][_idNFT]].idNFT,
-                _currencyCode,
-                _price,
-                block.timestamp,
-                offers[asks[_idCollection][_idNFT]].idCollection,
-                msg.sender,
-                _active
-            );
-        }
-
-        IERC721(_idCollection).transferFrom(msg.sender, address(this), _idNFT);
-    }
-
-    function deposit(
-        uint256 _amount,
-        uint256 _currencyCode,
-        address _sender
-    ) public onlyEscrow {
-        balanceKSM[_sender][_currencyCode] =
-            balanceKSM[_sender][_currencyCode] +
-            _amount;
-    }
-
-    function buy(address _idCollection, uint256 _idNFT) public {
-        Offer memory offer = offers[asks[_idCollection][_idNFT]];
-        // 1. reduce balance
-        balanceKSM[msg.sender][offer.currencyCode] =
-            balanceKSM[msg.sender][offer.currencyCode] -
-            offer.price;
-        // 2. increase balance
-        balanceKSM[offer.userAddr][offer.currencyCode] =
-            balanceKSM[offer.userAddr][offer.currencyCode] +
-            offer.price;
-        // 3. close offer
-        offers[asks[_idCollection][_idNFT]].flagActive = 0;
-        // 4. transfer NFT to buyer
-        IERC721(_idCollection).transferFrom(address(this), msg.sender, _idNFT);
-    }
-
-    function withdraw(
-        uint256 _amount,
-        uint256 _currencyCode,
-        address _sender
-    ) public onlyEscrow returns (bool) {
-        balanceKSM[_sender][_currencyCode] =
-            balanceKSM[_sender][_currencyCode] -
-            _amount;
-        return true;
-    }
-
-    function escrowBalance(uint256 _currencyCode, address _sender)
-        public
-        view
-        returns (uint256)
-    {
-        return balanceKSM[_sender][_currencyCode];
-    }
-}
deletedtests/src/eth/marketplace/MarketPlaceUNQ.abidiffbeforeafterboth
--- a/tests/src/eth/marketplace/MarketPlaceUNQ.abi
+++ /dev/null
@@ -1 +0,0 @@
-[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"asks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"asksbySeller","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"},{"internalType":"address","name":"_currencyCode","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"offers","outputs":[{"internalType":"uint256","name":"idNFT","type":"uint256"},{"internalType":"address","name":"currencyCode","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"time","type":"uint256"},{"internalType":"address","name":"idCollection","type":"address"},{"internalType":"address","name":"userAddr","type":"address"},{"internalType":"uint8","name":"flagActive","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"address","name":"_currencyCode","type":"address"},{"internalType":"address","name":"_idCollection","type":"address"},{"internalType":"uint256","name":"_idNFT","type":"uint256"},{"internalType":"uint8","name":"_active","type":"uint8"}],"name":"setAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setowner","outputs":[],"stateMutability":"nonpayable","type":"function"}]
\ No newline at end of file
deletedtests/src/eth/marketplace/MarketPlaceUNQ.bindiffbeforeafterboth
--- a/tests/src/eth/marketplace/MarketPlaceUNQ.bin
+++ /dev/null
@@ -1 +0,0 @@
-608060405234801561001057600080fd5b50600380546001600160a01b03191633179055610f2d806100326000396000f3fe6080604052600436106100705760003560e01c806399f2d4eb1161004e57806399f2d4eb14610120578063b3ffb7601461014e578063cce7ec1314610161578063e22d4f7d1461017457600080fd5b8063592bd705146100755780637b1d6001146100975780638a72ea6a146100b7575b600080fd5b34801561008157600080fd5b50610095610090366004610d2b565b6101ac565b005b3480156100a357600080fd5b506100956100b2366004610e1b565b61021e565b3480156100c357600080fd5b506100d76100d2366004610e02565b61073d565b604080519788526001600160a01b03968716602089015287019490945260608601929092528316608085015290911660a083015260ff1660c082015260e0015b60405180910390f35b34801561012c57600080fd5b5061014061013b366004610d6c565b6107a0565b604051908152602001610117565b61009561015c366004610d98565b6107d1565b61009561016f366004610d6c565b610b0b565b34801561018057600080fd5b5061014061018f366004610d6c565b600160209081526000928352604080842090915290825290205481565b6003546001600160a01b031633146101fc5760405162461bcd60e51b815260206004820152600e60248201526d27b7363c9037bbb732b91031b0b760911b60448201526064015b60405180910390fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6040516331a9108f60e11b81526004810183905233906001600160a01b03851690636352211e9060240160206040518083038186803b15801561026057600080fd5b505afa158015610274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102989190610d4f565b6001600160a01b0316146102e65760405162461bcd60e51b81526020600482015260156024820152742737ba103934b3b43a103a37b5b2b71037bbb732b960591b60448201526064016101f3565b6001600160a01b038316600090815260016020908152604080832085845290915281205490541580610350575060006001600160a01b03166000828154811061033157610331610ec9565b60009182526020909120600460069092020101546001600160a01b0316145b15610542576040805160e0810182528481526001600160a01b03878116602083019081529282018981524260608401908152888316608085019081523360a0860190815260ff89811660c08801908152600080546001808201835582805299517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56360069092029182015599517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5648b0180546001600160a01b0319908116928b1692909217905596517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5658b015594517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5668a015592517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5678901805490961690871617909455517f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56890960180549151969094166001600160a81b031990911617600160a01b959092169490940217905590546104e99190610ea4565b6001600160a01b0385166000908152600160208181526040808420888552825280842094909455338352600290529181209054909161052791610ea4565b815460018101835560009283526020909220909101556106d3565b6040805160e0810182526001600160a01b038616600090815260016020908152838220878352905291822054825491928392909190811061058557610585610ec9565b6000918252602080832060069092029091015483526001600160a01b03808a168483015260408085018c9052426060860152908916835260018252808320888452909152812054815460809093019281106105e2576105e2610ec9565b60009182526020808320600460069093020191909101546001600160a01b039081168452338483015260ff871660409485015288168252600181528282208783529052908120548154811061063957610639610ec9565b60009182526020918290208351600690920201908155908201516001820180546001600160a01b039283166001600160a01b031991821617909155604084015160028401556060840151600384015560808401516004840180549184169190921617905560a08301516005909201805460c09094015160ff16600160a01b026001600160a81b031990941692909116919091179190911790555b6040516323b872dd60e01b81526001600160a01b038516906323b872dd9061070390339030908890600401610e80565b600060405180830381600087803b15801561071d57600080fd5b505af1158015610731573d6000803e3d6000fd5b50505050505050505050565b6000818154811061074d57600080fd5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501549395506001600160a01b03928316949193909291821691811690600160a01b900460ff1687565b600260205281600052604060002081815481106107bc57600080fd5b90600052602060002001600091509150505481565b6001600160a01b03841660009081526001602090815260408083208684529091528120548154829190811061080857610808610ec9565b60009182526020918290206040805160e0810182526006939093029091018054835260018101546001600160a01b03908116948401949094526002810154918301829052600381015460608401526004810154841660808401526005015492831660a0830152600160a01b90920460ff1660c08201529150821480156108a35750826001600160a01b031681602001516001600160a01b0316145b6109245760405162461bcd60e51b815260206004820152604660248201527f4e6f7420726967687420616d6f756e74206f722063757272656e63792073656e60448201527f742c206861766520746f20626520657175616c2063757272656e637920616e6460648201526520707269636560d01b608482015260a4016101f3565b80602001516001600160a01b03166323b872dd333084604001516040518463ffffffff1660e01b815260040161095c93929190610e80565b602060405180830381600087803b15801561097657600080fd5b505af115801561098a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ae9190610de0565b50602081015160a0820151604080840151905163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb90604401602060405180830381600087803b158015610a0957600080fd5b505af1158015610a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a419190610de0565b506001600160a01b038516600090815260016020908152604080832087845290915281205481548291908110610a7957610a79610ec9565b906000526020600020906006020160050160146101000a81548160ff021916908360ff160217905550846001600160a01b03166323b872dd3033876040518463ffffffff1660e01b8152600401610ad293929190610e80565b600060405180830381600087803b158015610aec57600080fd5b505af1158015610b00573d6000803e3d6000fd5b505050505050505050565b6001600160a01b038216600090815260016020908152604080832084845290915281205481548291908110610b4257610b42610ec9565b60009182526020918290206040805160e0810182526006939093029091018054835260018101546001600160a01b03908116948401949094526002810154918301829052600381015460608401526004810154841660808401526005015492831660a0830152600160a01b90920460ff1660c082015291503414610c225760405162461bcd60e51b815260206004820152603160248201527f4e6f7420726967687420616d6f756e7420554e512073656e742c206861766520604482015270746f20626520657175616c20707269636560781b60648201526084016101f3565b8060a001516001600160a01b03166108fc82604001519081150290604051600060405180830381858888f19350505050158015610c63573d6000803e3d6000fd5b506001600160a01b038316600090815260016020908152604080832085845290915281205481548291908110610c9b57610c9b610ec9565b906000526020600020906006020160050160146101000a81548160ff021916908360ff160217905550826001600160a01b03166323b872dd3033856040518463ffffffff1660e01b8152600401610cf493929190610e80565b600060405180830381600087803b158015610d0e57600080fd5b505af1158015610d22573d6000803e3d6000fd5b50505050505050565b600060208284031215610d3d57600080fd5b8135610d4881610edf565b9392505050565b600060208284031215610d6157600080fd5b8151610d4881610edf565b60008060408385031215610d7f57600080fd5b8235610d8a81610edf565b946020939093013593505050565b60008060008060808587031215610dae57600080fd5b8435610db981610edf565b9350602085013592506040850135610dd081610edf565b9396929550929360600135925050565b600060208284031215610df257600080fd5b81518015158114610d4857600080fd5b600060208284031215610e1457600080fd5b5035919050565b600080600080600060a08688031215610e3357600080fd5b853594506020860135610e4581610edf565b93506040860135610e5581610edf565b925060608601359150608086013560ff81168114610e7257600080fd5b809150509295509295909350565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600082821015610ec457634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0381168114610ef457600080fd5b5056fea2646970667358221220fbf33eb1e471c428b86ad6d948b8699fd08a127b923d5fe27ec1e1ec5f59627564736f6c63430008070033
\ No newline at end of file
deletedtests/src/eth/marketplace/MarketPlaceUNQ.soldiffbeforeafterboth
--- a/tests/src/eth/marketplace/MarketPlaceUNQ.sol
+++ /dev/null
@@ -1,163 +0,0 @@
-// SPDX-License-Identifier:  Apache License
-pragma solidity >=0.8.0;
-
-interface IERC721 {
-    event Transfer(
-        address indexed from,
-        address indexed to,
-        uint256 indexed tokenId
-    );
-    event Approval(
-        address indexed owner,
-        address indexed approved,
-        uint256 indexed tokenId
-    );
-
-    function ownerOf(uint256 tokenId) external view returns (address owner);
-
-    function transferFrom(
-        address from,
-        address to,
-        uint256 tokenId
-    ) external;
-
-    function debug(string memory value) external;
-}
-
-interface IERC20 {
-    event Transfer(address indexed from, address indexed to, uint256 value);
-    event Approval(
-        address indexed owner,
-        address indexed spender,
-        uint256 value
-    );
-
-    function transfer(address recipient, uint256 amount)
-        external
-        returns (bool);
-
-    function transferFrom(
-        address sender,
-        address recipient,
-        uint256 amount
-    ) external returns (bool);
-}
-
-contract MarketPlaceUNQ {
-    struct Offer {
-        uint256 idNFT;
-        address currencyCode; //address of currency  token, = address(0) for UNQ
-        uint256 price;
-        uint256 time;
-        address idCollection;
-        address userAddr;
-        uint8 flagActive;
-    }
-    Offer[] public offers;
-
-    mapping(address => mapping(uint256 => uint256)) public asks; // [idCollection][idNFT] => idOffer
-
-    mapping(address => uint256[]) public asksbySeller; // [addressSeller] =>idOffer
-
-    address owner;
-
-    constructor() {
-        owner = msg.sender;
-    }
-
-    function setowner(address _newOwner) public onlyOwner {
-        owner = _newOwner;
-    }
-
-    modifier onlyOwner() {
-        require(msg.sender == owner, "Only owner can");
-        _;
-    }
-
-    /**
-     * Make bids (offers) to sell NFTs
-     */
-    function setAsk(
-        uint256 _price,
-        address _currencyCode,
-        address _idCollection,
-        uint256 _idNFT,
-        uint8 _active
-    ) public {
-        require(
-            IERC721(_idCollection).ownerOf(_idNFT) == msg.sender,
-            "Not right token owner"
-        );
-        uint256 offerID = asks[_idCollection][_idNFT];
-        if (offers.length == 0 || offers[offerID].idCollection == address(0)) {
-            offers.push(
-                Offer(
-                    _idNFT,
-                    _currencyCode,
-                    _price,
-                    block.timestamp,
-                    _idCollection,
-                    msg.sender,
-                    _active
-                )
-            );
-            asks[_idCollection][_idNFT] = offers.length - 1;
-            asksbySeller[msg.sender].push(offers.length - 1);
-        }
-        //edit existing offer
-        else {
-            offers[asks[_idCollection][_idNFT]] = Offer(
-                offers[asks[_idCollection][_idNFT]].idNFT,
-                _currencyCode,
-                _price,
-                block.timestamp,
-                offers[asks[_idCollection][_idNFT]].idCollection,
-                msg.sender,
-                _active
-            );
-        }
-
-        IERC721(_idCollection).transferFrom(msg.sender, address(this), _idNFT);
-    }
-
-    function buy(address _idCollection, uint256 _idNFT) public payable {
-        //buing for UNQ like as ethers
-        Offer memory offer = offers[asks[_idCollection][_idNFT]];
-        //1. check sent amount and send to seller
-        require(
-            msg.value == offer.price,
-            "Not right amount UNQ sent, have to be equal price"
-        );
-        payable(offer.userAddr).transfer(offer.price);
-        // 2. close offer
-        offers[asks[_idCollection][_idNFT]].flagActive = 0;
-        // 3. transfer NFT to buyer
-        IERC721(_idCollection).transferFrom(address(this), msg.sender, _idNFT);
-    }
-
-    function buy(
-        address _idCollection,
-        uint256 _idNFT,
-        address _currencyCode,
-        uint256 _amount
-    ) public payable {
-        Offer memory offer = offers[asks[_idCollection][_idNFT]];
-        //1. check sent amount and transfer from buyer to seller
-        require(
-            offer.price == _amount && offer.currencyCode == _currencyCode,
-            "Not right amount or currency sent, have to be equal currency and price"
-        );
-        // !!! transfer have to be approved to marketplace!
-        IERC20(offer.currencyCode).transferFrom(
-            msg.sender,
-            address(this),
-            offer.price
-        );
-        //to not disclojure buyer's address
-        IERC20(offer.currencyCode).transfer(offer.userAddr, offer.price);
-        // 2. close offer
-        offers[asks[_idCollection][_idNFT]].flagActive = 0;
-        // 3. transfer NFT to buyer
-        IERC721(_idCollection).transferFrom(address(this), msg.sender, _idNFT);
-    }
-}
modifiedtests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterboth
--- a/tests/src/eth/marketplace/marketplace.test.ts
+++ b/tests/src/eth/marketplace/marketplace.test.ts
@@ -1,8 +1,8 @@
 import {readFile} from 'fs/promises';
 import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';
 import privateKey from '../../substrate/privateKey';
-import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';
-import {collectionIdToAddress, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase} from '../util/helpers';
+import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';
+import {collectionIdToAddress, contractHelpers, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase} from '../util/helpers';
 import {evmToAddress} from '@polkadot/util-crypto';
 import nonFungibleAbi from '../nonFungibleAbi.json';
 import fungibleAbi from '../fungibleAbi.json';
@@ -13,25 +13,32 @@
 describe('Matcher contract usage', () => {
   itWeb3('With UNQ', async ({api, web3}) => {
     const matcherOwner = await createEthAccountWithBalance(api, web3);
-    const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlaceUNQ.abi`)).toString()), undefined, {
+    const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
       from: matcherOwner,
       ...GAS_ARGS,
     });
-    const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlaceUNQ.bin`)).toString()}).send({from: matcherOwner});
+    const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments:[matcherOwner]}).send({from: matcherOwner});
+    const helpers = contractHelpers(web3, matcherOwner);
+    await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
+    await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});
 
     const alice = privateKey('//Alice');
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
     const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
+    await setCollectionSponsorExpectSuccess(collectionId, alice.address);
+    await confirmSponsorshipExpectSuccess(collectionId);
 
+    await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
+    await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
+
     const seller = privateKey('//Bob');
+    await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
+    await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
 
     const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
 
     // To transfer item to matcher it first needs to be transfered to EVM account of bob
     await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});
-    // Fees will be paid from EVM account, so we should have some balance here
-    await transferBalanceExpectSuccess(api, seller, evmToAddress(subToEth(seller.address)), 10n ** 18n);
-    await transferBalanceExpectSuccess(api, alice, evmToAddress(subToEth(alice.address)), 10n ** 18n);
 
     // Token is owned by seller initially
     expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});
@@ -39,7 +46,7 @@
     // Ask
     {
       await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
-      await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, '0x0000000000000000000000000000000000000000', evmCollection.options.address, tokenId, 1));
+      await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
     }
 
     // Token is transferred to matcher
@@ -48,8 +55,7 @@
     // Buy
     {
       const sellerBalanceBeforePurchase = await getBalanceSingle(api, seller.address);
-      // There is two functions named 'buy', so we should provide full signature
-      await executeEthTxOnSub(web3, api, alice, matcher, m => m['buy(address,uint256)'](evmCollection.options.address, tokenId), {value: PRICE});
+      await executeEthTxOnSub(web3, api, alice, matcher, m => m.buy(evmCollection.options.address, tokenId), {value: PRICE});
       expect(await getBalanceSingle(api, seller.address) - sellerBalanceBeforePurchase === PRICE);
     }
 
@@ -64,13 +70,14 @@
     expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Substrate: alice.address});
   });
 
-  itWeb3('With custom ERC20', async ({api, web3}) => {
+  // selling for custom tokens excluded from release
+  itWeb3.skip('With custom ERC20', async ({api, web3}) => {
     const matcherOwner = await createEthAccountWithBalance(api, web3);
-    const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlaceUNQ.abi`)).toString()), undefined, {
+    const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
       from: matcherOwner,
       ...GAS_ARGS,
     });
-    const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlaceUNQ.bin`)).toString()}).send({from: matcherOwner});
+    const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});
 
     const alice = privateKey('//Alice');
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
@@ -131,27 +138,33 @@
   itWeb3('With escrow', async ({api, web3}) => {
     const matcherOwner = await createEthAccountWithBalance(api, web3);
     const escrow = await createEthAccountWithBalance(api, web3);
-    const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlaceKSM.abi`)).toString()), undefined, {
+    const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
       from: matcherOwner,
       ...GAS_ARGS,
     });
-    const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlaceKSM.bin`)).toString(), arguments: [escrow]}).send({from: matcherOwner});
-
-    const ksmToken = 11;
+    const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});
+    await matcher.methods.setEscrow(escrow).send({from: matcherOwner});
+    const helpers = contractHelpers(web3, matcherOwner);
+    await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
+    await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});
 
     const alice = privateKey('//Alice');
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
     const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
+    await setCollectionSponsorExpectSuccess(collectionId, alice.address);
+    await confirmSponsorshipExpectSuccess(collectionId);
+
+    await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
+    await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
 
     const seller = privateKey('//Bob');
+    await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
+    await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
 
     const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
 
     // To transfer item to matcher it first needs to be transfered to EVM account of bob
     await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});
-    // Fees will be paid from EVM account, so we should have some balance here
-    await transferBalanceExpectSuccess(api, seller, evmToAddress(subToEth(seller.address)), 10n ** 18n);
-    await transferBalanceExpectSuccess(api, alice, evmToAddress(subToEth(alice.address)), 10n ** 18n);
 
     // Token is owned by seller initially
     expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});
@@ -159,25 +172,25 @@
     // Ask
     {
       await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
-      await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, ksmToken, evmCollection.options.address, tokenId, 1));
+      await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
     }
 
     // Token is transferred to matcher
     expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: matcher.options.address.toLowerCase()});
 
     // Give buyer KSM
-    await matcher.methods.deposit(PRICE, ksmToken, subToEth(alice.address)).send({from: escrow});
+    await matcher.methods.depositKSM(PRICE, subToEth(alice.address)).send({from: escrow});
 
     // Buy
     {
-      expect(await matcher.methods.escrowBalance(ksmToken, subToEth(seller.address)).call()).to.be.equal('0');
-      expect(await matcher.methods.escrowBalance(ksmToken, subToEth(alice.address)).call()).to.be.equal(PRICE.toString());
+      expect(await matcher.methods.balanceKSM(subToEth(seller.address)).call()).to.be.equal('0');
+      expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal(PRICE.toString());
 
-      await executeEthTxOnSub(web3, api, alice, matcher, m => m.buy(evmCollection.options.address, tokenId));
+      await executeEthTxOnSub(web3, api, alice, matcher, m => m.buyKSM(evmCollection.options.address, tokenId, subToEth(alice.address), subToEth(alice.address)));
 
       // Price is removed from buyer balance, and added to seller
-      expect(await matcher.methods.escrowBalance(ksmToken, subToEth(alice.address)).call()).to.be.equal('0');
-      expect(await matcher.methods.escrowBalance(ksmToken, subToEth(seller.address)).call()).to.be.equal(PRICE.toString());
+      expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal('0');
+      expect(await matcher.methods.balanceKSM(subToEth(seller.address)).call()).to.be.equal(PRICE.toString());
     }
 
     // Token is transferred to evm account of alice
modifiedtests/src/limits.test.tsdiffbeforeafterboth
--- a/tests/src/limits.test.ts
+++ b/tests/src/limits.test.ts
@@ -78,7 +78,7 @@
   });
 });
 
-describe('Sponsor timeout (NFT)', () => {
+describe.skip('Sponsor timeout (NFT) (only for special chain limits test)', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
   let charlie: IKeyringPair;
@@ -91,7 +91,7 @@
     });
   });
 
-  it('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {
+  it.skip('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
     await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});
     const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
@@ -141,7 +141,7 @@
   });
 });
 
-describe('Sponsor timeout (Fungible)', () => {
+describe.skip('Sponsor timeout (Fungible) (only for special chain limits test)', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
   let charlie: IKeyringPair;
@@ -208,7 +208,7 @@
   });
 });
 
-describe('Sponsor timeout (ReFungible)', () => {
+describe.skip('Sponsor timeout (ReFungible) (only for special chain limits test)', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
   let charlie: IKeyringPair;
modifiedtests/src/overflow.test.tsdiffbeforeafterboth
--- a/tests/src/overflow.test.ts
+++ b/tests/src/overflow.test.ts
@@ -13,7 +13,7 @@
 chai.use(chaiAsPromised);
 const expect = chai.expect;
 
-describe('Integration Test fungible overflows', () => {
+describe.skip('Integration Test fungible overflows', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
   let charlie: IKeyringPair;
modifiedtests/src/setOffchainSchema.test.tsdiffbeforeafterboth
--- a/tests/src/setOffchainSchema.test.ts
+++ b/tests/src/setOffchainSchema.test.ts
@@ -40,7 +40,7 @@
       await setOffchainSchemaExpectSuccess(alice, collectionId, DATA);
       const collection = await queryCollectionExpectSuccess(api, collectionId);
 
-      expect(collection.offchainSchema).to.be.equal('0x' + Buffer.from(DATA).toString('hex'));
+      expect('0x' + Buffer.from(collection.offchainSchema).toString('hex')).to.be.equal('0x' + Buffer.from(DATA).toString('hex'));
     });
   });
 
@@ -51,7 +51,7 @@
       await setOffchainSchemaExpectSuccess(bob, collectionId, DATA);
       const collection = await queryCollectionExpectSuccess(api, collectionId);
 
-      expect(collection.offchainSchema).to.be.equal('0x' + Buffer.from(DATA).toString('hex'));
+      expect('0x' + Buffer.from(collection.offchainSchema).toString('hex')).to.be.equal('0x' + Buffer.from(DATA).toString('hex'));
     });
   });
 });
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -905,11 +905,12 @@
   await usingApi(async (api: ApiPromise) => {
     const transferTx = api.tx.nft.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);
     const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected;
-    if (events && Array.isArray(events)) {
-      const result = getCreateCollectionResult(events);
-      // tslint:disable-next-line:no-unused-expression
-      expect(result.success).to.be.false;
-    }
+    const result = getGenericResult(events);
+    // if (events && Array.isArray(events)) {
+    //   const result = getCreateCollectionResult(events);
+    // tslint:disable-next-line:no-unused-expression
+    expect(result.success).to.be.false;
+    //}
   });
 }