difftreelog
merge master
in: master
10 files changed
README.mddiffbeforeafterboth--- a/README.md
+++ b/README.md
@@ -155,13 +155,13 @@
location:
V0(X2(Parent, Parachain(PARA_ID)))
metadata:
- name OPL
- symbol OPL
+ name QTZ
+ symbol QTZ
decimals 18
minimalBalance 1
```
-### Next, we can send tokens from Opal to Karura:
+### Next, we can send tokens from Quartz to Karura:
```
polkadotXcm -> reserveTransferAssets
dest:
@@ -179,7 +179,7 @@
The result will be displayed in ChainState
tokens -> accounts
-### To send tokens from Karura to Opal:
+### To send tokens from Karura to Quartz:
```
xtokens -> transfer
client/rpc/src/lib.rsdiffbeforeafterboth--- a/client/rpc/src/lib.rs
+++ b/client/rpc/src/lib.rs
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+// Original License
use std::sync::Arc;
use codec::Decode;
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
-
// std
use std::sync::Arc;
use std::sync::Mutex;
pallets/scheduler/src/lib.rsdiffbeforeafterboth--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-// Original license
+// Original license:
// This file is part of Substrate.
// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
runtime/opal/src/lib.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;31// #[cfg(any(feature = "std", test))]32// pub use sp_runtime::BuildStorage;3334use sp_runtime::{35 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,36 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},37 transaction_validity::{TransactionSource, TransactionValidity},38 ApplyExtrinsicResult, RuntimeAppPublic,39};4041use sp_std::prelude::*;4243#[cfg(feature = "std")]44use sp_version::NativeVersion;45use sp_version::RuntimeVersion;46pub use pallet_transaction_payment::{47 Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,48};49// A few exports that help ease life for downstream crates.50pub use pallet_balances::Call as BalancesCall;51pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};52pub use frame_support::{53 construct_runtime, match_type,54 dispatch::DispatchResult,55 PalletId, parameter_types, StorageValue, ConsensusEngineId,56 traits::{57 tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,58 Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,59 OnUnbalanced, Randomness, FindAuthor,60 },61 weights::{62 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},63 DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,64 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,65 },66};67use up_data_structs::*;68// use pallet_contracts::weights::WeightInfo;69// #[cfg(any(feature = "std", test))]70use frame_system::{71 self as frame_system, EnsureRoot, EnsureSigned,72 limits::{BlockWeights, BlockLength},73};74use sp_arithmetic::{75 traits::{BaseArithmetic, Unsigned},76};77use smallvec::smallvec;78use codec::{Encode, Decode};79use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};80use fp_rpc::TransactionStatus;81use sp_runtime::{82 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},83 transaction_validity::TransactionValidityError,84 SaturatedConversion,85};8687// pub use pallet_timestamp::Call as TimestampCall;88pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;8990// Polkadot imports91use pallet_xcm::XcmPassthrough;92use polkadot_parachain::primitives::Sibling;93use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};94use xcm_builder::{95 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,96 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,97 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,98 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,99 ParentIsPreset,100};101use xcm_executor::{Config, XcmExecutor, Assets};102use sp_std::{marker::PhantomData};103104use xcm::latest::{105 // Xcm,106 AssetId::{Concrete},107 Fungibility::Fungible as XcmFungible,108 MultiAsset,109 Error as XcmError,110};111use xcm_executor::traits::{MatchesFungible, WeightTrader};112//use xcm_executor::traits::MatchesFungible;113use sp_runtime::traits::CheckedConversion;114115use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};116117pub const RUNTIME_NAME: &str = "opal";118119type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;120121impl RuntimeInstance for Runtime {122 type CrossAccountId = self::CrossAccountId;123124 type TransactionConverter = self::TransactionConverter;125126 fn get_transaction_converter() -> TransactionConverter {127 TransactionConverter128 }129}130131/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know132/// the specifics of the runtime. They can then be made to be agnostic over specific formats133/// of data like extrinsics, allowing for them to continue syncing the network through upgrades134/// to even the core data structures.135pub mod opaque {136 use sp_std::prelude::*;137 use sp_runtime::impl_opaque_keys;138 use super::Aura;139140 pub use unique_runtime_common::types::*;141142 impl_opaque_keys! {143 pub struct SessionKeys {144 pub aura: Aura,145 }146 }147}148149/// This runtime version.150pub const VERSION: RuntimeVersion = RuntimeVersion {151 spec_name: create_runtime_str!(RUNTIME_NAME),152 impl_name: create_runtime_str!(RUNTIME_NAME),153 authoring_version: 1,154 spec_version: 918000,155 impl_version: 0,156 apis: RUNTIME_API_VERSIONS,157 transaction_version: 1,158 state_version: 0,159};160161#[derive(codec::Encode, codec::Decode)]162pub enum XCMPMessage<XAccountId, XBalance> {163 /// Transfer tokens to the given account from the Parachain account.164 TransferToken(XAccountId, XBalance),165}166167/// The version information used to identify this runtime when compiled natively.168#[cfg(feature = "std")]169pub fn native_version() -> NativeVersion {170 NativeVersion {171 runtime_version: VERSION,172 can_author_with: Default::default(),173 }174}175176type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;177178pub struct DealWithFees;179impl OnUnbalanced<NegativeImbalance> for DealWithFees {180 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {181 if let Some(fees) = fees_then_tips.next() {182 // for fees, 100% to treasury183 let mut split = fees.ration(100, 0);184 if let Some(tips) = fees_then_tips.next() {185 // for tips, if any, 100% to treasury186 tips.ration_merge_into(100, 0, &mut split);187 }188 Treasury::on_unbalanced(split.0);189 // Author::on_unbalanced(split.1);190 }191 }192}193194parameter_types! {195 pub const BlockHashCount: BlockNumber = 2400;196 pub RuntimeBlockLength: BlockLength =197 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);198 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);199 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;200 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()201 .base_block(BlockExecutionWeight::get())202 .for_class(DispatchClass::all(), |weights| {203 weights.base_extrinsic = ExtrinsicBaseWeight::get();204 })205 .for_class(DispatchClass::Normal, |weights| {206 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);207 })208 .for_class(DispatchClass::Operational, |weights| {209 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);210 // Operational transactions have some extra reserved space, so that they211 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.212 weights.reserved = Some(213 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT214 );215 })216 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)217 .build_or_panic();218 pub const Version: RuntimeVersion = VERSION;219 pub const SS58Prefix: u8 = 42;220}221222parameter_types! {223 pub const ChainId: u64 = 8882;224}225226pub struct FixedFee;227impl FeeCalculator for FixedFee {228 fn min_gas_price() -> U256 {229 MIN_GAS_PRICE.into()230 }231}232233// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case234// (contract, which only writes a lot of data),235// approximating on top of our real store write weight236parameter_types! {237 pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;238 pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;239 pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();240}241242/// Limiting EVM execution to 50% of block for substrate users and management tasks243/// EVM transaction consumes more weight than substrate's, so we can't rely on them being244/// scheduled fairly245const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);246parameter_types! {247 pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());248}249250pub enum FixedGasWeightMapping {}251impl GasWeightMapping for FixedGasWeightMapping {252 fn gas_to_weight(gas: u64) -> Weight {253 gas.saturating_mul(WeightPerGas::get())254 }255 fn weight_to_gas(weight: Weight) -> u64 {256 weight / WeightPerGas::get()257 }258}259260impl pallet_evm::Config for Runtime {261 type BlockGasLimit = BlockGasLimit;262 type FeeCalculator = FixedFee;263 type GasWeightMapping = FixedGasWeightMapping;264 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;265 type CallOrigin = EnsureAddressTruncated;266 type WithdrawOrigin = EnsureAddressTruncated;267 type AddressMapping = HashedAddressMapping<Self::Hashing>;268 type PrecompilesType = ();269 type PrecompilesValue = ();270 type Currency = Balances;271 type Event = Event;272 type OnMethodCall = (273 pallet_evm_migration::OnMethodCall<Self>,274 pallet_unique::UniqueErcSupport<Self>,275 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,276 );277 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;278 type ChainId = ChainId;279 type Runner = pallet_evm::runner::stack::Runner<Self>;280 type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;281 type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;282 type FindAuthor = EthereumFindAuthor<Aura>;283}284285impl pallet_evm_migration::Config for Runtime {286 type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;287}288289pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);290impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {291 fn find_author<'a, I>(digests: I) -> Option<H160>292 where293 I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,294 {295 if let Some(author_index) = F::find_author(digests) {296 let authority_id = Aura::authorities()[author_index as usize].clone();297 return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));298 }299 None300 }301}302303impl pallet_ethereum::Config for Runtime {304 type Event = Event;305 type StateRoot = pallet_ethereum::IntermediateStateRoot;306}307308impl pallet_randomness_collective_flip::Config for Runtime {}309310impl frame_system::Config for Runtime {311 /// The data to be stored in an account.312 type AccountData = pallet_balances::AccountData<Balance>;313 /// The identifier used to distinguish between accounts.314 type AccountId = AccountId;315 /// The basic call filter to use in dispatchable.316 type BaseCallFilter = Everything;317 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).318 type BlockHashCount = BlockHashCount;319 /// The maximum length of a block (in bytes).320 type BlockLength = RuntimeBlockLength;321 /// The index type for blocks.322 type BlockNumber = BlockNumber;323 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.324 type BlockWeights = RuntimeBlockWeights;325 /// The aggregated dispatch type that is available for extrinsics.326 type Call = Call;327 /// The weight of database operations that the runtime can invoke.328 type DbWeight = RocksDbWeight;329 /// The ubiquitous event type.330 type Event = Event;331 /// The type for hashing blocks and tries.332 type Hash = Hash;333 /// The hashing algorithm used.334 type Hashing = BlakeTwo256;335 /// The header type.336 type Header = generic::Header<BlockNumber, BlakeTwo256>;337 /// The index type for storing how many extrinsics an account has signed.338 type Index = Index;339 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.340 type Lookup = AccountIdLookup<AccountId, ()>;341 /// What to do if an account is fully reaped from the system.342 type OnKilledAccount = ();343 /// What to do if a new account is created.344 type OnNewAccount = ();345 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;346 /// The ubiquitous origin type.347 type Origin = Origin;348 /// This type is being generated by `construct_runtime!`.349 type PalletInfo = PalletInfo;350 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.351 type SS58Prefix = SS58Prefix;352 /// Weight information for the extrinsics of this pallet.353 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;354 /// Version of the runtime.355 type Version = Version;356 type MaxConsumers = ConstU32<16>;357}358359parameter_types! {360 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;361}362363impl pallet_timestamp::Config for Runtime {364 /// A timestamp: milliseconds since the unix epoch.365 type Moment = u64;366 type OnTimestampSet = ();367 type MinimumPeriod = MinimumPeriod;368 type WeightInfo = ();369}370371parameter_types! {372 // pub const ExistentialDeposit: u128 = 500;373 pub const ExistentialDeposit: u128 = 0;374 pub const MaxLocks: u32 = 50;375}376377impl pallet_balances::Config for Runtime {378 type MaxLocks = MaxLocks;379 type MaxReserves = ();380 type ReserveIdentifier = [u8; 8];381 /// The type for recording an account's balance.382 type Balance = Balance;383 /// The ubiquitous event type.384 type Event = Event;385 type DustRemoval = Treasury;386 type ExistentialDeposit = ExistentialDeposit;387 type AccountStore = System;388 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;389}390391pub const fn deposit(items: u32, bytes: u32) -> Balance {392 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE393}394395/*396parameter_types! {397 pub TombstoneDeposit: Balance = deposit(398 1,399 sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,400 );401 pub DepositPerContract: Balance = TombstoneDeposit::get();402 pub const DepositPerStorageByte: Balance = deposit(0, 1);403 pub const DepositPerStorageItem: Balance = deposit(1, 0);404 pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);405 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;406 pub const SignedClaimHandicap: u32 = 2;407 pub const MaxDepth: u32 = 32;408 pub const MaxValueSize: u32 = 16 * 1024;409 pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb410 // The lazy deletion runs inside on_initialize.411 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *412 RuntimeBlockWeights::get().max_block;413 // The weight needed for decoding the queue should be less or equal than a fifth414 // of the overall weight dedicated to the lazy deletion.415 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (416 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -417 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)418 )) / 5) as u32;419 pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();420}421422impl pallet_contracts::Config for Runtime {423 type Time = Timestamp;424 type Randomness = RandomnessCollectiveFlip;425 type Currency = Balances;426 type Event = Event;427 type RentPayment = ();428 type SignedClaimHandicap = SignedClaimHandicap;429 type TombstoneDeposit = TombstoneDeposit;430 type DepositPerContract = DepositPerContract;431 type DepositPerStorageByte = DepositPerStorageByte;432 type DepositPerStorageItem = DepositPerStorageItem;433 type RentFraction = RentFraction;434 type SurchargeReward = SurchargeReward;435 type WeightPrice = pallet_transaction_payment::Pallet<Self>;436 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;437 type ChainExtension = NFTExtension;438 type DeletionQueueDepth = DeletionQueueDepth;439 type DeletionWeightLimit = DeletionWeightLimit;440 type Schedule = Schedule;441 type CallStack = [pallet_contracts::Frame<Self>; 31];442}443*/444445parameter_types! {446 /// This value increases the priority of `Operational` transactions by adding447 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.448 pub const OperationalFeeMultiplier: u8 = 5;449}450451/// Linear implementor of `WeightToFeePolynomial`452pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);453454impl<T> WeightToFeePolynomial for LinearFee<T>455where456 T: BaseArithmetic + From<u32> + Copy + Unsigned,457{458 type Balance = T;459460 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {461 smallvec!(WeightToFeeCoefficient {462 // Targeting 0.1 Unique per NFT transfer463 coeff_integer: WEIGHT_TO_FEE_COEFF.into(),464 coeff_frac: Perbill::zero(),465 negative: false,466 degree: 1,467 })468 }469}470471impl pallet_transaction_payment::Config for Runtime {472 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;473 type TransactionByteFee = TransactionByteFee;474 type OperationalFeeMultiplier = OperationalFeeMultiplier;475 type WeightToFee = LinearFee<Balance>;476 type FeeMultiplierUpdate = ();477}478479parameter_types! {480 pub const ProposalBond: Permill = Permill::from_percent(5);481 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;482 pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;483 pub const SpendPeriod: BlockNumber = 5 * MINUTES;484 pub const Burn: Permill = Permill::from_percent(0);485 pub const TipCountdown: BlockNumber = 1 * DAYS;486 pub const TipFindersFee: Percent = Percent::from_percent(20);487 pub const TipReportDepositBase: Balance = 1 * UNIQUE;488 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;489 pub const BountyDepositBase: Balance = 1 * UNIQUE;490 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;491 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");492 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;493 pub const MaximumReasonLength: u32 = 16384;494 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);495 pub const BountyValueMinimum: Balance = 5 * UNIQUE;496 pub const MaxApprovals: u32 = 100;497}498499impl pallet_treasury::Config for Runtime {500 type PalletId = TreasuryModuleId;501 type Currency = Balances;502 type ApproveOrigin = EnsureRoot<AccountId>;503 type RejectOrigin = EnsureRoot<AccountId>;504 type Event = Event;505 type OnSlash = ();506 type ProposalBond = ProposalBond;507 type ProposalBondMinimum = ProposalBondMinimum;508 type ProposalBondMaximum = ProposalBondMaximum;509 type SpendPeriod = SpendPeriod;510 type Burn = Burn;511 type BurnDestination = ();512 type SpendFunds = ();513 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;514 type MaxApprovals = MaxApprovals;515}516517impl pallet_sudo::Config for Runtime {518 type Event = Event;519 type Call = Call;520}521522pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);523524impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider525 for RelayChainBlockNumberProvider<T>526{527 type BlockNumber = BlockNumber;528529 fn current_block_number() -> Self::BlockNumber {530 cumulus_pallet_parachain_system::Pallet::<T>::validation_data()531 .map(|d| d.relay_parent_number)532 .unwrap_or_default()533 }534}535536parameter_types! {537 pub const MinVestedTransfer: Balance = 10 * UNIQUE;538 pub const MaxVestingSchedules: u32 = 28;539}540541impl orml_vesting::Config for Runtime {542 type Event = Event;543 type Currency = pallet_balances::Pallet<Runtime>;544 type MinVestedTransfer = MinVestedTransfer;545 type VestedTransferOrigin = EnsureSigned<AccountId>;546 type WeightInfo = ();547 type MaxVestingSchedules = MaxVestingSchedules;548 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;549}550551parameter_types! {552 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;553 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;554}555556impl cumulus_pallet_parachain_system::Config for Runtime {557 type Event = Event;558 type SelfParaId = parachain_info::Pallet<Self>;559 type OnSystemEvent = ();560 // type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<561 // MaxDownwardMessageWeight,562 // XcmExecutor<XcmConfig>,563 // Call,564 // >;565 type OutboundXcmpMessageSource = XcmpQueue;566 type DmpMessageHandler = DmpQueue;567 type ReservedDmpWeight = ReservedDmpWeight;568 type ReservedXcmpWeight = ReservedXcmpWeight;569 type XcmpMessageHandler = XcmpQueue;570}571572impl parachain_info::Config for Runtime {}573574impl cumulus_pallet_aura_ext::Config for Runtime {}575576parameter_types! {577 pub const RelayLocation: MultiLocation = MultiLocation::parent();578 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;579 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();580 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();581}582583/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used584/// when determining ownership of accounts for asset transacting and when attempting to use XCM585/// `Transact` in order to determine the dispatch Origin.586pub type LocationToAccountId = (587 // The parent (Relay-chain) origin converts to the default `AccountId`.588 ParentIsPreset<AccountId>,589 // Sibling parachain origins convert to AccountId via the `ParaId::into`.590 SiblingParachainConvertsVia<Sibling, AccountId>,591 // Straight up local `AccountId32` origins just alias directly to `AccountId`.592 AccountId32Aliases<RelayNetwork, AccountId>,593);594595pub struct OnlySelfCurrency;596impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {597 fn matches_fungible(a: &MultiAsset) -> Option<B> {598 match (&a.id, &a.fun) {599 (Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),600 _ => None,601 }602 }603}604605/// Means for transacting assets on this chain.606pub type LocalAssetTransactor = CurrencyAdapter<607 // Use this currency:608 Balances,609 // Use this currency when it is a fungible asset matching the given location or name:610 OnlySelfCurrency,611 // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:612 LocationToAccountId,613 // Our chain's account ID type (we can't get away without mentioning it explicitly):614 AccountId,615 // We don't track any teleports.616 (),617>;618619/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,620/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can621/// biases the kind of local `Origin` it will become.622pub type XcmOriginToTransactDispatchOrigin = (623 // Sovereign account converter; this attempts to derive an `AccountId` from the origin location624 // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for625 // foreign chains who want to have a local sovereign account on this chain which they control.626 SovereignSignedViaLocation<LocationToAccountId, Origin>,627 // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when628 // recognised.629 RelayChainAsNative<RelayOrigin, Origin>,630 // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when631 // recognised.632 SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,633 // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a634 // transaction from the Root origin.635 ParentAsSuperuser<Origin>,636 // Native signed account converter; this just converts an `AccountId32` origin into a normal637 // `Origin::Signed` origin of the same 32-byte value.638 SignedAccountId32AsNative<RelayNetwork, Origin>,639 // Xcm origins can be represented natively under the Xcm pallet's Xcm origin.640 XcmPassthrough<Origin>,641);642643parameter_types! {644 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.645 pub UnitWeightCost: Weight = 1_000_000;646 // 1200 UNIQUEs buy 1 second of weight.647 pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);648 pub const MaxInstructions: u32 = 100;649 pub const MaxAuthorities: u32 = 100_000;650}651652match_type! {653 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {654 MultiLocation { parents: 1, interior: Here } |655 MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }656 };657}658659pub type Barrier = (660 TakeWeightCredit,661 AllowTopLevelPaidExecutionFrom<Everything>,662 AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,663 // ^^^ Parent & its unit plurality gets free execution664);665666pub struct UsingOnlySelfCurrencyComponents<667 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,668 AssetId: Get<MultiLocation>,669 AccountId,670 Currency: CurrencyT<AccountId>,671 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,672>(673 Weight,674 Currency::Balance,675 PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,676);677impl<678 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,679 AssetId: Get<MultiLocation>,680 AccountId,681 Currency: CurrencyT<AccountId>,682 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,683 > WeightTrader684 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>685{686 fn new() -> Self {687 Self(0, Zero::zero(), PhantomData)688 }689690 fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {691 let amount = WeightToFee::calc(&weight);692 let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;693694 // location to this parachain through relay chain695 let option1: xcm::v1::AssetId = Concrete(MultiLocation {696 parents: 1,697 interior: X1(Parachain(ParachainInfo::parachain_id().into())),698 });699 // direct location700 let option2: xcm::v1::AssetId = Concrete(MultiLocation {701 parents: 0,702 interior: Here,703 });704705 let required = if payment.fungible.contains_key(&option1) {706 (option1, u128_amount).into()707 } else if payment.fungible.contains_key(&option2) {708 (option2, u128_amount).into()709 } else {710 (Concrete(MultiLocation::default()), u128_amount).into()711 };712713 let unused = payment714 .checked_sub(required)715 .map_err(|_| XcmError::TooExpensive)?;716 self.0 = self.0.saturating_add(weight);717 self.1 = self.1.saturating_add(amount);718 Ok(unused)719 }720721 fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {722 let weight = weight.min(self.0);723 let amount = WeightToFee::calc(&weight);724 self.0 -= weight;725 self.1 = self.1.saturating_sub(amount);726 let amount: u128 = amount.saturated_into();727 if amount > 0 {728 Some((AssetId::get(), amount).into())729 } else {730 None731 }732 }733}734impl<735 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,736 AssetId: Get<MultiLocation>,737 AccountId,738 Currency: CurrencyT<AccountId>,739 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,740 > Drop741 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>742{743 fn drop(&mut self) {744 OnUnbalanced::on_unbalanced(Currency::issue(self.1));745 }746}747748pub struct XcmConfig;749impl Config for XcmConfig {750 type Call = Call;751 type XcmSender = XcmRouter;752 // How to withdraw and deposit an asset.753 type AssetTransactor = LocalAssetTransactor;754 type OriginConverter = XcmOriginToTransactDispatchOrigin;755 type IsReserve = NativeAsset;756 type IsTeleporter = (); // Teleportation is disabled757 type LocationInverter = LocationInverter<Ancestry>;758 type Barrier = Barrier;759 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;760 type Trader = UsingOnlySelfCurrencyComponents<761 IdentityFee<Balance>,762 RelayLocation,763 AccountId,764 Balances,765 (),766 >;767 type ResponseHandler = (); // Don't handle responses for now.768 type SubscriptionService = PolkadotXcm;769770 type AssetTrap = PolkadotXcm;771 type AssetClaims = PolkadotXcm;772}773774// parameter_types! {775// pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;776// }777778/// No local origins on this chain are allowed to dispatch XCM sends/executions.779pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);780781/// The means for routing XCM messages which are not for local execution into the right message782/// queues.783pub type XcmRouter = (784 // Two routers - use UMP to communicate with the relay chain:785 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,786 // ..and XCMP to communicate with the sibling chains.787 XcmpQueue,788);789790impl pallet_evm_coder_substrate::Config for Runtime {791 type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;792 type GasWeightMapping = FixedGasWeightMapping;793}794795impl pallet_xcm::Config for Runtime {796 type Event = Event;797 type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;798 type XcmRouter = XcmRouter;799 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;800 type XcmExecuteFilter = Everything;801 type XcmExecutor = XcmExecutor<XcmConfig>;802 type XcmTeleportFilter = Everything;803 type XcmReserveTransferFilter = Everything;804 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;805 type LocationInverter = LocationInverter<Ancestry>;806 type Origin = Origin;807 type Call = Call;808 const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;809 type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;810}811812impl cumulus_pallet_xcm::Config for Runtime {813 type Event = Event;814 type XcmExecutor = XcmExecutor<XcmConfig>;815}816817impl cumulus_pallet_xcmp_queue::Config for Runtime {818 type WeightInfo = ();819 type Event = Event;820 type XcmExecutor = XcmExecutor<XcmConfig>;821 type ChannelInfo = ParachainSystem;822 type VersionWrapper = ();823 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;824 type ControllerOrigin = EnsureRoot<AccountId>;825 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;826}827828impl cumulus_pallet_dmp_queue::Config for Runtime {829 type Event = Event;830 type XcmExecutor = XcmExecutor<XcmConfig>;831 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;832}833834impl pallet_aura::Config for Runtime {835 type AuthorityId = AuraId;836 type DisabledValidators = ();837 type MaxAuthorities = MaxAuthorities;838}839840parameter_types! {841 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();842 pub const CollectionCreationPrice: Balance = 2 * UNIQUE;843}844845impl pallet_common::Config for Runtime {846 type Event = Event;847 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;848 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;849 type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;850851 type Currency = Balances;852 type CollectionCreationPrice = CollectionCreationPrice;853 type TreasuryAccountId = TreasuryAccountId;854}855856impl pallet_fungible::Config for Runtime {857 type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;858}859impl pallet_refungible::Config for Runtime {860 type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;861}862impl pallet_nonfungible::Config for Runtime {863 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;864}865866impl pallet_unique::Config for Runtime {867 type Event = Event;868 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;869}870871parameter_types! {872 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied873}874875/// Used for the pallet inflation876impl pallet_inflation::Config for Runtime {877 type Currency = Balances;878 type TreasuryAccountId = TreasuryAccountId;879 type InflationBlockInterval = InflationBlockInterval;880 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;881}882883// parameter_types! {884// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *885// RuntimeBlockWeights::get().max_block;886// pub const MaxScheduledPerBlock: u32 = 50;887// }888889type EvmSponsorshipHandler = (890 pallet_unique::UniqueEthSponsorshipHandler<Runtime>,891 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,892);893type SponsorshipHandler = (894 pallet_unique::UniqueSponsorshipHandler<Runtime>,895 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,896 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,897);898899// impl pallet_unq_scheduler::Config for Runtime {900// type Event = Event;901// type Origin = Origin;902// type PalletsOrigin = OriginCaller;903// type Call = Call;904// type MaximumWeight = MaximumSchedulerWeight;905// type ScheduleOrigin = EnsureSigned<AccountId>;906// type MaxScheduledPerBlock = MaxScheduledPerBlock;907// type SponsorshipHandler = SponsorshipHandler;908// type WeightInfo = ();909// }910911impl pallet_evm_transaction_payment::Config for Runtime {912 type EvmSponsorshipHandler = EvmSponsorshipHandler;913 type Currency = Balances;914 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;915 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;916}917918impl pallet_charge_transaction::Config for Runtime {919 type SponsorshipHandler = SponsorshipHandler;920}921922// impl pallet_contract_helpers::Config for Runtime {923// type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;924// }925926parameter_types! {927 // 0x842899ECF380553E8a4de75bF534cdf6fBF64049928 pub const HelpersContractAddress: H160 = H160([929 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,930 ]);931}932933impl pallet_evm_contract_helpers::Config for Runtime {934 type ContractAddress = HelpersContractAddress;935 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;936}937938construct_runtime!(939 pub enum Runtime where940 Block = Block,941 NodeBlock = opaque::Block,942 UncheckedExtrinsic = UncheckedExtrinsic943 {944 ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,945 ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,946947 Aura: pallet_aura::{Pallet, Config<T>} = 22,948 AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,949950 Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,951 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,952 Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,953 TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,954 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,955 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,956 System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,957 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,958 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,959 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,960961 // XCM helpers.962 XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,963 PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,964 CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,965 DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,966967 // Unique Pallets968 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,969 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,970 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,971 // free = 63972 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,973 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,974 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,975 Fungible: pallet_fungible::{Pallet, Storage} = 67,976 Refungible: pallet_refungible::{Pallet, Storage} = 68,977 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,978979 // Frontier980 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,981 Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,982983 EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,984 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,985 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,986 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,987 }988);989990pub struct TransactionConverter;991992impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {993 fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {994 UncheckedExtrinsic::new_unsigned(995 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),996 )997 }998}9991000impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1001 fn convert_transaction(1002 &self,1003 transaction: pallet_ethereum::Transaction,1004 ) -> opaque::UncheckedExtrinsic {1005 let extrinsic = UncheckedExtrinsic::new_unsigned(1006 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1007 );1008 let encoded = extrinsic.encode();1009 opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1010 .expect("Encoded extrinsic is always valid")1011 }1012}10131014/// The address format for describing accounts.1015pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1016/// Block header type as expected by this runtime.1017pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1018/// Block type as expected by this runtime.1019pub type Block = generic::Block<Header, UncheckedExtrinsic>;1020/// A Block signed with a Justification1021pub type SignedBlock = generic::SignedBlock<Block>;1022/// BlockId type as expected by this runtime.1023pub type BlockId = generic::BlockId<Block>;1024/// The SignedExtension to the basic transaction logic.1025pub type SignedExtra = (1026 frame_system::CheckSpecVersion<Runtime>,1027 // system::CheckTxVersion<Runtime>,1028 frame_system::CheckGenesis<Runtime>,1029 frame_system::CheckEra<Runtime>,1030 frame_system::CheckNonce<Runtime>,1031 frame_system::CheckWeight<Runtime>,1032 pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1033 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,1034);1035/// Unchecked extrinsic type as expected by this runtime.1036pub type UncheckedExtrinsic =1037 fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1038/// Extrinsic type that has already been checked.1039pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1040/// Executive: handles dispatch to the various modules.1041pub type Executive = frame_executive::Executive<1042 Runtime,1043 Block,1044 frame_system::ChainContext<Runtime>,1045 Runtime,1046 AllPalletsReversedWithSystemFirst,1047>;10481049impl_opaque_keys! {1050 pub struct SessionKeys {1051 pub aura: Aura,1052 }1053}10541055impl fp_self_contained::SelfContainedCall for Call {1056 type SignedInfo = H160;10571058 fn is_self_contained(&self) -> bool {1059 match self {1060 Call::Ethereum(call) => call.is_self_contained(),1061 _ => false,1062 }1063 }10641065 fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1066 match self {1067 Call::Ethereum(call) => call.check_self_contained(),1068 _ => None,1069 }1070 }10711072 fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1073 match self {1074 Call::Ethereum(call) => call.validate_self_contained(info),1075 _ => None,1076 }1077 }10781079 fn pre_dispatch_self_contained(1080 &self,1081 info: &Self::SignedInfo,1082 ) -> Option<Result<(), TransactionValidityError>> {1083 match self {1084 Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1085 _ => None,1086 }1087 }10881089 fn apply_self_contained(1090 self,1091 info: Self::SignedInfo,1092 ) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1093 match self {1094 call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1095 Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1096 )),1097 _ => None,1098 }1099 }1100}11011102macro_rules! dispatch_unique_runtime {1103 ($collection:ident.$method:ident($($name:ident),*)) => {{1104 use pallet_unique::dispatch::Dispatched;11051106 let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1107 let dispatch = collection.as_dyn();11081109 Ok(dispatch.$method($($name),*))1110 }};1111}11121113impl_common_runtime_apis!();11141115struct CheckInherents;11161117impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1118 fn check_inherents(1119 block: &Block,1120 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1121 ) -> sp_inherents::CheckInherentsResult {1122 let relay_chain_slot = relay_state_proof1123 .read_slot()1124 .expect("Could not read the relay chain slot from the proof");11251126 let inherent_data =1127 cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1128 relay_chain_slot,1129 sp_std::time::Duration::from_secs(6),1130 )1131 .create_inherent_data()1132 .expect("Could not create the timestamp inherent data");11331134 inherent_data.check_extrinsics(block)1135 }1136}11371138cumulus_pallet_parachain_system::register_validate_block!(1139 Runtime = Runtime,1140 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1141 CheckInherents = CheckInherents,1142);1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.1819#![cfg_attr(not(feature = "std"), no_std)]20// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.21#![recursion_limit = "1024"]22#![allow(clippy::from_over_into, clippy::identity_op)]23#![allow(clippy::fn_to_numeric_cast_with_truncation)]24// Make the WASM binary available.25#[cfg(feature = "std")]26include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));2728use sp_api::impl_runtime_apis;29use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};30use sp_runtime::DispatchError;31// #[cfg(any(feature = "std", test))]32// pub use sp_runtime::BuildStorage;3334use sp_runtime::{35 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,36 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, AccountIdConversion, Zero},37 transaction_validity::{TransactionSource, TransactionValidity},38 ApplyExtrinsicResult, RuntimeAppPublic,39};4041use sp_std::prelude::*;4243#[cfg(feature = "std")]44use sp_version::NativeVersion;45use sp_version::RuntimeVersion;46pub use pallet_transaction_payment::{47 Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,48};49// A few exports that help ease life for downstream crates.50pub use pallet_balances::Call as BalancesCall;51pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};52pub use frame_support::{53 construct_runtime, match_type,54 dispatch::DispatchResult,55 PalletId, parameter_types, StorageValue, ConsensusEngineId,56 traits::{57 tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Everything,58 Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem, LockIdentifier,59 OnUnbalanced, Randomness, FindAuthor,60 },61 weights::{62 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},63 DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,64 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,65 },66};67use up_data_structs::*;68// use pallet_contracts::weights::WeightInfo;69// #[cfg(any(feature = "std", test))]70use frame_system::{71 self as frame_system, EnsureRoot, EnsureSigned,72 limits::{BlockWeights, BlockLength},73};74use sp_arithmetic::{75 traits::{BaseArithmetic, Unsigned},76};77use smallvec::smallvec;78use codec::{Encode, Decode};79use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};80use fp_rpc::TransactionStatus;81use sp_runtime::{82 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf, Saturating},83 transaction_validity::TransactionValidityError,84 SaturatedConversion,85};8687// pub use pallet_timestamp::Call as TimestampCall;88pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;8990// Polkadot imports91use pallet_xcm::XcmPassthrough;92use polkadot_parachain::primitives::Sibling;93use xcm::v1::{BodyId, Junction::*, MultiLocation, NetworkId, Junctions::*};94use xcm_builder::{95 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,96 EnsureXcmOrigin, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,97 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,98 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,99 ParentIsPreset,100};101use xcm_executor::{Config, XcmExecutor, Assets};102use sp_std::{marker::PhantomData};103104use xcm::latest::{105 // Xcm,106 AssetId::{Concrete},107 Fungibility::Fungible as XcmFungible,108 MultiAsset,109 Error as XcmError,110};111use xcm_executor::traits::{MatchesFungible, WeightTrader};112//use xcm_executor::traits::MatchesFungible;113use sp_runtime::traits::CheckedConversion;114115use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};116117pub const RUNTIME_NAME: &str = "opal";118119type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;120121impl RuntimeInstance for Runtime {122 type CrossAccountId = self::CrossAccountId;123124 type TransactionConverter = self::TransactionConverter;125126 fn get_transaction_converter() -> TransactionConverter {127 TransactionConverter128 }129}130131/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know132/// the specifics of the runtime. They can then be made to be agnostic over specific formats133/// of data like extrinsics, allowing for them to continue syncing the network through upgrades134/// to even the core data structures.135pub mod opaque {136 use sp_std::prelude::*;137 use sp_runtime::impl_opaque_keys;138 use super::Aura;139140 pub use unique_runtime_common::types::*;141142 impl_opaque_keys! {143 pub struct SessionKeys {144 pub aura: Aura,145 }146 }147}148149/// This runtime version.150pub const VERSION: RuntimeVersion = RuntimeVersion {151 spec_name: create_runtime_str!(RUNTIME_NAME),152 impl_name: create_runtime_str!(RUNTIME_NAME),153 authoring_version: 1,154 spec_version: 918000,155 impl_version: 0,156 apis: RUNTIME_API_VERSIONS,157 transaction_version: 1,158 state_version: 0,159};160161#[derive(codec::Encode, codec::Decode)]162pub enum XCMPMessage<XAccountId, XBalance> {163 /// Transfer tokens to the given account from the Parachain account.164 TransferToken(XAccountId, XBalance),165}166167/// The version information used to identify this runtime when compiled natively.168#[cfg(feature = "std")]169pub fn native_version() -> NativeVersion {170 NativeVersion {171 runtime_version: VERSION,172 can_author_with: Default::default(),173 }174}175176type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;177178pub struct DealWithFees;179impl OnUnbalanced<NegativeImbalance> for DealWithFees {180 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {181 if let Some(fees) = fees_then_tips.next() {182 // for fees, 100% to treasury183 let mut split = fees.ration(100, 0);184 if let Some(tips) = fees_then_tips.next() {185 // for tips, if any, 100% to treasury186 tips.ration_merge_into(100, 0, &mut split);187 }188 Treasury::on_unbalanced(split.0);189 // Author::on_unbalanced(split.1);190 }191 }192}193194parameter_types! {195 pub const BlockHashCount: BlockNumber = 2400;196 pub RuntimeBlockLength: BlockLength =197 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);198 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);199 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;200 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()201 .base_block(BlockExecutionWeight::get())202 .for_class(DispatchClass::all(), |weights| {203 weights.base_extrinsic = ExtrinsicBaseWeight::get();204 })205 .for_class(DispatchClass::Normal, |weights| {206 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);207 })208 .for_class(DispatchClass::Operational, |weights| {209 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);210 // Operational transactions have some extra reserved space, so that they211 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.212 weights.reserved = Some(213 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT214 );215 })216 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)217 .build_or_panic();218 pub const Version: RuntimeVersion = VERSION;219 /*220 255 - Quartz221 42 - Opal222 */223 pub const SS58Prefix: u8 = 255;224}225226parameter_types! {227 pub const ChainId: u64 = 8881;228}229230pub struct FixedFee;231impl FeeCalculator for FixedFee {232 fn min_gas_price() -> U256 {233 MIN_GAS_PRICE.into()234 }235}236237// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case238// (contract, which only writes a lot of data),239// approximating on top of our real store write weight240parameter_types! {241 pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;242 pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;243 pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();244}245246/// Limiting EVM execution to 50% of block for substrate users and management tasks247/// EVM transaction consumes more weight than substrate's, so we can't rely on them being248/// scheduled fairly249const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);250parameter_types! {251 pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());252}253254pub enum FixedGasWeightMapping {}255impl GasWeightMapping for FixedGasWeightMapping {256 fn gas_to_weight(gas: u64) -> Weight {257 gas.saturating_mul(WeightPerGas::get())258 }259 fn weight_to_gas(weight: Weight) -> u64 {260 weight / WeightPerGas::get()261 }262}263264impl pallet_evm::Config for Runtime {265 type BlockGasLimit = BlockGasLimit;266 type FeeCalculator = FixedFee;267 type GasWeightMapping = FixedGasWeightMapping;268 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;269 type CallOrigin = EnsureAddressTruncated;270 type WithdrawOrigin = EnsureAddressTruncated;271 type AddressMapping = HashedAddressMapping<Self::Hashing>;272 type PrecompilesType = ();273 type PrecompilesValue = ();274 type Currency = Balances;275 type Event = Event;276 type OnMethodCall = (277 pallet_evm_migration::OnMethodCall<Self>,278 pallet_unique::UniqueErcSupport<Self>,279 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,280 );281 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;282 type ChainId = ChainId;283 type Runner = pallet_evm::runner::stack::Runner<Self>;284 type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;285 type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;286 type FindAuthor = EthereumFindAuthor<Aura>;287}288289impl pallet_evm_migration::Config for Runtime {290 type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;291}292293pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);294impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {295 fn find_author<'a, I>(digests: I) -> Option<H160>296 where297 I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,298 {299 if let Some(author_index) = F::find_author(digests) {300 let authority_id = Aura::authorities()[author_index as usize].clone();301 return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));302 }303 None304 }305}306307impl pallet_ethereum::Config for Runtime {308 type Event = Event;309 type StateRoot = pallet_ethereum::IntermediateStateRoot;310}311312impl pallet_randomness_collective_flip::Config for Runtime {}313314impl frame_system::Config for Runtime {315 /// The data to be stored in an account.316 type AccountData = pallet_balances::AccountData<Balance>;317 /// The identifier used to distinguish between accounts.318 type AccountId = AccountId;319 /// The basic call filter to use in dispatchable.320 type BaseCallFilter = Everything;321 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).322 type BlockHashCount = BlockHashCount;323 /// The maximum length of a block (in bytes).324 type BlockLength = RuntimeBlockLength;325 /// The index type for blocks.326 type BlockNumber = BlockNumber;327 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.328 type BlockWeights = RuntimeBlockWeights;329 /// The aggregated dispatch type that is available for extrinsics.330 type Call = Call;331 /// The weight of database operations that the runtime can invoke.332 type DbWeight = RocksDbWeight;333 /// The ubiquitous event type.334 type Event = Event;335 /// The type for hashing blocks and tries.336 type Hash = Hash;337 /// The hashing algorithm used.338 type Hashing = BlakeTwo256;339 /// The header type.340 type Header = generic::Header<BlockNumber, BlakeTwo256>;341 /// The index type for storing how many extrinsics an account has signed.342 type Index = Index;343 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.344 type Lookup = AccountIdLookup<AccountId, ()>;345 /// What to do if an account is fully reaped from the system.346 type OnKilledAccount = ();347 /// What to do if a new account is created.348 type OnNewAccount = ();349 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;350 /// The ubiquitous origin type.351 type Origin = Origin;352 /// This type is being generated by `construct_runtime!`.353 type PalletInfo = PalletInfo;354 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.355 type SS58Prefix = SS58Prefix;356 /// Weight information for the extrinsics of this pallet.357 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;358 /// Version of the runtime.359 type Version = Version;360 type MaxConsumers = ConstU32<16>;361}362363parameter_types! {364 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;365}366367impl pallet_timestamp::Config for Runtime {368 /// A timestamp: milliseconds since the unix epoch.369 type Moment = u64;370 type OnTimestampSet = ();371 type MinimumPeriod = MinimumPeriod;372 type WeightInfo = ();373}374375parameter_types! {376 // pub const ExistentialDeposit: u128 = 500;377 pub const ExistentialDeposit: u128 = 0;378 pub const MaxLocks: u32 = 50;379}380381impl pallet_balances::Config for Runtime {382 type MaxLocks = MaxLocks;383 type MaxReserves = ();384 type ReserveIdentifier = [u8; 8];385 /// The type for recording an account's balance.386 type Balance = Balance;387 /// The ubiquitous event type.388 type Event = Event;389 type DustRemoval = Treasury;390 type ExistentialDeposit = ExistentialDeposit;391 type AccountStore = System;392 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;393}394395pub const fn deposit(items: u32, bytes: u32) -> Balance {396 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE397}398399/*400parameter_types! {401 pub TombstoneDeposit: Balance = deposit(402 1,403 sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,404 );405 pub DepositPerContract: Balance = TombstoneDeposit::get();406 pub const DepositPerStorageByte: Balance = deposit(0, 1);407 pub const DepositPerStorageItem: Balance = deposit(1, 0);408 pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);409 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;410 pub const SignedClaimHandicap: u32 = 2;411 pub const MaxDepth: u32 = 32;412 pub const MaxValueSize: u32 = 16 * 1024;413 pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb414 // The lazy deletion runs inside on_initialize.415 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *416 RuntimeBlockWeights::get().max_block;417 // The weight needed for decoding the queue should be less or equal than a fifth418 // of the overall weight dedicated to the lazy deletion.419 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (420 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -421 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)422 )) / 5) as u32;423 pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();424}425426impl pallet_contracts::Config for Runtime {427 type Time = Timestamp;428 type Randomness = RandomnessCollectiveFlip;429 type Currency = Balances;430 type Event = Event;431 type RentPayment = ();432 type SignedClaimHandicap = SignedClaimHandicap;433 type TombstoneDeposit = TombstoneDeposit;434 type DepositPerContract = DepositPerContract;435 type DepositPerStorageByte = DepositPerStorageByte;436 type DepositPerStorageItem = DepositPerStorageItem;437 type RentFraction = RentFraction;438 type SurchargeReward = SurchargeReward;439 type WeightPrice = pallet_transaction_payment::Pallet<Self>;440 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;441 type ChainExtension = NFTExtension;442 type DeletionQueueDepth = DeletionQueueDepth;443 type DeletionWeightLimit = DeletionWeightLimit;444 type Schedule = Schedule;445 type CallStack = [pallet_contracts::Frame<Self>; 31];446}447*/448449parameter_types! {450 /// This value increases the priority of `Operational` transactions by adding451 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.452 pub const OperationalFeeMultiplier: u8 = 5;453}454455/// Linear implementor of `WeightToFeePolynomial`456pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);457458impl<T> WeightToFeePolynomial for LinearFee<T>459where460 T: BaseArithmetic + From<u32> + Copy + Unsigned,461{462 type Balance = T;463464 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {465 smallvec!(WeightToFeeCoefficient {466 // Targeting 0.1 Unique per NFT transfer467 coeff_integer: WEIGHT_TO_FEE_COEFF.into(),468 coeff_frac: Perbill::zero(),469 negative: false,470 degree: 1,471 })472 }473}474475impl pallet_transaction_payment::Config for Runtime {476 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;477 type TransactionByteFee = TransactionByteFee;478 type OperationalFeeMultiplier = OperationalFeeMultiplier;479 type WeightToFee = LinearFee<Balance>;480 type FeeMultiplierUpdate = ();481}482483parameter_types! {484 pub const ProposalBond: Permill = Permill::from_percent(5);485 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;486 pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;487 pub const SpendPeriod: BlockNumber = 5 * MINUTES;488 pub const Burn: Permill = Permill::from_percent(0);489 pub const TipCountdown: BlockNumber = 1 * DAYS;490 pub const TipFindersFee: Percent = Percent::from_percent(20);491 pub const TipReportDepositBase: Balance = 1 * UNIQUE;492 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;493 pub const BountyDepositBase: Balance = 1 * UNIQUE;494 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;495 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");496 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;497 pub const MaximumReasonLength: u32 = 16384;498 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);499 pub const BountyValueMinimum: Balance = 5 * UNIQUE;500 pub const MaxApprovals: u32 = 100;501}502503impl pallet_treasury::Config for Runtime {504 type PalletId = TreasuryModuleId;505 type Currency = Balances;506 type ApproveOrigin = EnsureRoot<AccountId>;507 type RejectOrigin = EnsureRoot<AccountId>;508 type Event = Event;509 type OnSlash = ();510 type ProposalBond = ProposalBond;511 type ProposalBondMinimum = ProposalBondMinimum;512 type ProposalBondMaximum = ProposalBondMaximum;513 type SpendPeriod = SpendPeriod;514 type Burn = Burn;515 type BurnDestination = ();516 type SpendFunds = ();517 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;518 type MaxApprovals = MaxApprovals;519}520521impl pallet_sudo::Config for Runtime {522 type Event = Event;523 type Call = Call;524}525526pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);527528impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider529 for RelayChainBlockNumberProvider<T>530{531 type BlockNumber = BlockNumber;532533 fn current_block_number() -> Self::BlockNumber {534 cumulus_pallet_parachain_system::Pallet::<T>::validation_data()535 .map(|d| d.relay_parent_number)536 .unwrap_or_default()537 }538}539540parameter_types! {541 pub const MinVestedTransfer: Balance = 10 * UNIQUE;542 pub const MaxVestingSchedules: u32 = 28;543}544545impl orml_vesting::Config for Runtime {546 type Event = Event;547 type Currency = pallet_balances::Pallet<Runtime>;548 type MinVestedTransfer = MinVestedTransfer;549 type VestedTransferOrigin = EnsureSigned<AccountId>;550 type WeightInfo = ();551 type MaxVestingSchedules = MaxVestingSchedules;552 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;553}554555parameter_types! {556 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;557 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;558}559560impl cumulus_pallet_parachain_system::Config for Runtime {561 type Event = Event;562 type SelfParaId = parachain_info::Pallet<Self>;563 type OnSystemEvent = ();564 // type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<565 // MaxDownwardMessageWeight,566 // XcmExecutor<XcmConfig>,567 // Call,568 // >;569 type OutboundXcmpMessageSource = XcmpQueue;570 type DmpMessageHandler = DmpQueue;571 type ReservedDmpWeight = ReservedDmpWeight;572 type ReservedXcmpWeight = ReservedXcmpWeight;573 type XcmpMessageHandler = XcmpQueue;574}575576impl parachain_info::Config for Runtime {}577578impl cumulus_pallet_aura_ext::Config for Runtime {}579580parameter_types! {581 pub const RelayLocation: MultiLocation = MultiLocation::parent();582 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;583 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();584 pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();585}586587/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used588/// when determining ownership of accounts for asset transacting and when attempting to use XCM589/// `Transact` in order to determine the dispatch Origin.590pub type LocationToAccountId = (591 // The parent (Relay-chain) origin converts to the default `AccountId`.592 ParentIsPreset<AccountId>,593 // Sibling parachain origins convert to AccountId via the `ParaId::into`.594 SiblingParachainConvertsVia<Sibling, AccountId>,595 // Straight up local `AccountId32` origins just alias directly to `AccountId`.596 AccountId32Aliases<RelayNetwork, AccountId>,597);598599pub struct OnlySelfCurrency;600impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {601 fn matches_fungible(a: &MultiAsset) -> Option<B> {602 match (&a.id, &a.fun) {603 (Concrete(_), XcmFungible(ref amount)) => CheckedConversion::checked_from(*amount),604 _ => None,605 }606 }607}608609/// Means for transacting assets on this chain.610pub type LocalAssetTransactor = CurrencyAdapter<611 // Use this currency:612 Balances,613 // Use this currency when it is a fungible asset matching the given location or name:614 OnlySelfCurrency,615 // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:616 LocationToAccountId,617 // Our chain's account ID type (we can't get away without mentioning it explicitly):618 AccountId,619 // We don't track any teleports.620 (),621>;622623/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,624/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can625/// biases the kind of local `Origin` it will become.626pub type XcmOriginToTransactDispatchOrigin = (627 // Sovereign account converter; this attempts to derive an `AccountId` from the origin location628 // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for629 // foreign chains who want to have a local sovereign account on this chain which they control.630 SovereignSignedViaLocation<LocationToAccountId, Origin>,631 // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when632 // recognised.633 RelayChainAsNative<RelayOrigin, Origin>,634 // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when635 // recognised.636 SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,637 // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a638 // transaction from the Root origin.639 ParentAsSuperuser<Origin>,640 // Native signed account converter; this just converts an `AccountId32` origin into a normal641 // `Origin::Signed` origin of the same 32-byte value.642 SignedAccountId32AsNative<RelayNetwork, Origin>,643 // Xcm origins can be represented natively under the Xcm pallet's Xcm origin.644 XcmPassthrough<Origin>,645);646647parameter_types! {648 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.649 pub UnitWeightCost: Weight = 1_000_000;650 // 1200 UNIQUEs buy 1 second of weight.651 pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), 1_200 * UNIQUE);652 pub const MaxInstructions: u32 = 100;653 pub const MaxAuthorities: u32 = 100_000;654}655656match_type! {657 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {658 MultiLocation { parents: 1, interior: Here } |659 MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Unit, .. }) }660 };661}662663pub type Barrier = (664 TakeWeightCredit,665 AllowTopLevelPaidExecutionFrom<Everything>,666 AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,667 // ^^^ Parent & its unit plurality gets free execution668);669670pub struct UsingOnlySelfCurrencyComponents<671 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,672 AssetId: Get<MultiLocation>,673 AccountId,674 Currency: CurrencyT<AccountId>,675 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,676>(677 Weight,678 Currency::Balance,679 PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced)>,680);681impl<682 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,683 AssetId: Get<MultiLocation>,684 AccountId,685 Currency: CurrencyT<AccountId>,686 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,687 > WeightTrader688 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>689{690 fn new() -> Self {691 Self(0, Zero::zero(), PhantomData)692 }693694 fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {695 let amount = WeightToFee::calc(&weight);696 let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;697698 // location to this parachain through relay chain699 let option1: xcm::v1::AssetId = Concrete(MultiLocation {700 parents: 1,701 interior: X1(Parachain(ParachainInfo::parachain_id().into())),702 });703 // direct location704 let option2: xcm::v1::AssetId = Concrete(MultiLocation {705 parents: 0,706 interior: Here,707 });708709 let required = if payment.fungible.contains_key(&option1) {710 (option1, u128_amount).into()711 } else if payment.fungible.contains_key(&option2) {712 (option2, u128_amount).into()713 } else {714 (Concrete(MultiLocation::default()), u128_amount).into()715 };716717 let unused = payment718 .checked_sub(required)719 .map_err(|_| XcmError::TooExpensive)?;720 self.0 = self.0.saturating_add(weight);721 self.1 = self.1.saturating_add(amount);722 Ok(unused)723 }724725 fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {726 let weight = weight.min(self.0);727 let amount = WeightToFee::calc(&weight);728 self.0 -= weight;729 self.1 = self.1.saturating_sub(amount);730 let amount: u128 = amount.saturated_into();731 if amount > 0 {732 Some((AssetId::get(), amount).into())733 } else {734 None735 }736 }737}738impl<739 WeightToFee: WeightToFeePolynomial<Balance = Currency::Balance>,740 AssetId: Get<MultiLocation>,741 AccountId,742 Currency: CurrencyT<AccountId>,743 OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,744 > Drop745 for UsingOnlySelfCurrencyComponents<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced>746{747 fn drop(&mut self) {748 OnUnbalanced::on_unbalanced(Currency::issue(self.1));749 }750}751752pub struct XcmConfig;753impl Config for XcmConfig {754 type Call = Call;755 type XcmSender = XcmRouter;756 // How to withdraw and deposit an asset.757 type AssetTransactor = LocalAssetTransactor;758 type OriginConverter = XcmOriginToTransactDispatchOrigin;759 type IsReserve = NativeAsset;760 type IsTeleporter = (); // Teleportation is disabled761 type LocationInverter = LocationInverter<Ancestry>;762 type Barrier = Barrier;763 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;764 type Trader = UsingOnlySelfCurrencyComponents<765 IdentityFee<Balance>,766 RelayLocation,767 AccountId,768 Balances,769 (),770 >;771 type ResponseHandler = (); // Don't handle responses for now.772 type SubscriptionService = PolkadotXcm;773774 type AssetTrap = PolkadotXcm;775 type AssetClaims = PolkadotXcm;776}777778// parameter_types! {779// pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;780// }781782/// No local origins on this chain are allowed to dispatch XCM sends/executions.783pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);784785/// The means for routing XCM messages which are not for local execution into the right message786/// queues.787pub type XcmRouter = (788 // Two routers - use UMP to communicate with the relay chain:789 cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,790 // ..and XCMP to communicate with the sibling chains.791 XcmpQueue,792);793794impl pallet_evm_coder_substrate::Config for Runtime {795 type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;796 type GasWeightMapping = FixedGasWeightMapping;797}798799impl pallet_xcm::Config for Runtime {800 type Event = Event;801 type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;802 type XcmRouter = XcmRouter;803 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;804 type XcmExecuteFilter = Everything;805 type XcmExecutor = XcmExecutor<XcmConfig>;806 type XcmTeleportFilter = Everything;807 type XcmReserveTransferFilter = Everything;808 type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;809 type LocationInverter = LocationInverter<Ancestry>;810 type Origin = Origin;811 type Call = Call;812 const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;813 type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;814}815816impl cumulus_pallet_xcm::Config for Runtime {817 type Event = Event;818 type XcmExecutor = XcmExecutor<XcmConfig>;819}820821impl cumulus_pallet_xcmp_queue::Config for Runtime {822 type WeightInfo = ();823 type Event = Event;824 type XcmExecutor = XcmExecutor<XcmConfig>;825 type ChannelInfo = ParachainSystem;826 type VersionWrapper = ();827 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;828 type ControllerOrigin = EnsureRoot<AccountId>;829 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;830}831832impl cumulus_pallet_dmp_queue::Config for Runtime {833 type Event = Event;834 type XcmExecutor = XcmExecutor<XcmConfig>;835 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;836}837838impl pallet_aura::Config for Runtime {839 type AuthorityId = AuraId;840 type DisabledValidators = ();841 type MaxAuthorities = MaxAuthorities;842}843844parameter_types! {845 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();846 pub const CollectionCreationPrice: Balance = 2 * UNIQUE;847}848849impl pallet_common::Config for Runtime {850 type Event = Event;851 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;852 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;853 type CrossAccountId = pallet_common::account::BasicCrossAccountId<Self>;854855 type Currency = Balances;856 type CollectionCreationPrice = CollectionCreationPrice;857 type TreasuryAccountId = TreasuryAccountId;858}859860impl pallet_fungible::Config for Runtime {861 type WeightInfo = pallet_fungible::weights::SubstrateWeight<Self>;862}863impl pallet_refungible::Config for Runtime {864 type WeightInfo = pallet_refungible::weights::SubstrateWeight<Self>;865}866impl pallet_nonfungible::Config for Runtime {867 type WeightInfo = pallet_nonfungible::weights::SubstrateWeight<Self>;868}869870impl pallet_unique::Config for Runtime {871 type Event = Event;872 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;873}874875parameter_types! {876 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied877}878879/// Used for the pallet inflation880impl pallet_inflation::Config for Runtime {881 type Currency = Balances;882 type TreasuryAccountId = TreasuryAccountId;883 type InflationBlockInterval = InflationBlockInterval;884 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;885}886887// parameter_types! {888// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *889// RuntimeBlockWeights::get().max_block;890// pub const MaxScheduledPerBlock: u32 = 50;891// }892893type EvmSponsorshipHandler = (894 pallet_unique::UniqueEthSponsorshipHandler<Runtime>,895 pallet_evm_contract_helpers::HelpersContractSponsoring<Runtime>,896);897type SponsorshipHandler = (898 pallet_unique::UniqueSponsorshipHandler<Runtime>,899 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,900 pallet_evm_transaction_payment::BridgeSponsorshipHandler<Runtime>,901);902903// impl pallet_unq_scheduler::Config for Runtime {904// type Event = Event;905// type Origin = Origin;906// type PalletsOrigin = OriginCaller;907// type Call = Call;908// type MaximumWeight = MaximumSchedulerWeight;909// type ScheduleOrigin = EnsureSigned<AccountId>;910// type MaxScheduledPerBlock = MaxScheduledPerBlock;911// type SponsorshipHandler = SponsorshipHandler;912// type WeightInfo = ();913// }914915impl pallet_evm_transaction_payment::Config for Runtime {916 type EvmSponsorshipHandler = EvmSponsorshipHandler;917 type Currency = Balances;918 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;919 type EvmBackwardsAddressMapping = up_evm_mapping::MapBackwardsAddressTruncated;920}921922impl pallet_charge_transaction::Config for Runtime {923 type SponsorshipHandler = SponsorshipHandler;924}925926// impl pallet_contract_helpers::Config for Runtime {927// type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;928// }929930parameter_types! {931 // 0x842899ECF380553E8a4de75bF534cdf6fBF64049932 pub const HelpersContractAddress: H160 = H160([933 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,934 ]);935}936937impl pallet_evm_contract_helpers::Config for Runtime {938 type ContractAddress = HelpersContractAddress;939 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;940}941942construct_runtime!(943 pub enum Runtime where944 Block = Block,945 NodeBlock = opaque::Block,946 UncheckedExtrinsic = UncheckedExtrinsic947 {948 ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,949 ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,950951 Aura: pallet_aura::{Pallet, Config<T>} = 22,952 AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,953954 Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,955 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,956 Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,957 TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,958 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,959 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,960 System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 36,961 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,962 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,963 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,964965 // XCM helpers.966 XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,967 PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,968 CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,969 DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,970971 // Unique Pallets972 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,973 Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,974 // Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,975 // free = 63976 Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,977 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,978 Common: pallet_common::{Pallet, Storage, Event<T>} = 66,979 Fungible: pallet_fungible::{Pallet, Storage} = 67,980 Refungible: pallet_refungible::{Pallet, Storage} = 68,981 Nonfungible: pallet_nonfungible::{Pallet, Storage} = 69,982983 // Frontier984 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,985 Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, Origin} = 101,986987 EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,988 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,989 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,990 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,991 }992);993994pub struct TransactionConverter;995996impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {997 fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {998 UncheckedExtrinsic::new_unsigned(999 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1000 )1001 }1002}10031004impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {1005 fn convert_transaction(1006 &self,1007 transaction: pallet_ethereum::Transaction,1008 ) -> opaque::UncheckedExtrinsic {1009 let extrinsic = UncheckedExtrinsic::new_unsigned(1010 pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),1011 );1012 let encoded = extrinsic.encode();1013 opaque::UncheckedExtrinsic::decode(&mut &encoded[..])1014 .expect("Encoded extrinsic is always valid")1015 }1016}10171018/// The address format for describing accounts.1019pub type Address = sp_runtime::MultiAddress<AccountId, ()>;1020/// Block header type as expected by this runtime.1021pub type Header = generic::Header<BlockNumber, BlakeTwo256>;1022/// Block type as expected by this runtime.1023pub type Block = generic::Block<Header, UncheckedExtrinsic>;1024/// A Block signed with a Justification1025pub type SignedBlock = generic::SignedBlock<Block>;1026/// BlockId type as expected by this runtime.1027pub type BlockId = generic::BlockId<Block>;1028/// The SignedExtension to the basic transaction logic.1029pub type SignedExtra = (1030 frame_system::CheckSpecVersion<Runtime>,1031 // system::CheckTxVersion<Runtime>,1032 frame_system::CheckGenesis<Runtime>,1033 frame_system::CheckEra<Runtime>,1034 frame_system::CheckNonce<Runtime>,1035 frame_system::CheckWeight<Runtime>,1036 pallet_charge_transaction::ChargeTransactionPayment<Runtime>,1037 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,1038);1039/// Unchecked extrinsic type as expected by this runtime.1040pub type UncheckedExtrinsic =1041 fp_self_contained::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;1042/// Extrinsic type that has already been checked.1043pub type CheckedExtrinsic = fp_self_contained::CheckedExtrinsic<AccountId, Call, SignedExtra, H160>;1044/// Executive: handles dispatch to the various modules.1045pub type Executive = frame_executive::Executive<1046 Runtime,1047 Block,1048 frame_system::ChainContext<Runtime>,1049 Runtime,1050 AllPalletsReversedWithSystemFirst,1051>;10521053impl_opaque_keys! {1054 pub struct SessionKeys {1055 pub aura: Aura,1056 }1057}10581059impl fp_self_contained::SelfContainedCall for Call {1060 type SignedInfo = H160;10611062 fn is_self_contained(&self) -> bool {1063 match self {1064 Call::Ethereum(call) => call.is_self_contained(),1065 _ => false,1066 }1067 }10681069 fn check_self_contained(&self) -> Option<Result<Self::SignedInfo, TransactionValidityError>> {1070 match self {1071 Call::Ethereum(call) => call.check_self_contained(),1072 _ => None,1073 }1074 }10751076 fn validate_self_contained(&self, info: &Self::SignedInfo) -> Option<TransactionValidity> {1077 match self {1078 Call::Ethereum(call) => call.validate_self_contained(info),1079 _ => None,1080 }1081 }10821083 fn pre_dispatch_self_contained(1084 &self,1085 info: &Self::SignedInfo,1086 ) -> Option<Result<(), TransactionValidityError>> {1087 match self {1088 Call::Ethereum(call) => call.pre_dispatch_self_contained(info),1089 _ => None,1090 }1091 }10921093 fn apply_self_contained(1094 self,1095 info: Self::SignedInfo,1096 ) -> Option<sp_runtime::DispatchResultWithInfo<PostDispatchInfoOf<Self>>> {1097 match self {1098 call @ Call::Ethereum(pallet_ethereum::Call::transact { .. }) => Some(call.dispatch(1099 Origin::from(pallet_ethereum::RawOrigin::EthereumTransaction(info)),1100 )),1101 _ => None,1102 }1103 }1104}11051106macro_rules! dispatch_unique_runtime {1107 ($collection:ident.$method:ident($($name:ident),*)) => {{1108 use pallet_unique::dispatch::Dispatched;11091110 let collection = Dispatched::dispatch(<pallet_common::CollectionHandle<Runtime>>::try_get($collection)?);1111 let dispatch = collection.as_dyn();11121113 Ok(dispatch.$method($($name),*))1114 }};1115}11161117impl_common_runtime_apis!();11181119struct CheckInherents;11201121impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1122 fn check_inherents(1123 block: &Block,1124 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1125 ) -> sp_inherents::CheckInherentsResult {1126 let relay_chain_slot = relay_state_proof1127 .read_slot()1128 .expect("Could not read the relay chain slot from the proof");11291130 let inherent_data =1131 cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1132 relay_chain_slot,1133 sp_std::time::Duration::from_secs(6),1134 )1135 .create_inherent_data()1136 .expect("Could not create the timestamp inherent data");11371138 inherent_data.check_extrinsics(block)1139 }1140}11411142cumulus_pallet_parachain_system::register_validate_block!(1143 Runtime = Runtime,1144 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1145 CheckInherents = CheckInherents,1146);tests/flipper-src/lib.rsdiffbeforeafterboth--- a/tests/flipper-src/lib.rs
+++ b/tests/flipper-src/lib.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-// Original license
+// Original License
// Copyright 2018-2020 Parity Technologies (UK) Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
tests/ink-types-node-runtime/src/calls.rsdiffbeforeafterboth--- a/tests/ink-types-node-runtime/src/calls.rs
+++ b/tests/ink-types-node-runtime/src/calls.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-// Original license
+// Original License
// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
tests/ink-types-node-runtime/src/lib.rsdiffbeforeafterboth--- a/tests/ink-types-node-runtime/src/lib.rs
+++ b/tests/ink-types-node-runtime/src/lib.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-// Original license
+// Original License
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
tests/loadtester-src/lib.rsdiffbeforeafterboth--- a/tests/loadtester-src/lib.rs
+++ b/tests/loadtester-src/lib.rs
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+// Original License
#![cfg_attr(not(feature = "std"), no_std)]
use ink_lang as ink;
tests/src/xcmTransfer.test.tsdiffbeforeafterboth--- a/tests/src/xcmTransfer.test.ts
+++ b/tests/src/xcmTransfer.test.ts
@@ -34,7 +34,7 @@
const KARURA_CHAIN = 2000;
const KARURA_PORT = '9946';
-describe('Integration test: Exchanging OPL with Karura', () => {
+describe('Integration test: Exchanging QTZ with Karura', () => {
let alice: IKeyringPair;
before(async () => {
@@ -60,8 +60,8 @@
const metadata =
{
- name: 'OPL',
- symbol: 'OPL',
+ name: 'QTZ',
+ symbol: 'QTZ',
decimals: 18,
minimalBalance: 1,
};
@@ -74,7 +74,7 @@
}, karuraApiOptions);
});
- it('Should connect and send OPL to Karura', async () => {
+ it('Should connect and send QTZ to Karura', async () => {
let balanceOnKaruraBefore: bigint;
await usingApi(async (api) => {
@@ -141,7 +141,7 @@
}, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});
});
- it('Should connect to Karura and send OPL back', async () => {
+ it('Should connect to Karura and send QTZ back', async () => {
let balanceBefore: bigint;
await usingApi(async (api) => {