difftreelog
Chain extensions cleanup in progress
in: master
11 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3398,7 +3398,7 @@
[[package]]
name = "nft"
-version = "2.0.1"
+version = "3.0.0"
dependencies = [
"flexi_logger",
"frame-benchmarking",
@@ -3443,7 +3443,7 @@
[[package]]
name = "nft-runtime"
-version = "2.0.1"
+version = "3.0.0"
dependencies = [
"frame-benchmarking",
"frame-executive",
@@ -3772,7 +3772,7 @@
[[package]]
name = "pallet-nft"
-version = "2.0.1"
+version = "3.0.0"
dependencies = [
"frame-benchmarking",
"frame-support",
node/Cargo.tomldiffbeforeafterboth--- a/node/Cargo.toml
+++ b/node/Cargo.toml
@@ -15,7 +15,7 @@
license = 'Unlicense'
name = 'nft'
repository = 'https://github.com/substrate-developer-hub/nft/'
-version = '2.0.1'
+version = '3.0.0'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
@@ -29,7 +29,7 @@
jsonrpc-core = '15.0.0'
# Substrate dependencies
-nft-runtime = { path = '../runtime', version = '2.0.1' }
+nft-runtime = { path = '../runtime', version = '3.0.0' }
frame-benchmarking = {version = '2.0.1', git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique'}
frame-benchmarking-cli = {version = '2.0.1', git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique'}
pallet-transaction-payment-rpc = {version = '2.0.1', git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique'}
pallets/nft/Cargo.tomldiffbeforeafterboth--- a/pallets/nft/Cargo.toml
+++ b/pallets/nft/Cargo.toml
@@ -6,7 +6,7 @@
license = 'Unlicense'
name = 'pallet-nft'
repository = 'https://github.com/substrate-developer-hub/nft/'
-version = '2.0.1'
+version = '3.0.0'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
runtime/Cargo.tomldiffbeforeafterboth--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -5,7 +5,7 @@
license = 'Unlicense'
name = 'nft-runtime'
repository = 'https://github.com/usetech-llc/nft_parachain/'
-version = '2.0.1'
+version = '3.0.0'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
@@ -25,7 +25,7 @@
serde = { features = ['derive'], optional = true, version = '1.0.101' }
# local dependencies
-pallet-nft = { path = '../pallets/nft', default-features = false, version = '2.0.1' }
+pallet-nft = { path = '../pallets/nft', default-features = false, version = '3.0.0' }
# Substrate dependencies
frame-benchmarking = { default-features = false, optional = true, version = '2.0.1' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'unique' }
runtime/src/chain_extension.rsdiffbeforeafterboth--- a/runtime/src/chain_extension.rs
+++ b/runtime/src/chain_extension.rs
@@ -20,7 +20,6 @@
use crate::Runtime;
use sp_runtime::AccountId32;
use crate::Vec;
-use frame_system::Origin;
/// Transfer parameters
#[derive(Debug, PartialEq, Encode, Decode)]
@@ -46,24 +45,24 @@
let input: NFTExtTransfer<E> = env.read_as()?;
// Sender to AccountId32
- let mut bytesSender: [u8; 32] = [0; 32];
- let addrVecSender: Vec<u8> = env.ext().caller().encode();
+ let mut bytes_sender: [u8; 32] = [0; 32];
+ let addr_vec_sender: Vec<u8> = env.ext().caller().encode();
for i in 0..32 {
- bytesSender[i] = addrVecSender[i];
+ bytes_sender[i] = addr_vec_sender[i];
}
- let sender = AccountId32::from(bytesSender);
+ let sender = AccountId32::from(bytes_sender);
// Recipient to AccountId32
- let mut bytesRec: [u8; 32] = [0; 32];
- let addrVecRec: Vec<u8> = input.recipient.encode();
+ let mut bytes_rec: [u8; 32] = [0; 32];
+ let addr_vec_rec: Vec<u8> = input.recipient.encode();
for i in 0..32 {
- bytesRec[i] = addrVecRec[i];
+ bytes_rec[i] = addr_vec_rec[i];
}
- let recipient = AccountId32::from(bytesRec);
+ let recipient = AccountId32::from(bytes_rec);
match pallet_nft::Module::<Runtime>::transfer_internal(sender, recipient, input.collection_id, input.token_id, input.amount) {
Ok(_) => Ok(RetVal::Converging(func_id)),
- DispatchError => Err(DispatchError::Other("Transfer error"))
+ _ => Err(DispatchError::Other("Transfer error"))
}
},
_ => {
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, 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}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, Percent,23 ModuleId,24 create_runtime_str, generic, impl_opaque_keys,25 traits::{26 Convert, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, 27 IdentityLookup, NumberFor, Verify,28 },29 transaction_validity::{TransactionSource, TransactionValidity},30 ApplyExtrinsicResult, MultiSignature,31};32#[cfg(feature = "std")]33use sp_version::NativeVersion;34use sp_version::RuntimeVersion;35pub use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment, CurrencyAdapter, FeeDetails, RuntimeDispatchInfo};36// A few exports that help ease life for downstream crates.37pub use pallet_balances::Call as BalancesCall;38pub use pallet_contracts::{Schedule as ContractsSchedule, WeightInfo};39pub use frame_support::{40 construct_runtime,41 dispatch::DispatchResult,42 parameter_types,43 StorageValue,44 traits::{45 Currency, ExistenceRequirement, Get, KeyOwnerProofSystem, OnUnbalanced, Randomness,46 LockIdentifier,47 },48 weights::{49 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},50 DispatchInfo, GetDispatchInfo, Pays, PostDispatchInfo, Weight,51 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients52 },53};54// #[cfg(any(feature = "std", test))]55use frame_system::{56 self as system,57 EnsureRoot, 58 limits::{BlockWeights, BlockLength},59};60use sp_std::{prelude::*, marker::PhantomData};61use sp_arithmetic::{traits::{BaseArithmetic, Unsigned}};62use smallvec::smallvec;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, 100% to treasury221 let mut split = fees.ration(100, 0);222 if let Some(tips) = fees_then_tips.next() {223 // for tips, if any, 100% to treasury224 tips.ration_merge_into(100, 0, &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 MICROUNIQUE: Balance = 1_000_000_000;370pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;371pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;372pub const UNIQUE: Balance = 100 * CENTIUNIQUE;373374pub const fn deposit(items: u32, bytes: u32) -> Balance {375 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE376}377378parameter_types! {379 pub const TombstoneDeposit: Balance = deposit(380 0,381 sp_std::mem::size_of::<pallet_contracts::ContractInfo<Runtime>>() as u32382 );383 pub const DepositPerContract: Balance = TombstoneDeposit::get();384 pub const DepositPerStorageByte: Balance = deposit(0, 1);385 pub const DepositPerStorageItem: Balance = deposit(1, 0);386 pub RentFraction: Perbill = Perbill::from_rational_approximation(1u32, 30 * DAYS);387 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;388 pub const SignedClaimHandicap: u32 = 2;389 pub const MaxDepth: u32 = 32;390 pub const MaxValueSize: u32 = 16 * 1024;391 // The lazy deletion runs inside on_initialize.392 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *393 RuntimeBlockWeights::get().max_block;394 // The weight needed for decoding the queue should be less or equal than a fifth395 // of the overall weight dedicated to the lazy deletion.396 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (397 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -398 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)399 )) / 5) as u32;400}401402403impl pallet_contracts::Config for Runtime {404 type Time = Timestamp;405 type Randomness = RandomnessCollectiveFlip;406 type Currency = Balances;407 type Event = Event;408 type RentPayment = ();409 type SignedClaimHandicap = SignedClaimHandicap;410 type TombstoneDeposit = TombstoneDeposit;411 type DepositPerContract = DepositPerContract;412 type DepositPerStorageByte = DepositPerStorageByte;413 type DepositPerStorageItem = DepositPerStorageItem;414 type RentFraction = RentFraction;415 type SurchargeReward = SurchargeReward;416 type MaxDepth = MaxDepth;417 type MaxValueSize = MaxValueSize;418 type WeightPrice = pallet_transaction_payment::Module<Self>;419 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;420 type ChainExtension = NFTExtension;421 type DeletionQueueDepth = DeletionQueueDepth;422 type DeletionWeightLimit = DeletionWeightLimit;423}424425parameter_types! {426 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer 427}428429/// Linear implementor of `WeightToFeePolynomial` 430pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);431432impl<T> WeightToFeePolynomial for LinearFee<T> where433 T: BaseArithmetic + From<u32> + Copy + Unsigned434{435 type Balance = T;436437 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {438 smallvec!(WeightToFeeCoefficient {439 coeff_integer: 146_700u32.into(), // Targeting 0.1 Unique per NFT transfer440 coeff_frac: Perbill::zero(),441 negative: false,442 degree: 1,443 })444 }445}446447impl pallet_transaction_payment::Config for Runtime {448 type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees>;449 type TransactionByteFee = TransactionByteFee;450 type WeightToFee = LinearFee<Balance>;451 type FeeMultiplierUpdate = ();452}453454parameter_types! {455 pub const ProposalBond: Permill = Permill::from_percent(5);456 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;457 pub const SpendPeriod: BlockNumber = 5 * MINUTES;458 pub const Burn: Permill = Permill::from_percent(0);459 pub const TipCountdown: BlockNumber = 1 * DAYS;460 pub const TipFindersFee: Percent = Percent::from_percent(20);461 pub const TipReportDepositBase: Balance = 1 * UNIQUE;462 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;463 pub const BountyDepositBase: Balance = 1 * UNIQUE;464 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;465 pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");466 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;467 pub const MaximumReasonLength: u32 = 16384;468 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);469 pub const BountyValueMinimum: Balance = 5 * UNIQUE;470}471472impl pallet_treasury::Config for Runtime {473 type ModuleId = TreasuryModuleId;474 type Currency = Balances;475 type ApproveOrigin = EnsureRoot<AccountId>;476 type RejectOrigin = EnsureRoot<AccountId>;477 type Event = Event;478 type OnSlash = ();479 type ProposalBond = ProposalBond;480 type ProposalBondMinimum = ProposalBondMinimum;481 type SpendPeriod = SpendPeriod;482 type Burn = Burn;483 type BurnDestination = ();484 type SpendFunds = ();485 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;486}487488impl pallet_sudo::Config for Runtime {489 type Event = Event;490 type Call = Call;491}492493parameter_types! {494 pub const MinVestedTransfer: Balance = 10 * UNIQUE;495}496497impl pallet_vesting::Config for Runtime {498 type Event = Event;499 type Currency = Balances;500 type BlockNumberToBalance = ConvertInto;501 type MinVestedTransfer = MinVestedTransfer;502 type WeightInfo = ();503}504505/// Used for the module nft in `./nft.rs`506impl pallet_nft::Config for Runtime {507 type Event = Event;508 type WeightInfo = nft_weights::WeightInfo;509}510511construct_runtime!(512 pub enum Runtime where513 Block = Block,514 NodeBlock = opaque::Block,515 UncheckedExtrinsic = UncheckedExtrinsic516 {517 System: system::{Module, Call, Config, Storage, Event<T>},518 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},519 Contracts: pallet_contracts::{Module, Call, Config<T>, Storage, Event<T>},520 Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},521 Aura: pallet_aura::{Module, Config<T>, Inherent},522 Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},523 Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},524 TransactionPayment: pallet_transaction_payment::{Module, Storage},525 Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},526 Nft: pallet_nft::{Module, Call, Config<T>, Storage, Event<T>},527 Treasury: pallet_treasury::{Module, Call, Storage, Config, Event<T>},528 Vesting: pallet_vesting::{Module, Call, Config<T>, Storage, Event<T>},529 }530);531532/// The address format for describing accounts.533pub type Address = AccountId;534/// Block header type as expected by this runtime.535pub type Header = generic::Header<BlockNumber, BlakeTwo256>;536/// Block type as expected by this runtime.537pub type Block = generic::Block<Header, UncheckedExtrinsic>;538/// A Block signed with a Justification539pub type SignedBlock = generic::SignedBlock<Block>;540/// BlockId type as expected by this runtime.541pub type BlockId = generic::BlockId<Block>;542/// The SignedExtension to the basic transaction logic.543pub type SignedExtra = (544 system::CheckSpecVersion<Runtime>,545 system::CheckTxVersion<Runtime>,546 system::CheckGenesis<Runtime>,547 system::CheckEra<Runtime>,548 system::CheckNonce<Runtime>,549 system::CheckWeight<Runtime>,550 pallet_nft::ChargeTransactionPayment<Runtime>,551);552/// Unchecked extrinsic type as expected by this runtime.553pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;554/// Extrinsic type that has already been checked.555pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;556/// Executive: handles dispatch to the various modules.557pub type Executive =558 frame_executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;559560impl_runtime_apis! {561562 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber>563 for Runtime564 {565 fn call(566 origin: AccountId,567 dest: AccountId,568 value: Balance,569 gas_limit: u64,570 input_data: Vec<u8>,571 ) -> pallet_contracts_primitives::ContractExecResult {572 Contracts::bare_call(origin, dest, value, gas_limit, input_data)573 }574575 fn get_storage(576 address: AccountId,577 key: [u8; 32],578 ) -> pallet_contracts_primitives::GetStorageResult {579 Contracts::get_storage(address, key)580 }581582 fn rent_projection(583 address: AccountId,584 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {585 Contracts::rent_projection(address)586 }587 }588589 impl sp_api::Core<Block> for Runtime {590 fn version() -> RuntimeVersion {591 VERSION592 }593594 fn execute_block(block: Block) {595 Executive::execute_block(block)596 }597598 fn initialize_block(header: &<Block as BlockT>::Header) {599 Executive::initialize_block(header)600 }601 }602603 impl sp_api::Metadata<Block> for Runtime {604 fn metadata() -> OpaqueMetadata {605 Runtime::metadata().into()606 }607 }608609 impl sp_block_builder::BlockBuilder<Block> for Runtime {610 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {611 Executive::apply_extrinsic(extrinsic)612 }613614 fn finalize_block() -> <Block as BlockT>::Header {615 Executive::finalize_block()616 }617618 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {619 data.create_extrinsics()620 }621622 fn check_inherents(623 block: Block,624 data: sp_inherents::InherentData,625 ) -> sp_inherents::CheckInherentsResult {626 data.check_extrinsics(&block)627 }628629 fn random_seed() -> <Block as BlockT>::Hash {630 RandomnessCollectiveFlip::random_seed()631 }632 }633634 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {635 fn validate_transaction(636 source: TransactionSource,637 tx: <Block as BlockT>::Extrinsic,638 ) -> TransactionValidity {639 Executive::validate_transaction(source, tx)640 }641 }642643 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {644 fn offchain_worker(header: &<Block as BlockT>::Header) {645 Executive::offchain_worker(header)646 }647 }648649 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {650 fn slot_duration() -> u64 {651 Aura::slot_duration()652 }653654 fn authorities() -> Vec<AuraId> {655 Aura::authorities()656 }657 }658659 impl sp_session::SessionKeys<Block> for Runtime {660 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {661 opaque::SessionKeys::generate(seed)662 }663664 fn decode_session_keys(665 encoded: Vec<u8>,666 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {667 opaque::SessionKeys::decode_into_raw_public_keys(&encoded)668 }669 }670671 impl fg_primitives::GrandpaApi<Block> for Runtime {672 fn grandpa_authorities() -> GrandpaAuthorityList {673 Grandpa::grandpa_authorities()674 }675676 fn submit_report_equivocation_unsigned_extrinsic(677 _equivocation_proof: fg_primitives::EquivocationProof<678 <Block as BlockT>::Hash,679 NumberFor<Block>,680 >,681 _key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,682 ) -> Option<()> {683 None684 }685686 fn generate_key_ownership_proof(687 _set_id: fg_primitives::SetId,688 _authority_id: GrandpaId,689 ) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {690 // NOTE: this is the only implementation possible since we've691 // defined our key owner proof type as a bottom type (i.e. a type692 // with no values).693 None694 }695 }696 697 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {698 fn account_nonce(account: AccountId) -> Index {699 System::account_nonce(account)700 }701 }702703 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {704 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {705 TransactionPayment::query_info(uxt, len)706 }707 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {708 TransactionPayment::query_fee_details(uxt, len)709 }710 }711712 #[cfg(feature = "runtime-benchmarks")]713 impl frame_benchmarking::Benchmark<Block> for Runtime {714 fn dispatch_benchmark(715 config: frame_benchmarking::BenchmarkConfig716 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {717 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};718719 let whitelist: Vec<TrackedStorageKey> = vec![720 // Alice account721 hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d").to_vec().into(),722 // // Total Issuance723 // hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),724 // // Execution Phase725 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),726 // // Event Count727 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),728 // // System Events729 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),730 ];731732 let mut batches = Vec::<BenchmarkBatch>::new();733 let params = (&config, &whitelist);734735 add_benchmark!(params, batches, pallet_nft, Nft);736737 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }738 Ok(batches)739 }740 }741}tests/src/addToContractWhiteList.test.tsdiffbeforeafterboth--- a/tests/src/addToContractWhiteList.test.ts
+++ b/tests/src/addToContractWhiteList.test.ts
@@ -14,7 +14,7 @@
describe('Integration Test addToContractWhiteList', () => {
- it(`Add an address to a contract white list`, async () => {
+ it.only(`Add an address to a contract white list`, async () => {
await usingApi(async api => {
const bob = privateKey("//Bob");
const [contract, deployer] = await deployFlipper(api);
tests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth--- a/tests/src/creditFeesToTreasury.test.ts
+++ b/tests/src/creditFeesToTreasury.test.ts
@@ -133,7 +133,7 @@
const aliceBalanceAfter = new BigNumber((await api.query.system.account(alicesPublicKey)).data.free.toString());
const fee = aliceBalanceBefore.minus(aliceBalanceAfter);
- console.log(fee.toString());
+ // 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
@@ -4,7 +4,8 @@
//
import { WsProvider, ApiPromise } from "@polkadot/api";
-import type { AccountId, Address, ApplyExtrinsicResult, DispatchError, DispatchInfo, EventRecord, Extrinsic, ExtrinsicStatus, Hash, RuntimeDispatchInfo } from '@polkadot/types/interfaces';
+import { EventRecord } from '@polkadot/types/interfaces/system/types';
+import { ExtrinsicStatus } from '@polkadot/types/interfaces/author/types';
import { IKeyringPair } from "@polkadot/types/types";
import config from "../config";
tests/src/util/contracthelpers.tsdiffbeforeafterboth--- a/tests/src/util/contracthelpers.ts
+++ b/tests/src/util/contracthelpers.ts
@@ -17,8 +17,8 @@
import { findUnusedAddress } from '../util/helpers';
const value = 0;
-const gasLimit = 3000n * 1000000n;
-const endowment = `1000000000000000`;
+const gasLimit = 200000n * 1000000n;
+const endowment = '100000000000000000';
function deployBlueprint(alice: IKeyringPair, code: CodePromise): Promise<Blueprint> {
return new Promise<Blueprint>(async (resolve, reject) => {
@@ -36,13 +36,15 @@
function deployContract(alice: IKeyringPair, blueprint: Blueprint) : Promise<any> {
return new Promise<any>(async (resolve, reject) => {
- const endowment = 1000000000000000n;
const initValue = true;
const unsub = await blueprint.tx
.new(endowment, gasLimit, initValue)
.signAndSend(alice, (result) => {
if (result.status.isInBlock || result.status.isFinalized) {
+
+ console.log("Contract deployed: ", result);
+
unsub();
resolve(result);
}
tests/yarn.lockdiffbeforeafterboth--- a/tests/yarn.lock
+++ b/tests/yarn.lock
@@ -1744,9 +1744,9 @@
integrity sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==
"@types/yargs@^15.0.0":
- version "15.0.12"
- resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.12.tgz#6234ce3e3e3fa32c5db301a170f96a599c960d74"
- integrity sha512-f+fD/fQAo3BCbCDlrUpznF1A5Zp9rB0noS5vnoormHSIPFKL0Z2DcUJ3Gxp5ytH4uLRNxy7AwYUC9exZzqGMAw==
+ version "15.0.13"
+ resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.13.tgz#34f7fec8b389d7f3c1fd08026a5763e072d3c6dc"
+ integrity sha512-kQ5JNTrbDv3Rp5X2n/iUu37IJBDU2gsZ5R/g1/KHOOEc5IKfUFjXT6DENPGduh08I/pamwtEq4oul7gUqKTQDQ==
dependencies:
"@types/yargs-parser" "*"
@@ -1798,10 +1798,10 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.12.0.tgz#fb891fe7ccc9ea8b2bbd2780e36da45d0dc055e5"
integrity sha512-N2RhGeheVLGtyy+CxRmxdsniB7sMSCfsnbh8K/+RUIXYYq3Ub5+sukRCjVE80QerrUBvuEvs4fDhz5AW/pcL6g==
-"@typescript-eslint/types@4.14.0":
- version "4.14.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.0.tgz#d8a8202d9b58831d6fd9cee2ba12f8a5a5dd44b6"
- integrity sha512-VsQE4VvpldHrTFuVPY1ZnHn/Txw6cZGjL48e+iBxTi2ksa9DmebKjAeFmTVAYoSkTk7gjA7UqJ7pIsyifTsI4A==
+"@typescript-eslint/types@4.14.1":
+ version "4.14.1"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa"
+ integrity sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==
"@typescript-eslint/typescript-estree@4.12.0":
version "4.12.0"
@@ -1818,12 +1818,12 @@
tsutils "^3.17.1"
"@typescript-eslint/typescript-estree@^4.8.2":
- version "4.14.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.0.tgz#4bcd67486e9acafc3d0c982b23a9ab8ac8911ed7"
- integrity sha512-wRjZ5qLao+bvS2F7pX4qi2oLcOONIB+ru8RGBieDptq/SudYwshveORwCVU4/yMAd4GK7Fsf8Uq1tjV838erag==
+ version "4.14.1"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz#20d3b8c8e3cdc8f764bdd5e5b0606dd83da6075b"
+ integrity sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==
dependencies:
- "@typescript-eslint/types" "4.14.0"
- "@typescript-eslint/visitor-keys" "4.14.0"
+ "@typescript-eslint/types" "4.14.1"
+ "@typescript-eslint/visitor-keys" "4.14.1"
debug "^4.1.1"
globby "^11.0.1"
is-glob "^4.0.1"
@@ -1839,12 +1839,12 @@
"@typescript-eslint/types" "4.12.0"
eslint-visitor-keys "^2.0.0"
-"@typescript-eslint/visitor-keys@4.14.0":
- version "4.14.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.0.tgz#b1090d9d2955b044b2ea2904a22496849acbdf54"
- integrity sha512-MeHHzUyRI50DuiPgV9+LxcM52FCJFYjJiWHtXlbyC27b80mfOwKeiKI+MHOTEpcpfmoPFm/vvQS88bYIx6PZTA==
+"@typescript-eslint/visitor-keys@4.14.1":
+ version "4.14.1"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz#e93c2ff27f47ee477a929b970ca89d60a117da91"
+ integrity sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==
dependencies:
- "@typescript-eslint/types" "4.14.0"
+ "@typescript-eslint/types" "4.14.1"
eslint-visitor-keys "^2.0.0"
"@ungap/promise-all-settled@1.1.2":
@@ -2497,9 +2497,9 @@
integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
caniuse-lite@^1.0.30001173:
- version "1.0.30001179"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001179.tgz#b0803883b4471a6c62066fb1752756f8afc699c8"
- integrity sha512-blMmO0QQujuUWZKyVrD1msR4WNDAqb/UPO1Sw2WWsQ7deoM5bJiicKnWJ1Y0NS/aGINSnKPIWBMw5luX+NDUCA==
+ version "1.0.30001181"
+ resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001181.tgz#4f0e5184e1ea7c3bf2727e735cbe7ca9a451d673"
+ integrity sha512-m5ul/ARCX50JB8BSNM+oiPmQrR5UmngaQ3QThTTp5HcIIQGP/nPBs82BYLE+tigzm3VW+F4BJIhUyaVtEweelQ==
capture-exit@^2.0.0:
version "2.0.0"
@@ -3255,9 +3255,9 @@
safer-buffer "^2.1.0"
electron-to-chromium@^1.3.634:
- version "1.3.642"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.642.tgz#8b884f50296c2ae2a9997f024d0e3e57facc2b94"
- integrity sha512-cev+jOrz/Zm1i+Yh334Hed6lQVOkkemk2wRozfMF4MtTR7pxf3r3L5Rbd7uX1zMcEqVJ7alJBnJL7+JffkC6FQ==
+ version "1.3.648"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.648.tgz#b05926eca1843c04b283e682a1fc6c10af7e9dda"
+ integrity sha512-4POzwyQ80tkDiBwkxn7IpfzioimrjRSFX1sCQ3pLZsYJ5ERYmwzdq0hZZ3nFP7Z6GtmnSn3xwWDm8FPlMeOoEQ==
elliptic@^6.5.3:
version "6.5.3"
@@ -3320,23 +3320,6 @@
integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==
dependencies:
is-arrayish "^0.2.1"
-
-es-abstract@^1.17.0-next.1:
- version "1.17.7"
- resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.7.tgz#a4de61b2f66989fc7421676c1cb9787573ace54c"
- integrity sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==
- dependencies:
- es-to-primitive "^1.2.1"
- function-bind "^1.1.1"
- has "^1.0.3"
- has-symbols "^1.0.1"
- is-callable "^1.2.2"
- is-regex "^1.1.1"
- object-inspect "^1.8.0"
- object-keys "^1.1.1"
- object.assign "^4.1.1"
- string.prototype.trimend "^1.0.1"
- string.prototype.trimstart "^1.0.1"
es-abstract@^1.18.0-next.1:
version "1.18.0-next.2"
@@ -3801,9 +3784,9 @@
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
fastq@^1.6.0:
- version "1.10.0"
- resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.10.0.tgz#74dbefccade964932cdf500473ef302719c652bb"
- integrity sha512-NL2Qc5L3iQEsyYzweq7qfgy5OtXCmGzGvhElGEd/SoFWEMOEczNh5s5ocaF01HDetxz+p8ecjNPA6cZxxIHmzA==
+ version "1.10.1"
+ resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.10.1.tgz#8b8f2ac8bf3632d67afcd65dac248d5fdc45385e"
+ integrity sha512-AWuv6Ery3pM+dY7LYS8YIaCiQvUaos9OB1RyNgaOWnaX+Tik7Onvcsf8x8c+YtDeT0maYLniBip2hox5KtEXXA==
dependencies:
reusify "^1.0.4"
@@ -4091,10 +4074,10 @@
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=
-get-intrinsic@^1.0.1, get-intrinsic@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.0.2.tgz#6820da226e50b24894e08859469dc68361545d49"
- integrity sha512-aeX0vrFm21ILl3+JpFFRNe9aUvp6VFZb2/CTbgLb8j75kOhvoNYjt9d8KA/tJG4gSo8nzEDedRl0h7vDmBYRVg==
+get-intrinsic@^1.0.1, get-intrinsic@^1.0.2, get-intrinsic@^1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.0.tgz#892e62931e6938c8a23ea5aaebcfb67bd97da97e"
+ integrity sha512-M11rgtQp5GZMZzDL7jLTNxbDfurpzuau5uqRWDPvlHjfvg3TdScAZo96GLvhMjImrmR8uAt0FS2RLoMrfWGKlg==
dependencies:
function-bind "^1.1.1"
has "^1.0.3"
@@ -4582,13 +4565,13 @@
through "^2.3.6"
internal-slot@^1.0.2:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.2.tgz#9c2e9fb3cd8e5e4256c6f45fe310067fcfa378a3"
- integrity sha512-2cQNfwhAfJIkU4KZPkDI+Gj5yNNnbqi40W9Gge6dfnk4TocEVm00B3bdiL+JINrbGJil2TeHvM4rETGzk/f/0g==
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c"
+ integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==
dependencies:
- es-abstract "^1.17.0-next.1"
+ get-intrinsic "^1.1.0"
has "^1.0.3"
- side-channel "^1.0.2"
+ side-channel "^1.0.4"
interpret@^1.0.0:
version "1.4.0"
@@ -5767,9 +5750,9 @@
object-visit "^1.0.0"
marked@^1.2.5:
- version "1.2.7"
- resolved "https://registry.yarnpkg.com/marked/-/marked-1.2.7.tgz#6e14b595581d2319cdcf033a24caaf41455a01fb"
- integrity sha512-No11hFYcXr/zkBvL6qFmAp1z6BKY3zqLMHny/JN/ey+al7qwCM2+CMBL9BOgqMxZU36fz4cCWfn2poWIf7QRXA==
+ version "1.2.8"
+ resolved "https://registry.yarnpkg.com/marked/-/marked-1.2.8.tgz#5008ece15cfa43e653e85845f3525af4beb6bdd4"
+ integrity sha512-lzmFjGnzWHkmbk85q/ILZjFoHHJIQGF+SxGEfIdGk/XhiTPhqGs37gbru6Kkd48diJnEyYwnG67nru0Z2gQtuQ==
md5.js@^1.3.4:
version "1.3.5"
@@ -6139,7 +6122,7 @@
define-property "^0.2.5"
kind-of "^3.0.3"
-object-inspect@^1.8.0, object-inspect@^1.9.0:
+object-inspect@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.9.0.tgz#c90521d74e1127b67266ded3394ad6116986533a"
integrity sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==
@@ -6156,7 +6139,7 @@
dependencies:
isobject "^3.0.0"
-object.assign@^4.1.0, object.assign@^4.1.1, object.assign@^4.1.2:
+object.assign@^4.1.0, object.assign@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940"
integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==
@@ -6452,9 +6435,9 @@
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
pathval@^1.1.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"
- integrity sha1-uULm1L3mUwBe9rcTYd74cn0GReA=
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d"
+ integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==
performance-now@^2.1.0:
version "2.1.0"
@@ -7291,7 +7274,7 @@
shiki-themes "^0.2.7"
vscode-textmate "^5.2.0"
-side-channel@^1.0.2, side-channel@^1.0.3:
+side-channel@^1.0.3, side-channel@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==
@@ -7570,7 +7553,7 @@
regexp.prototype.flags "^1.3.0"
side-channel "^1.0.3"
-string.prototype.trimend@^1.0.1, string.prototype.trimend@^1.0.3:
+string.prototype.trimend@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz#a22bd53cca5c7cf44d7c9d5c732118873d6cd18b"
integrity sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==
@@ -7578,7 +7561,7 @@
call-bind "^1.0.0"
define-properties "^1.1.3"
-string.prototype.trimstart@^1.0.1, string.prototype.trimstart@^1.0.3:
+string.prototype.trimstart@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz#9b4cb590e123bb36564401d59824298de50fd5aa"
integrity sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==
@@ -7925,9 +7908,9 @@
tslib "^1.8.1"
tsutils@^3.17.1:
- version "3.19.1"
- resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.19.1.tgz#d8566e0c51c82f32f9c25a4d367cd62409a547a9"
- integrity sha512-GEdoBf5XI324lu7ycad7s6laADfnAqCw6wLGI+knxvw9vsIYBaJfYdmeCEG3FMMUiSm3OGgNb+m6utsWf5h9Vw==
+ version "3.20.0"
+ resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.20.0.tgz#ea03ea45462e146b53d70ce0893de453ff24f698"
+ integrity sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==
dependencies:
tslib "^1.8.1"
@@ -7999,15 +7982,15 @@
dependencies:
is-typedarray "^1.0.0"
-typedoc-default-themes@^0.12.4:
- version "0.12.4"
- resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.12.4.tgz#5cbb79c1d6421f1274e86b1b542934eb557abd4f"
- integrity sha512-EZiXBUpogsYWe0dLgy47J8yRZCd+HAn9woGzO28XJxxSCSwZRYGKeQiw1KjyIcm3cBtLWUXiPD5+Bgx24GgZjg==
+typedoc-default-themes@^0.12.5:
+ version "0.12.5"
+ resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.12.5.tgz#063725a3eb407593ab07e4f110e5cf33b3892616"
+ integrity sha512-JQ2O9laZ/EhfWUWYp/8EyuShYhtXLhIa6DU8eZNUfaurMhEgKdffbadKNv6HMmTfOxAcgiePg06OCxNX8EyP3g==
typedoc-plugin-markdown@^3.3.0:
- version "3.4.3"
- resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.4.3.tgz#8be2669587485b5b6becb2f879713641819325ce"
- integrity sha512-7keqrkDfGECpjRnGLDpvS+Knw1fkQ0PHdoW6CJBs6uuaa2lJUUGgzDqbj2yWCghzF4jcK4hhGTcxpa9unNkGZg==
+ version "3.4.5"
+ resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.4.5.tgz#d32aad06a9b93946a31ea68438cd02620c12e857"
+ integrity sha512-m24mSCGcEk6tQDCHIG4TM3AS2a7e9NtC/YdO0mefyF+z1/bKYnZ/oQswLZmm2zBngiLIoKX6eNdufdBpQNPtrA==
dependencies:
handlebars "^4.7.6"
@@ -8017,9 +8000,9 @@
integrity sha512-jAAslwDbm5sVpA6EQIg5twYctRi/bnT9TgZ5SwbrNpCD5xCIIylPRX9KxIoi1RJliVgCIAxWbSUzzLKGwJCkeA==
typedoc@^0.20.13:
- version "0.20.16"
- resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.20.16.tgz#c845d32883af905439607ba03c9667b81cdbeb22"
- integrity sha512-xqIL8lT6ZE3QpP0GN30ckeTR05NSEkrP2pXQlNhC0OFkbvnjqJtDUcWSmCO15BuYyu4qsEbZT+tKYFEAt9Jxew==
+ version "0.20.19"
+ resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.20.19.tgz#4871f659bc03a545c572066329273f1b30fb1cba"
+ integrity sha512-9FjQ1xQGtxpXm8R5QKvU8wFBaaYe8RW3NzrhGWB8RigbOALwG+4ywJ/EyArPGWXvmXYB7I8h2YHzeyFvZ2s0ow==
dependencies:
colors "^1.4.0"
fs-extra "^9.0.1"
@@ -8031,7 +8014,7 @@
progress "^2.0.3"
shelljs "^0.8.4"
shiki "^0.2.7"
- typedoc-default-themes "^0.12.4"
+ typedoc-default-themes "^0.12.5"
typescript@^3.9.5, typescript@^3.9.7:
version "3.9.7"