difftreelog
Make NFT Transfer fee close to 0.1 Unique
in: master
7 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3468,7 +3468,9 @@
"pallet-vesting",
"parity-scale-codec",
"serde",
+ "smallvec 1.6.1",
"sp-api",
+ "sp-arithmetic",
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
runtime/Cargo.tomldiffbeforeafterboth--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -48,6 +48,7 @@
pallet-treasury = { version = "2.0.1", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
pallet-vesting = { version = "2.0.1", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
sp-api = { default-features = false, version = '2.0.1' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
+sp-arithmetic = { default-features = false, version = '2.0.1' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
sp-block-builder = { default-features = false, version = '2.0.1' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
sp-consensus-aura = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
sp-core = { default-features = false, version = '2.0.1' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
@@ -58,6 +59,7 @@
sp-std = { default-features = false, version = '2.0.1' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
sp-transaction-pool = { default-features = false, version = '2.0.1' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
sp-version = { default-features = false, version = '2.0.1' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
+smallvec = "1.4.1"
[features]
default = ['std']
runtime/src/lib.rsdiffbeforeafterboth1//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 = "256"]1112// Make the WASM binary available.13#[cfg(feature = "std")]14include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));1516use pallet_grandpa::fg_primitives;17use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};18use sp_api::impl_runtime_apis;19use sp_consensus_aura::sr25519::AuthorityId as AuraId;20use sp_core::{ crypto::KeyTypeId, crypto::Public, OpaqueMetadata };21use sp_runtime::{22 Permill, Perbill, Perquintill, Percent,23 // BuildStorage, 24 ModuleId, FixedPointNumber,25 create_runtime_str, generic, impl_opaque_keys,26 traits::{27 Convert, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, 28 IdentityLookup, NumberFor, Verify,29 },30 transaction_validity::{TransactionSource, TransactionValidity},31 ApplyExtrinsicResult, MultiSignature,32};33use sp_std::prelude::*;34#[cfg(feature = "std")]35use sp_version::NativeVersion;36use sp_version::RuntimeVersion;37pub use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment, CurrencyAdapter, FeeDetails, RuntimeDispatchInfo};38// A few exports that help ease life for downstream crates.39pub use pallet_balances::Call as BalancesCall;40pub use pallet_contracts::Schedule as ContractsSchedule;41use pallet_contracts::WeightInfo;42pub use frame_support::{43 construct_runtime,44 dispatch::DispatchResult,45 parameter_types,46 traits::{47 Currency, ExistenceRequirement, Get, KeyOwnerProofSystem, OnUnbalanced, Randomness,48 LockIdentifier,49 },50 weights::{51 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},52 DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,53 WeightToFeePolynomial,54 },55 StorageValue,56};57// #[cfg(any(feature = "std", test))]58use frame_system::{59 self as system,60 EnsureRoot, 61 limits::{BlockWeights, BlockLength}};62use sp_std::{marker::PhantomData};6364pub use pallet_timestamp::Call as TimestampCall;6566mod chain_extension;67use crate::chain_extension::NFTExtension;6869/// Struct that handles the conversion of Balance -> `u64`. This is used for70/// staking's election calculation.71pub struct CurrencyToVoteHandler;7273impl CurrencyToVoteHandler {74 fn factor() -> Balance {75 (Balances::total_issuance() / u64::max_value() as Balance).max(1)76 }77}7879impl Convert<Balance, u64> for CurrencyToVoteHandler {80 fn convert(x: Balance) -> u64 {81 (x / Self::factor()) as u6482 }83}8485impl Convert<u128, Balance> for CurrencyToVoteHandler {86 fn convert(x: u128) -> Balance {87 x * Self::factor()88 }89}9091/// Re-export a nft pallet92/// TODO: Check this re-export. Is this safe and good style?93extern crate pallet_nft;94pub use pallet_nft::*;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;105106/// The type for looking up accounts. We don't expect more than 4 billion of them, but you107/// never know...108pub type AccountIndex = u32;109110/// Balance of an account.111pub type Balance = u128;112113/// Index of a transaction in the chain.114pub type Index = u32;115116/// A hash of some data used by the chain.117pub type Hash = sp_core::H256;118119/// Digest item type.120pub type DigestItem = generic::DigestItem<Hash>;121122mod nft_weights;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 header type.134 pub type Header = generic::Header<BlockNumber, BlakeTwo256>;135 /// Opaque block type.136 pub type Block = generic::Block<Header, UncheckedExtrinsic>;137 /// Opaque block identifier type.138 pub type BlockId = generic::BlockId<Block>;139140 impl_opaque_keys! {141 pub struct SessionKeys {142 pub aura: Aura,143 pub grandpa: Grandpa,144 }145 }146}147148/// This runtime version.149pub const VERSION: RuntimeVersion = RuntimeVersion {150 spec_name: create_runtime_str!("nft"),151 impl_name: create_runtime_str!("nft"),152 authoring_version: 1,153 spec_version: 3,154 impl_version: 1,155 apis: RUNTIME_API_VERSIONS,156 transaction_version: 1,157};158159pub const MILLISECS_PER_BLOCK: u64 = 6000;160161pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;162163// These time units are defined in number of blocks.164pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);165pub const HOURS: BlockNumber = MINUTES * 60;166pub const DAYS: BlockNumber = HOURS * 24;167168/// The version information used to identify this runtime when compiled natively.169#[cfg(feature = "std")]170pub fn native_version() -> NativeVersion {171 NativeVersion {172 runtime_version: VERSION,173 can_author_with: Default::default(),174 }175}176177/// Provides a membership set with only the configured aura users178pub struct ValiudatorsOnly<Runtime: pallet_aura::Config>(PhantomData<Runtime>);179impl frame_support::traits::Contains<AccountId> for ValiudatorsOnly<Runtime> {180 fn contains(t: &AccountId) -> bool {181 let arr: [u8; 32] = *t.as_ref();182 let raw_key: Vec<u8> = Vec::from(arr);183184 match pallet_aura::Module::<Runtime>::authorities().iter().find(|auth| auth.to_raw_vec() == raw_key) {185 Some(_) => true,186 None => false,187 } 188 }189 fn sorted_members() -> Vec<AccountId> {190 let mut members: Vec<AccountId> = Vec::new();191 for auth in pallet_aura::Module::<Runtime>::authorities() {192 let mut arr: [u8; 32] = Default::default(); 193 let bor_arr = auth.clone().to_raw_vec();194 let slice = bor_arr.as_slice();195 arr.copy_from_slice(slice);196 members.push(AccountId::from(arr));197 }198 members 199 }200 fn count() -> usize {201 pallet_aura::Module::<Runtime>::authorities().len()202 }203}204205impl frame_support::traits::ContainsLengthBound for ValiudatorsOnly<Runtime> {206 fn min_len() -> usize {207 1208 }209 fn max_len() -> usize {210 100211 }212}213214type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;215216pub struct DealWithFees;217impl OnUnbalanced<NegativeImbalance> for DealWithFees {218 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item=NegativeImbalance>) {219 if let Some(fees) = fees_then_tips.next() {220 // for fees, 80% to treasury, 20% to author221 let mut split = fees.ration(80, 20);222 if let Some(tips) = fees_then_tips.next() {223 // for tips, if any, 80% to treasury, 20% to author (though this can be anything)224 tips.ration_merge_into(80, 20, &mut split);225 }226 Treasury::on_unbalanced(split.0);227 // Author::on_unbalanced(split.1);228 }229 }230}231232/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.233/// This is used to limit the maximal weight of a single extrinsic.234const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);235/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used236/// by Operational extrinsics.237const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);238/// We allow for 2 seconds of compute with a 6 second average block time.239const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;240241parameter_types! {242 pub const BlockHashCount: BlockNumber = 2400;243 pub RuntimeBlockLength: BlockLength =244 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);245 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);246 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;247 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()248 .base_block(BlockExecutionWeight::get())249 .for_class(DispatchClass::all(), |weights| {250 weights.base_extrinsic = ExtrinsicBaseWeight::get();251 })252 .for_class(DispatchClass::Normal, |weights| {253 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);254 })255 .for_class(DispatchClass::Operational, |weights| {256 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);257 // Operational transactions have some extra reserved space, so that they258 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.259 weights.reserved = Some(260 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT261 );262 })263 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)264 .build_or_panic();265 pub const Version: RuntimeVersion = VERSION;266 pub const SS58Prefix: u8 = 42;267}268269impl system::Config for Runtime {270 /// The basic call filter to use in dispatchable.271 type BaseCallFilter = ();272 /// The identifier used to distinguish between accounts.273 type AccountId = AccountId;274 /// The aggregated dispatch type that is available for extrinsics.275 type Call = Call;276 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.277 type Lookup = IdentityLookup<AccountId>;278 /// The index type for storing how many extrinsics an account has signed.279 type Index = Index;280 /// The index type for blocks.281 type BlockNumber = BlockNumber;282 /// The type for hashing blocks and tries.283 type Hash = Hash;284 /// The hashing algorithm used.285 type Hashing = BlakeTwo256;286 /// The header type.287 type Header = generic::Header<BlockNumber, BlakeTwo256>;288 /// The ubiquitous event type.289 type Event = Event;290 /// The ubiquitous origin type.291 type Origin = Origin;292 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).293 type BlockHashCount = BlockHashCount;294 /// The weight of database operations that the runtime can invoke.295 type DbWeight = RocksDbWeight;296 /// The weight of the overhead invoked on the block import process, independent of the297 /// extrinsics included in that block.298 type BlockWeights = RuntimeBlockWeights;299 /// Version of the runtime.300 type Version = Version;301 /// This type is being generated by `construct_runtime!`.302 type PalletInfo = PalletInfo;303 /// What to do if a new account is created.304 type OnNewAccount = ();305 /// What to do if an account is fully reaped from the system.306 type OnKilledAccount = ();307 /// The data to be stored in an account.308 type AccountData = pallet_balances::AccountData<Balance>;309 /// Weight information for the extrinsics of this pallet.310 type SystemWeightInfo = system::weights::SubstrateWeight<Runtime>;311 312 type BlockLength = RuntimeBlockLength;313 type SS58Prefix = SS58Prefix;314}315316impl pallet_aura::Config for Runtime {317 type AuthorityId = AuraId;318}319320impl pallet_grandpa::Config for Runtime {321 type Event = Event;322 type Call = Call;323324 type KeyOwnerProofSystem = ();325326 type KeyOwnerProof =327 <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;328329 type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(330 KeyTypeId,331 GrandpaId,332 )>>::IdentificationTuple;333334 type HandleEquivocation = ();335336 type WeightInfo = ();337}338339parameter_types! {340 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;341}342343impl pallet_timestamp::Config for Runtime {344 /// A timestamp: milliseconds since the unix epoch.345 type Moment = u64;346 type OnTimestampSet = Aura;347 type MinimumPeriod = MinimumPeriod;348 type WeightInfo = ();349}350351parameter_types! {352 // pub const ExistentialDeposit: u128 = 500;353 pub const ExistentialDeposit: u128 = 0;354 pub const MaxLocks: u32 = 50;355}356357impl pallet_balances::Config for Runtime {358 type MaxLocks = MaxLocks;359 /// The type for recording an account's balance.360 type Balance = Balance;361 /// The ubiquitous event type.362 type Event = Event;363 type DustRemoval = Treasury;364 type ExistentialDeposit = ExistentialDeposit;365 type AccountStore = System;366 type WeightInfo = ();367}368369pub const MILLICENTS: Balance = 1_000_000_000;370pub const CENTS: Balance = 1_000 * MILLICENTS;371pub const DOLLARS: Balance = 100 * CENTS;372373pub const fn deposit(items: u32, bytes: u32) -> Balance {374 items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS375}376377parameter_types! {378 pub const TombstoneDeposit: Balance = deposit(379 0,380 sp_std::mem::size_of::<pallet_contracts::ContractInfo<Runtime>>() as u32381 );382 pub const DepositPerContract: Balance = TombstoneDeposit::get();383 pub const DepositPerStorageByte: Balance = deposit(0, 1);384 pub const DepositPerStorageItem: Balance = deposit(1, 0);385 pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * DAYS);386 pub const SurchargeReward: Balance = 150 * MILLICENTS;387 pub const SignedClaimHandicap: u32 = 2;388 pub const MaxDepth: u32 = 32;389 pub const MaxValueSize: u32 = 16 * 1024;390 // The lazy deletion runs inside on_initialize.391 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *392 RuntimeBlockWeights::get().max_block;393 // The weight needed for decoding the queue should be less or equal than a fifth394 // of the overall weight dedicated to the lazy deletion.395 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (396 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -397 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)398 )) / 5) as u32;399}400401402impl pallet_contracts::Config for Runtime {403 type Time = Timestamp;404 type Randomness = RandomnessCollectiveFlip;405 type Currency = Balances;406 type Event = Event;407 type RentPayment = ();408 type SignedClaimHandicap = SignedClaimHandicap;409 type TombstoneDeposit = TombstoneDeposit;410 type DepositPerContract = DepositPerContract;411 type DepositPerStorageByte = DepositPerStorageByte;412 type DepositPerStorageItem = DepositPerStorageItem;413 type RentFraction = RentFraction;414 type SurchargeReward = SurchargeReward;415 type MaxDepth = MaxDepth;416 type MaxValueSize = MaxValueSize;417 type WeightPrice = pallet_transaction_payment::Module<Self>;418 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;419 type ChainExtension = NFTExtension;420 type DeletionQueueDepth = DeletionQueueDepth;421 type DeletionWeightLimit = DeletionWeightLimit;422}423424parameter_types! {425 pub const TransactionByteFee: Balance = 10 * MILLICENTS;426 pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);427 pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(1, 100_000);428 pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 1_000_000_000u128);429}430431impl pallet_transaction_payment::Config for Runtime {432 type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees>;433 type TransactionByteFee = TransactionByteFee;434 type WeightToFee = IdentityFee<Balance>;435 type FeeMultiplierUpdate =436 TargetedFeeAdjustment<Self, TargetBlockFullness, AdjustmentVariable, MinimumMultiplier>;437}438439parameter_types! {440 pub const ProposalBond: Permill = Permill::from_percent(5);441 pub const ProposalBondMinimum: Balance = 1 * DOLLARS;442 pub const SpendPeriod: BlockNumber = 5 * MINUTES;443 pub const Burn: Permill = Permill::from_percent(0);444 pub const TipCountdown: BlockNumber = 1 * DAYS;445 pub const TipFindersFee: Percent = Percent::from_percent(20);446 pub const TipReportDepositBase: Balance = 1 * DOLLARS;447 pub const DataDepositPerByte: Balance = 1 * CENTS;448 pub const BountyDepositBase: Balance = 1 * DOLLARS;449 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;450 pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");451 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;452 pub const MaximumReasonLength: u32 = 16384;453 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);454 pub const BountyValueMinimum: Balance = 5 * DOLLARS;455}456457impl pallet_treasury::Config for Runtime {458 type ModuleId = TreasuryModuleId;459 type Currency = Balances;460 type ApproveOrigin = EnsureRoot<AccountId>;461 type RejectOrigin = EnsureRoot<AccountId>;462 type Event = Event;463 type OnSlash = ();464 type ProposalBond = ProposalBond;465 type ProposalBondMinimum = ProposalBondMinimum;466 type SpendPeriod = SpendPeriod;467 type Burn = Burn;468 type BurnDestination = ();469 type SpendFunds = ();470 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;471}472473impl pallet_sudo::Config for Runtime {474 type Event = Event;475 type Call = Call;476}477478parameter_types! {479 pub const MinVestedTransfer: Balance = 100 * DOLLARS;480}481482impl pallet_vesting::Config for Runtime {483 type Event = Event;484 type Currency = Balances;485 type BlockNumberToBalance = ConvertInto;486 type MinVestedTransfer = MinVestedTransfer;487 type WeightInfo = ();488}489490/// Used for the module nft in `./nft.rs`491impl pallet_nft::Config for Runtime {492 type Event = Event;493 type WeightInfo = nft_weights::WeightInfo;494}495496construct_runtime!(497 pub enum Runtime where498 Block = Block,499 NodeBlock = opaque::Block,500 UncheckedExtrinsic = UncheckedExtrinsic501 {502 System: system::{Module, Call, Config, Storage, Event<T>},503 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},504 Contracts: pallet_contracts::{Module, Call, Config<T>, Storage, Event<T>},505 Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},506 Aura: pallet_aura::{Module, Config<T>, Inherent},507 Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},508 Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},509 TransactionPayment: pallet_transaction_payment::{Module, Storage},510 Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},511 Nft: pallet_nft::{Module, Call, Config<T>, Storage, Event<T>},512 Treasury: pallet_treasury::{Module, Call, Storage, Config, Event<T>},513 Vesting: pallet_vesting::{Module, Call, Config<T>, Storage, Event<T>},514 }515);516517/// The address format for describing accounts.518pub type Address = AccountId;519/// Block header type as expected by this runtime.520pub type Header = generic::Header<BlockNumber, BlakeTwo256>;521/// Block type as expected by this runtime.522pub type Block = generic::Block<Header, UncheckedExtrinsic>;523/// A Block signed with a Justification524pub type SignedBlock = generic::SignedBlock<Block>;525/// BlockId type as expected by this runtime.526pub type BlockId = generic::BlockId<Block>;527/// The SignedExtension to the basic transaction logic.528pub type SignedExtra = (529 system::CheckSpecVersion<Runtime>,530 system::CheckTxVersion<Runtime>,531 system::CheckGenesis<Runtime>,532 system::CheckEra<Runtime>,533 system::CheckNonce<Runtime>,534 system::CheckWeight<Runtime>,535 pallet_nft::ChargeTransactionPayment<Runtime>,536);537/// Unchecked extrinsic type as expected by this runtime.538pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;539/// Extrinsic type that has already been checked.540pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;541/// Executive: handles dispatch to the various modules.542pub type Executive =543 frame_executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;544545impl_runtime_apis! {546547 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber>548 for Runtime549 {550 fn call(551 origin: AccountId,552 dest: AccountId,553 value: Balance,554 gas_limit: u64,555 input_data: Vec<u8>,556 ) -> pallet_contracts_primitives::ContractExecResult {557 Contracts::bare_call(origin, dest, value, gas_limit, input_data)558 }559560 fn get_storage(561 address: AccountId,562 key: [u8; 32],563 ) -> pallet_contracts_primitives::GetStorageResult {564 Contracts::get_storage(address, key)565 }566567 fn rent_projection(568 address: AccountId,569 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {570 Contracts::rent_projection(address)571 }572 }573574 impl sp_api::Core<Block> for Runtime {575 fn version() -> RuntimeVersion {576 VERSION577 }578579 fn execute_block(block: Block) {580 Executive::execute_block(block)581 }582583 fn initialize_block(header: &<Block as BlockT>::Header) {584 Executive::initialize_block(header)585 }586 }587588 impl sp_api::Metadata<Block> for Runtime {589 fn metadata() -> OpaqueMetadata {590 Runtime::metadata().into()591 }592 }593594 impl sp_block_builder::BlockBuilder<Block> for Runtime {595 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {596 Executive::apply_extrinsic(extrinsic)597 }598599 fn finalize_block() -> <Block as BlockT>::Header {600 Executive::finalize_block()601 }602603 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {604 data.create_extrinsics()605 }606607 fn check_inherents(608 block: Block,609 data: sp_inherents::InherentData,610 ) -> sp_inherents::CheckInherentsResult {611 data.check_extrinsics(&block)612 }613614 fn random_seed() -> <Block as BlockT>::Hash {615 RandomnessCollectiveFlip::random_seed()616 }617 }618619 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {620 fn validate_transaction(621 source: TransactionSource,622 tx: <Block as BlockT>::Extrinsic,623 ) -> TransactionValidity {624 Executive::validate_transaction(source, tx)625 }626 }627628 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {629 fn offchain_worker(header: &<Block as BlockT>::Header) {630 Executive::offchain_worker(header)631 }632 }633634 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {635 fn slot_duration() -> u64 {636 Aura::slot_duration()637 }638639 fn authorities() -> Vec<AuraId> {640 Aura::authorities()641 }642 }643644 impl sp_session::SessionKeys<Block> for Runtime {645 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {646 opaque::SessionKeys::generate(seed)647 }648649 fn decode_session_keys(650 encoded: Vec<u8>,651 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {652 opaque::SessionKeys::decode_into_raw_public_keys(&encoded)653 }654 }655656 impl fg_primitives::GrandpaApi<Block> for Runtime {657 fn grandpa_authorities() -> GrandpaAuthorityList {658 Grandpa::grandpa_authorities()659 }660661 fn submit_report_equivocation_unsigned_extrinsic(662 _equivocation_proof: fg_primitives::EquivocationProof<663 <Block as BlockT>::Hash,664 NumberFor<Block>,665 >,666 _key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,667 ) -> Option<()> {668 None669 }670671 fn generate_key_ownership_proof(672 _set_id: fg_primitives::SetId,673 _authority_id: GrandpaId,674 ) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {675 // NOTE: this is the only implementation possible since we've676 // defined our key owner proof type as a bottom type (i.e. a type677 // with no values).678 None679 }680 }681 682 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {683 fn account_nonce(account: AccountId) -> Index {684 System::account_nonce(account)685 }686 }687688 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {689 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {690 TransactionPayment::query_info(uxt, len)691 }692 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {693 TransactionPayment::query_fee_details(uxt, len)694 }695 }696697 #[cfg(feature = "runtime-benchmarks")]698 impl frame_benchmarking::Benchmark<Block> for Runtime {699 fn dispatch_benchmark(700 config: frame_benchmarking::BenchmarkConfig701 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {702 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};703704 let whitelist: Vec<TrackedStorageKey> = vec![705 // Alice account706 hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d").to_vec().into(),707 // // Total Issuance708 // hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),709 // // Execution Phase710 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),711 // // Event Count712 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),713 // // System Events714 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),715 ];716717 let mut batches = Vec::<BenchmarkBatch>::new();718 let params = (&config, &whitelist);719720 add_benchmark!(params, batches, pallet_nft, Nft);721722 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }723 Ok(batches)724 }725 }726}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 = "256"]1112// Make the WASM binary available.13#[cfg(feature = "std")]14include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));1516use pallet_grandpa::fg_primitives;17use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};18use sp_api::impl_runtime_apis;19use sp_consensus_aura::sr25519::AuthorityId as AuraId;20use sp_core::{ crypto::KeyTypeId, crypto::Public, OpaqueMetadata };21use sp_runtime::{22 Permill, Perbill, Perquintill, Percent,23 // BuildStorage, 24 ModuleId, FixedPointNumber,25 create_runtime_str, generic, impl_opaque_keys,26 traits::{27 Convert, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, 28 IdentityLookup, NumberFor, Verify,29 },30 transaction_validity::{TransactionSource, TransactionValidity},31 ApplyExtrinsicResult, MultiSignature,32};33use sp_std::prelude::*;34#[cfg(feature = "std")]35use sp_version::NativeVersion;36use sp_version::RuntimeVersion;37pub use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment, CurrencyAdapter, FeeDetails, RuntimeDispatchInfo};38// A few exports that help ease life for downstream crates.39pub use pallet_balances::Call as BalancesCall;40pub use pallet_contracts::Schedule as ContractsSchedule;41use pallet_contracts::WeightInfo;42pub use frame_support::{43 construct_runtime,44 dispatch::DispatchResult,45 parameter_types,46 traits::{47 Currency, ExistenceRequirement, Get, KeyOwnerProofSystem, OnUnbalanced, Randomness,48 LockIdentifier,49 },50 weights::{51 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},52 DispatchInfo, GetDispatchInfo, Pays, PostDispatchInfo, Weight,53 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients54 },55 StorageValue,56};57// #[cfg(any(feature = "std", test))]58use frame_system::{59 self as system,60 EnsureRoot, 61 limits::{BlockWeights, BlockLength}};62use sp_std::{marker::PhantomData};63use sp_arithmetic::{traits::{BaseArithmetic, Unsigned}};64use smallvec::{smallvec, SmallVec};6566pub use pallet_timestamp::Call as TimestampCall;6768mod chain_extension;69use crate::chain_extension::NFTExtension;7071/// Struct that handles the conversion of Balance -> `u64`. This is used for72/// staking's election calculation.73pub struct CurrencyToVoteHandler;7475impl CurrencyToVoteHandler {76 fn factor() -> Balance {77 (Balances::total_issuance() / u64::max_value() as Balance).max(1)78 }79}8081impl Convert<Balance, u64> for CurrencyToVoteHandler {82 fn convert(x: Balance) -> u64 {83 (x / Self::factor()) as u6484 }85}8687impl Convert<u128, Balance> for CurrencyToVoteHandler {88 fn convert(x: u128) -> Balance {89 x * Self::factor()90 }91}9293/// Re-export a nft pallet94/// TODO: Check this re-export. Is this safe and good style?95extern crate pallet_nft;96pub use pallet_nft::*;9798/// An index to a block.99pub type BlockNumber = u32;100101/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.102pub type Signature = MultiSignature;103104/// Some way of identifying an account on the chain. We intentionally make it equivalent105/// to the public key of our transaction signing scheme.106pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;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>;123124mod nft_weights;125126/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know127/// the specifics of the runtime. They can then be made to be agnostic over specific formats128/// of data like extrinsics, allowing for them to continue syncing the network through upgrades129/// to even the core data structures.130pub mod opaque {131 use super::*;132133 pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;134135 /// Opaque block header type.136 pub type Header = generic::Header<BlockNumber, BlakeTwo256>;137 /// Opaque block type.138 pub type Block = generic::Block<Header, UncheckedExtrinsic>;139 /// Opaque block identifier type.140 pub type BlockId = generic::BlockId<Block>;141142 impl_opaque_keys! {143 pub struct SessionKeys {144 pub aura: Aura,145 pub grandpa: Grandpa,146 }147 }148}149150/// This runtime version.151pub const VERSION: RuntimeVersion = RuntimeVersion {152 spec_name: create_runtime_str!("nft"),153 impl_name: create_runtime_str!("nft"),154 authoring_version: 1,155 spec_version: 3,156 impl_version: 1,157 apis: RUNTIME_API_VERSIONS,158 transaction_version: 1,159};160161pub const MILLISECS_PER_BLOCK: u64 = 6000;162163pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;164165// These time units are defined in number of blocks.166pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);167pub const HOURS: BlockNumber = MINUTES * 60;168pub const DAYS: BlockNumber = HOURS * 24;169170/// The version information used to identify this runtime when compiled natively.171#[cfg(feature = "std")]172pub fn native_version() -> NativeVersion {173 NativeVersion {174 runtime_version: VERSION,175 can_author_with: Default::default(),176 }177}178179/// Provides a membership set with only the configured aura users180pub struct ValiudatorsOnly<Runtime: pallet_aura::Config>(PhantomData<Runtime>);181impl frame_support::traits::Contains<AccountId> for ValiudatorsOnly<Runtime> {182 fn contains(t: &AccountId) -> bool {183 let arr: [u8; 32] = *t.as_ref();184 let raw_key: Vec<u8> = Vec::from(arr);185186 match pallet_aura::Module::<Runtime>::authorities().iter().find(|auth| auth.to_raw_vec() == raw_key) {187 Some(_) => true,188 None => false,189 } 190 }191 fn sorted_members() -> Vec<AccountId> {192 let mut members: Vec<AccountId> = Vec::new();193 for auth in pallet_aura::Module::<Runtime>::authorities() {194 let mut arr: [u8; 32] = Default::default(); 195 let bor_arr = auth.clone().to_raw_vec();196 let slice = bor_arr.as_slice();197 arr.copy_from_slice(slice);198 members.push(AccountId::from(arr));199 }200 members 201 }202 fn count() -> usize {203 pallet_aura::Module::<Runtime>::authorities().len()204 }205}206207impl frame_support::traits::ContainsLengthBound for ValiudatorsOnly<Runtime> {208 fn min_len() -> usize {209 1210 }211 fn max_len() -> usize {212 100213 }214}215216type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;217218pub struct DealWithFees;219impl OnUnbalanced<NegativeImbalance> for DealWithFees {220 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item=NegativeImbalance>) {221 if let Some(fees) = fees_then_tips.next() {222 // for fees, 100% to treasury223 let mut split = fees.ration(100, 0);224 if let Some(tips) = fees_then_tips.next() {225 // for tips, if any, 100% to treasury226 tips.ration_merge_into(100, 0, &mut split);227 }228 Treasury::on_unbalanced(split.0);229 // Author::on_unbalanced(split.1);230 }231 }232}233234/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.235/// This is used to limit the maximal weight of a single extrinsic.236const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);237/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used238/// by Operational extrinsics.239const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);240/// We allow for 2 seconds of compute with a 6 second average block time.241const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;242243parameter_types! {244 pub const BlockHashCount: BlockNumber = 2400;245 pub RuntimeBlockLength: BlockLength =246 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);247 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);248 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;249 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()250 .base_block(BlockExecutionWeight::get())251 .for_class(DispatchClass::all(), |weights| {252 weights.base_extrinsic = ExtrinsicBaseWeight::get();253 })254 .for_class(DispatchClass::Normal, |weights| {255 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);256 })257 .for_class(DispatchClass::Operational, |weights| {258 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);259 // Operational transactions have some extra reserved space, so that they260 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.261 weights.reserved = Some(262 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT263 );264 })265 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)266 .build_or_panic();267 pub const Version: RuntimeVersion = VERSION;268 pub const SS58Prefix: u8 = 42;269}270271impl system::Config for Runtime {272 /// The basic call filter to use in dispatchable.273 type BaseCallFilter = ();274 /// The identifier used to distinguish between accounts.275 type AccountId = AccountId;276 /// The aggregated dispatch type that is available for extrinsics.277 type Call = Call;278 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.279 type Lookup = IdentityLookup<AccountId>;280 /// The index type for storing how many extrinsics an account has signed.281 type Index = Index;282 /// The index type for blocks.283 type BlockNumber = BlockNumber;284 /// The type for hashing blocks and tries.285 type Hash = Hash;286 /// The hashing algorithm used.287 type Hashing = BlakeTwo256;288 /// The header type.289 type Header = generic::Header<BlockNumber, BlakeTwo256>;290 /// The ubiquitous event type.291 type Event = Event;292 /// The ubiquitous origin type.293 type Origin = Origin;294 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).295 type BlockHashCount = BlockHashCount;296 /// The weight of database operations that the runtime can invoke.297 type DbWeight = RocksDbWeight;298 /// The weight of the overhead invoked on the block import process, independent of the299 /// extrinsics included in that block.300 type BlockWeights = RuntimeBlockWeights;301 /// Version of the runtime.302 type Version = Version;303 /// This type is being generated by `construct_runtime!`.304 type PalletInfo = PalletInfo;305 /// What to do if a new account is created.306 type OnNewAccount = ();307 /// What to do if an account is fully reaped from the system.308 type OnKilledAccount = ();309 /// The data to be stored in an account.310 type AccountData = pallet_balances::AccountData<Balance>;311 /// Weight information for the extrinsics of this pallet.312 type SystemWeightInfo = system::weights::SubstrateWeight<Runtime>;313 314 type BlockLength = RuntimeBlockLength;315 type SS58Prefix = SS58Prefix;316}317318impl pallet_aura::Config for Runtime {319 type AuthorityId = AuraId;320}321322impl pallet_grandpa::Config for Runtime {323 type Event = Event;324 type Call = Call;325326 type KeyOwnerProofSystem = ();327328 type KeyOwnerProof =329 <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;330331 type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(332 KeyTypeId,333 GrandpaId,334 )>>::IdentificationTuple;335336 type HandleEquivocation = ();337338 type WeightInfo = ();339}340341parameter_types! {342 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;343}344345impl pallet_timestamp::Config for Runtime {346 /// A timestamp: milliseconds since the unix epoch.347 type Moment = u64;348 type OnTimestampSet = Aura;349 type MinimumPeriod = MinimumPeriod;350 type WeightInfo = ();351}352353parameter_types! {354 // pub const ExistentialDeposit: u128 = 500;355 pub const ExistentialDeposit: u128 = 0;356 pub const MaxLocks: u32 = 50;357}358359impl pallet_balances::Config for Runtime {360 type MaxLocks = MaxLocks;361 /// The type for recording an account's balance.362 type Balance = Balance;363 /// The ubiquitous event type.364 type Event = Event;365 type DustRemoval = Treasury;366 type ExistentialDeposit = ExistentialDeposit;367 type AccountStore = System;368 type WeightInfo = ();369}370371pub const MICROUNIQUE: Balance = 1_000_000_000;372pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;373pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;374pub const UNIQUE: Balance = 100 * CENTIUNIQUE;375376pub const fn deposit(items: u32, bytes: u32) -> Balance {377 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE378}379380parameter_types! {381 pub const TombstoneDeposit: Balance = deposit(382 0,383 sp_std::mem::size_of::<pallet_contracts::ContractInfo<Runtime>>() as u32384 );385 pub const DepositPerContract: Balance = TombstoneDeposit::get();386 pub const DepositPerStorageByte: Balance = deposit(0, 1);387 pub const DepositPerStorageItem: Balance = deposit(1, 0);388 pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * DAYS);389 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;390 pub const SignedClaimHandicap: u32 = 2;391 pub const MaxDepth: u32 = 32;392 pub const MaxValueSize: u32 = 16 * 1024;393 // The lazy deletion runs inside on_initialize.394 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *395 RuntimeBlockWeights::get().max_block;396 // The weight needed for decoding the queue should be less or equal than a fifth397 // of the overall weight dedicated to the lazy deletion.398 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (399 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -400 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)401 )) / 5) as u32;402}403404405impl pallet_contracts::Config for Runtime {406 type Time = Timestamp;407 type Randomness = RandomnessCollectiveFlip;408 type Currency = Balances;409 type Event = Event;410 type RentPayment = ();411 type SignedClaimHandicap = SignedClaimHandicap;412 type TombstoneDeposit = TombstoneDeposit;413 type DepositPerContract = DepositPerContract;414 type DepositPerStorageByte = DepositPerStorageByte;415 type DepositPerStorageItem = DepositPerStorageItem;416 type RentFraction = RentFraction;417 type SurchargeReward = SurchargeReward;418 type MaxDepth = MaxDepth;419 type MaxValueSize = MaxValueSize;420 type WeightPrice = pallet_transaction_payment::Module<Self>;421 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;422 type ChainExtension = NFTExtension;423 type DeletionQueueDepth = DeletionQueueDepth;424 type DeletionWeightLimit = DeletionWeightLimit;425}426427parameter_types! {428 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer 429}430431/// Linear implementor of `WeightToFeePolynomial` 432pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);433434impl<T> WeightToFeePolynomial for LinearFee<T> where435 T: BaseArithmetic + From<u32> + Copy + Unsigned436{437 type Balance = T;438439 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {440 smallvec!(WeightToFeeCoefficient {441 coeff_integer: 146_700u32.into(), // Targeting 0.1 Unique per NFT transfer442 coeff_frac: Perbill::zero(),443 negative: false,444 degree: 1,445 })446 }447}448449impl pallet_transaction_payment::Config for Runtime {450 type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees>;451 type TransactionByteFee = TransactionByteFee;452 type WeightToFee = LinearFee<Balance>;453 type FeeMultiplierUpdate = ();454}455456parameter_types! {457 pub const ProposalBond: Permill = Permill::from_percent(5);458 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;459 pub const SpendPeriod: BlockNumber = 5 * MINUTES;460 pub const Burn: Permill = Permill::from_percent(0);461 pub const TipCountdown: BlockNumber = 1 * DAYS;462 pub const TipFindersFee: Percent = Percent::from_percent(20);463 pub const TipReportDepositBase: Balance = 1 * UNIQUE;464 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;465 pub const BountyDepositBase: Balance = 1 * UNIQUE;466 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;467 pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");468 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;469 pub const MaximumReasonLength: u32 = 16384;470 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);471 pub const BountyValueMinimum: Balance = 5 * UNIQUE;472}473474impl pallet_treasury::Config for Runtime {475 type ModuleId = TreasuryModuleId;476 type Currency = Balances;477 type ApproveOrigin = EnsureRoot<AccountId>;478 type RejectOrigin = EnsureRoot<AccountId>;479 type Event = Event;480 type OnSlash = ();481 type ProposalBond = ProposalBond;482 type ProposalBondMinimum = ProposalBondMinimum;483 type SpendPeriod = SpendPeriod;484 type Burn = Burn;485 type BurnDestination = ();486 type SpendFunds = ();487 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;488}489490impl pallet_sudo::Config for Runtime {491 type Event = Event;492 type Call = Call;493}494495parameter_types! {496 pub const MinVestedTransfer: Balance = 10 * UNIQUE;497}498499impl pallet_vesting::Config for Runtime {500 type Event = Event;501 type Currency = Balances;502 type BlockNumberToBalance = ConvertInto;503 type MinVestedTransfer = MinVestedTransfer;504 type WeightInfo = ();505}506507/// Used for the module nft in `./nft.rs`508impl pallet_nft::Config for Runtime {509 type Event = Event;510 type WeightInfo = nft_weights::WeightInfo;511}512513construct_runtime!(514 pub enum Runtime where515 Block = Block,516 NodeBlock = opaque::Block,517 UncheckedExtrinsic = UncheckedExtrinsic518 {519 System: system::{Module, Call, Config, Storage, Event<T>},520 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},521 Contracts: pallet_contracts::{Module, Call, Config<T>, Storage, Event<T>},522 Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},523 Aura: pallet_aura::{Module, Config<T>, Inherent},524 Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},525 Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},526 TransactionPayment: pallet_transaction_payment::{Module, Storage},527 Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},528 Nft: pallet_nft::{Module, Call, Config<T>, Storage, Event<T>},529 Treasury: pallet_treasury::{Module, Call, Storage, Config, Event<T>},530 Vesting: pallet_vesting::{Module, Call, Config<T>, Storage, Event<T>},531 }532);533534/// The address format for describing accounts.535pub type Address = AccountId;536/// Block header type as expected by this runtime.537pub type Header = generic::Header<BlockNumber, BlakeTwo256>;538/// Block type as expected by this runtime.539pub type Block = generic::Block<Header, UncheckedExtrinsic>;540/// A Block signed with a Justification541pub type SignedBlock = generic::SignedBlock<Block>;542/// BlockId type as expected by this runtime.543pub type BlockId = generic::BlockId<Block>;544/// The SignedExtension to the basic transaction logic.545pub type SignedExtra = (546 system::CheckSpecVersion<Runtime>,547 system::CheckTxVersion<Runtime>,548 system::CheckGenesis<Runtime>,549 system::CheckEra<Runtime>,550 system::CheckNonce<Runtime>,551 system::CheckWeight<Runtime>,552 pallet_nft::ChargeTransactionPayment<Runtime>,553);554/// Unchecked extrinsic type as expected by this runtime.555pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;556/// Extrinsic type that has already been checked.557pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;558/// Executive: handles dispatch to the various modules.559pub type Executive =560 frame_executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;561562impl_runtime_apis! {563564 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber>565 for Runtime566 {567 fn call(568 origin: AccountId,569 dest: AccountId,570 value: Balance,571 gas_limit: u64,572 input_data: Vec<u8>,573 ) -> pallet_contracts_primitives::ContractExecResult {574 Contracts::bare_call(origin, dest, value, gas_limit, input_data)575 }576577 fn get_storage(578 address: AccountId,579 key: [u8; 32],580 ) -> pallet_contracts_primitives::GetStorageResult {581 Contracts::get_storage(address, key)582 }583584 fn rent_projection(585 address: AccountId,586 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {587 Contracts::rent_projection(address)588 }589 }590591 impl sp_api::Core<Block> for Runtime {592 fn version() -> RuntimeVersion {593 VERSION594 }595596 fn execute_block(block: Block) {597 Executive::execute_block(block)598 }599600 fn initialize_block(header: &<Block as BlockT>::Header) {601 Executive::initialize_block(header)602 }603 }604605 impl sp_api::Metadata<Block> for Runtime {606 fn metadata() -> OpaqueMetadata {607 Runtime::metadata().into()608 }609 }610611 impl sp_block_builder::BlockBuilder<Block> for Runtime {612 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {613 Executive::apply_extrinsic(extrinsic)614 }615616 fn finalize_block() -> <Block as BlockT>::Header {617 Executive::finalize_block()618 }619620 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {621 data.create_extrinsics()622 }623624 fn check_inherents(625 block: Block,626 data: sp_inherents::InherentData,627 ) -> sp_inherents::CheckInherentsResult {628 data.check_extrinsics(&block)629 }630631 fn random_seed() -> <Block as BlockT>::Hash {632 RandomnessCollectiveFlip::random_seed()633 }634 }635636 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {637 fn validate_transaction(638 source: TransactionSource,639 tx: <Block as BlockT>::Extrinsic,640 ) -> TransactionValidity {641 Executive::validate_transaction(source, tx)642 }643 }644645 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {646 fn offchain_worker(header: &<Block as BlockT>::Header) {647 Executive::offchain_worker(header)648 }649 }650651 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {652 fn slot_duration() -> u64 {653 Aura::slot_duration()654 }655656 fn authorities() -> Vec<AuraId> {657 Aura::authorities()658 }659 }660661 impl sp_session::SessionKeys<Block> for Runtime {662 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {663 opaque::SessionKeys::generate(seed)664 }665666 fn decode_session_keys(667 encoded: Vec<u8>,668 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {669 opaque::SessionKeys::decode_into_raw_public_keys(&encoded)670 }671 }672673 impl fg_primitives::GrandpaApi<Block> for Runtime {674 fn grandpa_authorities() -> GrandpaAuthorityList {675 Grandpa::grandpa_authorities()676 }677678 fn submit_report_equivocation_unsigned_extrinsic(679 _equivocation_proof: fg_primitives::EquivocationProof<680 <Block as BlockT>::Hash,681 NumberFor<Block>,682 >,683 _key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,684 ) -> Option<()> {685 None686 }687688 fn generate_key_ownership_proof(689 _set_id: fg_primitives::SetId,690 _authority_id: GrandpaId,691 ) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {692 // NOTE: this is the only implementation possible since we've693 // defined our key owner proof type as a bottom type (i.e. a type694 // with no values).695 None696 }697 }698 699 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {700 fn account_nonce(account: AccountId) -> Index {701 System::account_nonce(account)702 }703 }704705 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {706 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {707 TransactionPayment::query_info(uxt, len)708 }709 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {710 TransactionPayment::query_fee_details(uxt, len)711 }712 }713714 #[cfg(feature = "runtime-benchmarks")]715 impl frame_benchmarking::Benchmark<Block> for Runtime {716 fn dispatch_benchmark(717 config: frame_benchmarking::BenchmarkConfig718 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {719 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};720721 let whitelist: Vec<TrackedStorageKey> = vec![722 // Alice account723 hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d").to_vec().into(),724 // // Total Issuance725 // hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),726 // // Execution Phase727 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),728 // // Event Count729 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),730 // // System Events731 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),732 ];733734 let mut batches = Vec::<BenchmarkBatch>::new();735 let params = (&config, &whitelist);736737 add_benchmark!(params, batches, pallet_nft, Nft);738739 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }740 Ok(batches)741 }742 }743}tests/package.jsondiffbeforeafterboth--- a/tests/package.json
+++ b/tests/package.json
@@ -6,7 +6,7 @@
"devDependencies": {
"@polkadot/dev": "^0.61.24",
"@polkadot/ts": "^0.3.59",
- "@polkadot/typegen": "^3.6.3",
+ "@polkadot/typegen": "^3.6.4",
"@polkadot/util-crypto": "^5.4.4",
"@types/chai": "^4.2.12",
"@types/chai-as-promised": "^7.1.3",
@@ -32,15 +32,16 @@
"testToggleContractWhiteList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractWhiteList.test.ts",
"testAddToContractWhiteList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractWhiteList.test.ts",
"testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",
- "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts"
+ "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",
+ "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.test.ts"
},
"author": "",
"license": "SEE LICENSE IN ../LICENSE",
"homepage": "",
"dependencies": {
- "@polkadot/api": "^3.6.3",
- "@polkadot/api-contract": "^3.6.3",
- "@polkadot/util": "^3.6.3",
+ "@polkadot/api": "^3.6.4",
+ "@polkadot/api-contract": "^3.6.4",
+ "@polkadot/util": "^3.6.4",
"bignumber.js": "^9.0.0",
"chai-as-promised": "^7.1.1"
},
tests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth--- a/tests/src/creditFeesToTreasury.test.ts
+++ b/tests/src/creditFeesToTreasury.test.ts
@@ -9,16 +9,32 @@
import { alicesPublicKey, bobsPublicKey } from "./accounts";
import privateKey from "./substrate/privateKey";
import { BigNumber } from 'bignumber.js';
-import { createCollectionExpectSuccess, getGenericResult } from './util/helpers';
+import { IKeyringPair } from '@polkadot/types/types';
+import {
+ createCollectionExpectSuccess,
+ createItemExpectSuccess,
+ getGenericResult,
+ transferExpectSuccess
+} from './util/helpers';
chai.use(chaiAsPromised);
const expect = chai.expect;
const Treasury = "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z";
-const saneMinimumFee = 0.0001;
-const saneMaximumFee = 0.01;
+const saneMinimumFee = 0.05;
+const saneMaximumFee = 0.5;
+
+let alice: IKeyringPair;
+let bob: IKeyringPair;
describe('integration test: Fees must be credited to Treasury:', () => {
+ before(async () => {
+ await usingApi(async (api) => {
+ alice = privateKey('//Alice');
+ bob = privateKey('//Bob');
+ });
+ });
+
it('Total issuance does not change', async () => {
await usingApi(async (api) => {
const totalBefore = new BigNumber((await api.query.balances.totalIssuance()).toString());
@@ -107,5 +123,22 @@
});
});
+ it('NFT Transfer fee is close to 0.1 Unique', async () => {
+ await usingApi(async (api) => {
+ const collectionId = await createCollectionExpectSuccess();
+ const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
+
+ const aliceBalanceBefore = new BigNumber((await api.query.system.account(alicesPublicKey)).data.free.toString());
+ await transferExpectSuccess(collectionId, tokenId, alice, bob, 1, 'NFT');
+ const aliceBalanceAfter = new BigNumber((await api.query.system.account(alicesPublicKey)).data.free.toString());
+ const fee = aliceBalanceBefore.minus(aliceBalanceAfter);
+
+ console.log(fee.toString());
+ const expectedTransferFee = 0.1;
+ const tolerance = 0.00001;
+ expect(fee.dividedBy(1e15).minus(expectedTransferFee).abs().toNumber()).to.be.lessThan(tolerance);
+ });
+ });
+
});
tests/src/substrate/substrate-api.tsdiffbeforeafterboth--- a/tests/src/substrate/substrate-api.ts
+++ b/tests/src/substrate/substrate-api.ts
@@ -23,12 +23,12 @@
// TODO: Remove, this is temporary: Filter unneeded API output
// (Jaco promised it will be removed in the next version)
- const consoleLog = console.log;
- console.log = (message: string) => {
- if (!(message.includes("API/INIT: Capabilities detected") || message.includes("2021-"))) {
- consoleLog(message);
- }
- };
+ // const consoleLog = console.log;
+ // console.log = (message: string) => {
+ // if (!(message.includes("API/INIT: Capabilities detected") || message.includes("2021-"))) {
+ // consoleLog(message);
+ // }
+ // };
try {
await promisifySubstrate(api, async () => {
@@ -39,7 +39,7 @@
})();
} finally {
await api.disconnect();
- console.log = consoleLog;
+ // console.log = consoleLog;
}
}
tests/yarn.lockdiffbeforeafterboth--- a/tests/yarn.lock
+++ b/tests/yarn.lock
@@ -1195,45 +1195,45 @@
"@nodelib/fs.scandir" "2.1.4"
fastq "^1.6.0"
-"@polkadot/api-contract@^3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-3.6.3.tgz#0aaa6989d34d1c063c601ce8f1e19307ba112510"
- integrity sha512-M2j4R8wdIEJCCmJpRFjn/L/n6d6fN85UvpWNRfYebb+yflr5600UANS2nIxtq+7cjoC1FyxTuuIDimoKKeL2ng==
+"@polkadot/api-contract@^3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-3.6.4.tgz#3ede886af686f9d66faa7be3d5e5d14ee0dbdbed"
+ integrity sha512-vj0J0CcqaCVCZiV0auUEw8gkVetiRovybmvWA8CcTsmvI4w1TWgCMMBgNlzonibWdL/eXmaOU7W34mjBJ4qNwA==
dependencies:
"@babel/runtime" "^7.12.5"
- "@polkadot/api" "3.6.3"
- "@polkadot/types" "3.6.3"
+ "@polkadot/api" "3.6.4"
+ "@polkadot/types" "3.6.4"
"@polkadot/util" "^5.4.4"
"@polkadot/x-rxjs" "^5.4.4"
bn.js "^4.11.9"
-"@polkadot/api-derive@3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-3.6.3.tgz#9b01c83b20cfd1da55170eb1d994b538e0fc1b25"
- integrity sha512-S/8WxX5WUwjc6Qhc03Kdjgf5MRioYAkiX8beo5Q8uLyGvfyeA3rdRoeTHLGlIXRbbPSuI1hGEzNR2X7g2uKPOw==
+"@polkadot/api-derive@3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-3.6.4.tgz#806f1cc61ec474bb53374088c1f510c4ba07da86"
+ integrity sha512-AOdJnQxqNnjKay4F788xHYJqpsSjJV8n+zSLfXY8Fm9nMj2wPZ2y/C6k4zpZDQN1kHetYHpzVt77cVONJladvg==
dependencies:
"@babel/runtime" "^7.12.5"
- "@polkadot/api" "3.6.3"
- "@polkadot/rpc-core" "3.6.3"
- "@polkadot/types" "3.6.3"
+ "@polkadot/api" "3.6.4"
+ "@polkadot/rpc-core" "3.6.4"
+ "@polkadot/types" "3.6.4"
"@polkadot/util" "^5.4.4"
"@polkadot/util-crypto" "^5.4.4"
"@polkadot/x-rxjs" "^5.4.4"
bn.js "^4.11.9"
-"@polkadot/api@3.6.3", "@polkadot/api@^3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-3.6.3.tgz#eb3ae9b0877de7c0174afae3cd3005f90dbdae47"
- integrity sha512-U/fzYxuSghPBDBhGenfRSCGiY5t6E9mIXFxuX65LN89meFAJn3ToNX2q7kP0Y9234jmy+EGu96ZIseW7WQB/xA==
+"@polkadot/api@3.6.4", "@polkadot/api@^3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-3.6.4.tgz#a7b02eb0f4c2a98b087003edc1c2f7ed4bea077a"
+ integrity sha512-jsbBoL99OtBazGyufab9zkC1ORYdvrqzs5tHhLkhUl9zNrDBHyLVawyYNPXAyejtwLl3RMAWMMpnarDjlmjwPQ==
dependencies:
"@babel/runtime" "^7.12.5"
- "@polkadot/api-derive" "3.6.3"
+ "@polkadot/api-derive" "3.6.4"
"@polkadot/keyring" "^5.4.4"
- "@polkadot/metadata" "3.6.3"
- "@polkadot/rpc-core" "3.6.3"
- "@polkadot/rpc-provider" "3.6.3"
- "@polkadot/types" "3.6.3"
- "@polkadot/types-known" "3.6.3"
+ "@polkadot/metadata" "3.6.4"
+ "@polkadot/rpc-core" "3.6.4"
+ "@polkadot/rpc-provider" "3.6.4"
+ "@polkadot/types" "3.6.4"
+ "@polkadot/types-known" "3.6.4"
"@polkadot/util" "^5.4.4"
"@polkadot/util-crypto" "^5.4.4"
"@polkadot/x-rxjs" "^5.4.4"
@@ -1316,14 +1316,14 @@
"@polkadot/util" "5.4.4"
"@polkadot/util-crypto" "5.4.4"
-"@polkadot/metadata@3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-3.6.3.tgz#37a785e96acc908cb42d3b5a78be669abae2fed2"
- integrity sha512-QFdy5dvnWq9c3ybHyR/qnVtCv2xi9z+lFURuyS24gMynwzjZFpEQwISMQ6omIhEqxV++9b1c+BrORK1Uw54Lyg==
+"@polkadot/metadata@3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/metadata/-/metadata-3.6.4.tgz#033dad14d962c14b61cbcbfe5db7ef9700a4e771"
+ integrity sha512-EPxpiRnaqUvySLyasAXRJk7lb7YS0xvRuLHDaMIuoPpjtr1TqXxvhH4q/VjzjHpXTtriAVPczNydD+NtKYXDiQ==
dependencies:
"@babel/runtime" "^7.12.5"
- "@polkadot/types" "3.6.3"
- "@polkadot/types-known" "3.6.3"
+ "@polkadot/types" "3.6.4"
+ "@polkadot/types-known" "3.6.4"
"@polkadot/util" "^5.4.4"
"@polkadot/util-crypto" "^5.4.4"
bn.js "^4.11.9"
@@ -1335,25 +1335,25 @@
dependencies:
"@babel/runtime" "^7.12.5"
-"@polkadot/rpc-core@3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-3.6.3.tgz#5b584fa54e9f47a91650a73b6a08f4fafa8a4fa5"
- integrity sha512-q9FUj0j3qonrqN/Yp72nWqD7eMHtmM7ISTIKXma++BHuUSVlSHdMZM2Rza/3lxGasoUaxOW5vwYzhfMljiRRVw==
+"@polkadot/rpc-core@3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-3.6.4.tgz#d436e0d1d65d3cbd9b1e437f1827e3cf8a26089b"
+ integrity sha512-TzsmERRELrqB6mbf23GxLVObDhxInTrdSWkmle4a3qKXgAPfuGlEhxpqiaMMQZjo4LVHCeXStUc18VCHVY17ag==
dependencies:
"@babel/runtime" "^7.12.5"
- "@polkadot/metadata" "3.6.3"
- "@polkadot/rpc-provider" "3.6.3"
- "@polkadot/types" "3.6.3"
+ "@polkadot/metadata" "3.6.4"
+ "@polkadot/rpc-provider" "3.6.4"
+ "@polkadot/types" "3.6.4"
"@polkadot/util" "^5.4.4"
"@polkadot/x-rxjs" "^5.4.4"
-"@polkadot/rpc-provider@3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-3.6.3.tgz#d2f31c80abdeacba7c747a7da9937d6373659a23"
- integrity sha512-9g0Ka3dwFicf5xvlECCUCFBdJ0QAL1vV8OT4Lk3h71HmcsyrXSTamcxyc9GOSZEkcfJb3zRE+h+Ql7A1SV+yPw==
+"@polkadot/rpc-provider@3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-3.6.4.tgz#433572380264ed92c6cd06636057aea3967f659b"
+ integrity sha512-yWEgHdlO/lxqrkDXxq2kY87tuPg2xyR0OPw3LM+ZE8/UMubR/KWjAtk3/KI0iLimPMtKcCL4L3z/mazYN6A19Q==
dependencies:
"@babel/runtime" "^7.12.5"
- "@polkadot/types" "3.6.3"
+ "@polkadot/types" "3.6.4"
"@polkadot/util" "^5.4.4"
"@polkadot/util-crypto" "^5.4.4"
"@polkadot/x-fetch" "^5.4.4"
@@ -1369,40 +1369,40 @@
dependencies:
"@types/chrome" "^0.0.127"
-"@polkadot/typegen@^3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/typegen/-/typegen-3.6.3.tgz#c55dd31ad8e573e3620f1650ef7dcbc220bfcb50"
- integrity sha512-WjeFJoI2OH4y2/4VdmRCD/FRzGXj93RbVXxx4BVTGSi5ePMiTkvgOieMv7tz9bbR/DoHjB1VtPQPwmytecplHw==
+"@polkadot/typegen@^3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/typegen/-/typegen-3.6.4.tgz#6473933e185c11c23c7f06b97207bf64c1e388fb"
+ integrity sha512-VXVLm4WLTADk1X9QiGjq8LPfzRpt/z95s4bD+wQJkkKH1zw5FxBDIys/WAEB0Q2m5S0EAl5yTGNb2MKCcPxchg==
dependencies:
"@babel/core" "^7.12.10"
"@babel/register" "^7.12.10"
"@babel/runtime" "^7.12.5"
- "@polkadot/api" "3.6.3"
- "@polkadot/metadata" "3.6.3"
- "@polkadot/rpc-provider" "3.6.3"
- "@polkadot/types" "3.6.3"
+ "@polkadot/api" "3.6.4"
+ "@polkadot/metadata" "3.6.4"
+ "@polkadot/rpc-provider" "3.6.4"
+ "@polkadot/types" "3.6.4"
"@polkadot/util" "^5.4.4"
handlebars "^4.7.6"
websocket "^1.0.33"
yargs "^16.2.0"
-"@polkadot/types-known@3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-3.6.3.tgz#1a0639c463969e3f17ec20b06602c4ca4c25f500"
- integrity sha512-fgG4BwmJ/yhvHiJGGKfpcIVu0lsYuHutWthvW8KwDVOMjVIrSRoT7ct9+dD11+sA6rI1UiSOerQ70t7iv/qQ6w==
+"@polkadot/types-known@3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-3.6.4.tgz#765c212a7b8a9e4fa1538041911a0aa30302c5e4"
+ integrity sha512-wK2VN95h8isyHzkf9PD3/8udlj1pw54tOoSQYv9LPJ94EBLM0iAUYvz7dQX4MGy3H6kcJvwT21639Bt7aqWhzQ==
dependencies:
"@babel/runtime" "^7.12.5"
- "@polkadot/types" "3.6.3"
+ "@polkadot/types" "3.6.4"
"@polkadot/util" "^5.4.4"
bn.js "^4.11.9"
-"@polkadot/types@3.6.3":
- version "3.6.3"
- resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-3.6.3.tgz#d8ab3761956e3a9195c1436b4e650c8516ad9379"
- integrity sha512-R1S4N/LIJPceVMytMTDTcLV+EhkmlOkugcMElQlg0iShvEt/2ZuqfJlYaEKAaxmHfpEQuV5ct6pbcmZU5f0zBw==
+"@polkadot/types@3.6.4":
+ version "3.6.4"
+ resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-3.6.4.tgz#cdecfc317dd510b58854fe7c2f08e675f7c160b2"
+ integrity sha512-cfI5m08wk/1Cexxm0Qv+TELQPp1GQoWefuKBDMH2g8f4dbMD2lTelsmsAeRWvEoiS9Gd69PGjD0EwSIdjzj5ow==
dependencies:
"@babel/runtime" "^7.12.5"
- "@polkadot/metadata" "3.6.3"
+ "@polkadot/metadata" "3.6.4"
"@polkadot/util" "^5.4.4"
"@polkadot/util-crypto" "^5.4.4"
"@polkadot/x-rxjs" "^5.4.4"
@@ -1443,7 +1443,7 @@
camelcase "^5.3.1"
ip-regex "^4.3.0"
-"@polkadot/util@^3.6.3":
+"@polkadot/util@^3.6.4":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-3.7.1.tgz#b7585380a6177814f7e28dc2165814864ef2c67b"
integrity sha512-nvgzAbT/a213mpUd56YwK/zgbGKcQoMNLTmqcBHn1IP9u5J9XJcb1zPzqmCTg6mqnjrsgzJsWml9OpQftrcB6g==