diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml
index 1e05ea1..eb31621 100644
--- a/.idea/git_toolbox_prj.xml
+++ b/.idea/git_toolbox_prj.xml
@@ -17,5 +17,15 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 5a575d3..4a6fb5f 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,7 @@
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9d7b321..22b12c9 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,19 +7,32 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -30,6 +43,7 @@
+
@@ -69,19 +83,32 @@
- {
+ "keyToString": {
+ "ASKED_ADD_EXTERNAL_FILES": "true",
+ "WebServerToolWindowFactoryState": "false",
+ "last_opened_file_path": "/Users/duonghb53/UniqueOneNetwork/uniqueone-appchain/pallets/unet-nft/src",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "org.rust.cargo.project.model.PROJECT_DISCOVERY": "true",
+ "org.rust.disableDetachedFileInspection/Users/duonghb53/UniqueOneNetwork/uniqueone-appchain/node/src/chain_spec.rs": "true",
+ "org.rust.disableDetachedFileInspection/Users/duonghb53/UniqueOneNetwork/uniqueone-appchain/vendors/orml/authority/src/weights.rs": "true",
+ "org.rust.disableDetachedFileInspection/Users/duonghb53/UniqueOneNetwork/uniqueone-appchain/vendors/orml/benchmarking/src/tests.rs": "true",
+ "project.structure.last.edited": "Modules",
+ "project.structure.proportion": "0.15",
+ "project.structure.side.proportion": "0.2",
+ "settings.editor.selected.configurable": "language.rust.rustfmt"
}
-}]]>
+}
+
+
+
+
+
+
@@ -101,7 +128,32 @@
1648274239124
+
+
+
+
+
+
+
+
+
+
+
+
+ 1665431707186
+
+
+
+ 1665431707186
+
+ 1665594526186
+
+
+
+ 1665594526186
+
+
@@ -110,6 +162,28 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/.vscode/settings.json b/.vscode/settings.json
index b1775d7..bfee06d 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -19,5 +19,5 @@
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#42b883",
- "editor.formatOnSave": true
+ "editor.formatOnSave": false
}
diff --git a/Cargo.lock b/Cargo.lock
index 79bd4ea..0c9d8ba 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8951,6 +8951,7 @@ dependencies = [
name = "unet-config"
version = "1.0.0"
dependencies = [
+ "frame-benchmarking",
"frame-support",
"frame-system",
"pallet-balances",
@@ -8971,6 +8972,7 @@ dependencies = [
name = "unet-nft"
version = "1.0.0"
dependencies = [
+ "frame-benchmarking",
"frame-support",
"frame-system",
"pallet-balances",
@@ -8993,6 +8995,7 @@ dependencies = [
name = "unet-order"
version = "1.0.0"
dependencies = [
+ "frame-benchmarking",
"frame-support",
"frame-system",
"pallet-balances",
@@ -9175,7 +9178,7 @@ checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04"
[[package]]
name = "uniqueone-appchain"
-version = "1.5.7"
+version = "1.5.8"
dependencies = [
"beefy-gadget",
"beefy-gadget-rpc",
@@ -9256,7 +9259,7 @@ dependencies = [
[[package]]
name = "uniqueone-appchain-runtime"
-version = "1.5.7"
+version = "1.5.8"
dependencies = [
"beefy-primitives",
"chain-extension",
diff --git a/node/Cargo.toml b/node/Cargo.toml
index 9fa5b6c..bdbb2ef 100644
--- a/node/Cargo.toml
+++ b/node/Cargo.toml
@@ -7,7 +7,7 @@ license = 'Apache-2.0'
name = 'uniqueone-appchain'
publish = false
repository = 'https://github.com/Unique-One-Official/uniqueone-appchain'
-version = '1.5.7'
+version = '1.5.8'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
@@ -71,7 +71,7 @@ sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/par
## Substrate Frame Dependencies
frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
-frame-system = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
+frame-system = { version = "4.0.0-dev", git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
frame-system-rpc-runtime-api = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.18' }
substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
diff --git a/pallets/unet-auction/src/benchmarking.rs b/pallets/unet-auction/src/benchmarking.rs
index 93f0ecf..17d1a6c 100644
--- a/pallets/unet-auction/src/benchmarking.rs
+++ b/pallets/unet-auction/src/benchmarking.rs
@@ -4,8 +4,8 @@ use super::*;
use crate::{utils::test_helper::*, Pallet as UnetAuction};
use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};
use frame_system::RawOrigin;
-use unet_traits::time::MINUTES;
use sp_std::vec::Vec;
+use unet_traits::time::MINUTES;
const SEED: u32 = 0;
@@ -23,7 +23,6 @@ benchmarks! {
let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
let class_id = peek_next_class_id::();
- // nft_info!("submit_dutch_auction: class_id {:?}", class_id);
add_class::(alice.clone());
let mut tokens = Vec::new();
@@ -52,6 +51,314 @@ benchmarks! {
verify {
assert_last_event::(Event::::CreatedDutchAuction(bob.clone(), auction_id).into());
}
+
+ submit_british_auction {
+ let c in 1 .. MAX_TOKEN_PER_AUCTION;
+
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+ for i in 0..(c-1) {
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::zero()));
+ tokens.push((class_id, into!(i+1), into!(10)));
+ }
+
+ let auction_id = current_gid::();
+ }: {
+ UnetAuction::::submit_british_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ 0, // hammer_price
+ PerU16::from_percent(5), // min_raise
+ into!(ACCURACY), // deposit
+ into!(ACCURACY), // init_prince
+ into!(200), // deadline
+ false,
+ tokens,
+ PerU16::zero(),
+ )?;
+ }
+ verify {
+ assert_last_event::(Event::::CreatedBritishAuction(alice.clone(), auction_id).into());
+ }
+
+ bid_dutch_auction {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+ let recipient_lookup: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetAuction::::submit_dutch_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ into!(ACCURACY), // deposit
+ 200, // min_price
+ 2000, // max_price
+ into!((MINUTES as u64) * 120 + 1), // deadline
+ tokens,
+ true,
+ PerU16::from_percent(50),
+ PerU16::zero(),
+ )?;
+ }: {
+ UnetAuction::::bid_dutch_auction(
+ RawOrigin::Signed(bob.clone()).into(),
+ into!(ACCURACY),
+ recipient_lookup,
+ auction_id,
+ None,
+ None,
+ )?;
+ }
+
+ bid_british_auction {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+ let recipient_lookup: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetAuction::::submit_british_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ 0, // hammer_price
+ PerU16::from_percent(5), // min_raise
+ into!(ACCURACY), // deposit
+ into!(ACCURACY), // init_prince
+ into!(200), // deadline
+ false,
+ tokens,
+ PerU16::zero(),
+ )?;
+ }: {
+ UnetAuction::::bid_british_auction(
+ RawOrigin::Signed(bob.clone()).into(),
+ into!(ACCURACY),
+ recipient_lookup,
+ auction_id,
+ None,
+ None,
+ )?;
+ }
+
+ redeem_dutch_auction {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+ let recipient_lookup: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetAuction::::submit_dutch_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ into!(ACCURACY), // deposit
+ 200, // min_price
+ 2000, // max_price
+ into!(10), // deadline
+ tokens,
+ true,
+ PerU16::from_percent(50),
+ PerU16::zero(),
+ )?;
+
+ UnetAuction::::bid_dutch_auction(
+ RawOrigin::Signed(bob.clone()).into(),
+ into!(500),
+ recipient_lookup.clone(),
+ auction_id,
+ None,
+ None,
+ )?;
+
+ frame_system::Pallet::::set_block_number(into!(500));
+ }: {
+ UnetAuction::::redeem_dutch_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ recipient_lookup,
+ auction_id,
+ )?;
+ }
+
+ redeem_british_auction {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+ let recipient_lookup: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetAuction::::submit_british_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ 0, // hammer_price
+ PerU16::from_percent(5), // min_raise
+ into!(ACCURACY), // deposit
+ into!(ACCURACY), // init_prince
+ into!(10), // deadline
+ false,
+ tokens,
+ PerU16::zero(),
+ )?;
+
+ UnetAuction::::bid_british_auction(
+ RawOrigin::Signed(bob.clone()).into(),
+ into!(ACCURACY*2),
+ recipient_lookup.clone(),
+ auction_id,
+ None,
+ None,
+ )?;
+
+ frame_system::Pallet::::set_block_number(into!(500));
+ }: {
+ UnetAuction::::redeem_british_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ recipient_lookup,
+ auction_id,
+ )?;
+ }
+
+ remove_dutch_auction {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+ let recipient_lookup: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetAuction::::submit_dutch_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ into!(ACCURACY), // deposit
+ 200, // min_price
+ 2000, // max_price
+ into!((MINUTES as u64) * 120 + 1), // deadline
+ tokens,
+ true,
+ PerU16::from_percent(50),
+ PerU16::zero(),
+ )?;
+ }: {
+ UnetAuction::::remove_dutch_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ auction_id,
+ )?;
+ }
+
+ remove_british_auction {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+ let recipient_lookup: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetAuction::::submit_british_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ 0, // hammer_price
+ PerU16::from_percent(5), // min_raise
+ into!(ACCURACY), // deposit
+ into!(ACCURACY), // init_prince
+ into!(200), // deadline
+ false,
+ tokens,
+ PerU16::zero(),
+ )?;
+ }: {
+ UnetAuction::::remove_british_auction(
+ RawOrigin::Signed(alice.clone()).into(),
+ auction_id,
+ )?;
+ }
}
-impl_benchmark_test_suite!(UnetAuction, crate::mock::new_test_ext(), crate::mock::Runtime,);
\ No newline at end of file
+impl_benchmark_test_suite!(UnetAuction, crate::mock::new_test_ext(), crate::tests::Test,);
diff --git a/pallets/unet-auction/src/lib.rs b/pallets/unet-auction/src/lib.rs
index 039977a..a3801d9 100644
--- a/pallets/unet-auction/src/lib.rs
+++ b/pallets/unet-auction/src/lib.rs
@@ -19,15 +19,12 @@ use unet_traits::{
*,
};
-//mod benchmarking;
-//mod british_tests;
-//mod dutch_tests;
-//mod mock;
+mod benchmarking;
pub mod weights;
use crate::weights::WeightInfo;
-mod utils;
+pub mod utils;
pub use utils::*;
mod types;
@@ -292,7 +289,7 @@ pub mod pallet {
Ok(().into())
}
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::bid_dutch_auction())]
#[transactional]
pub fn bid_dutch_auction(
origin: OriginFor,
@@ -402,7 +399,7 @@ pub mod pallet {
}
/// redeem
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::redeem_dutch_auction())]
#[transactional]
pub fn redeem_dutch_auction(
origin: OriginFor,
@@ -446,7 +443,7 @@ pub mod pallet {
}
/// remove a dutch auction by auction owner.
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::remove_dutch_auction())]
#[transactional]
pub fn remove_dutch_auction(
origin: OriginFor,
@@ -469,7 +466,7 @@ pub mod pallet {
/// - `deadline`: A block number which represents the end of the auction activity.
/// - `allow_delay`: If ture, in some cases the deadline will be extended.
/// - `items`: Nft list.
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::submit_british_auction(items.len() as u32))]
#[transactional]
#[allow(clippy::too_many_arguments)]
pub fn submit_british_auction(
@@ -545,7 +542,7 @@ pub mod pallet {
}
/// Bid
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::bid_british_auction())]
#[transactional]
pub fn bid_british_auction(
origin: OriginFor,
@@ -625,7 +622,7 @@ pub mod pallet {
}
/// redeem
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::redeem_british_auction())]
#[transactional]
pub fn redeem_british_auction(
origin: OriginFor,
@@ -672,7 +669,7 @@ pub mod pallet {
}
/// remove an auction by auction owner.
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::remove_british_auction())]
#[transactional]
pub fn remove_british_auction(
origin: OriginFor,
diff --git a/pallets/unet-auction/src/weights.rs b/pallets/unet-auction/src/weights.rs
index c412874..8e64151 100644
--- a/pallets/unet-auction/src/weights.rs
+++ b/pallets/unet-auction/src/weights.rs
@@ -1,76 +1,223 @@
-// This file is part of Substrate.
-
-// Copyright (C) 2021 Parity Technologies (UK) Ltd.
-// SPDX-License-Identifier: Apache-2.0
-
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//! Autogenerated weights for nftmart_auction
+//! Autogenerated weights for unet_auction
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2021-07-24, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
-//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
+//! DATE: 2022-10-10, STEPS: `20`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
-// target/release/nftmart-node
+// target/release/uniqueone-appchain
// benchmark
// --chain=dev
-// --steps=50
-// --repeat=20
-// --pallet=nftmart_auction
-// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
+// --pallet=unet_auction
+// --extrinsic=*
+// --steps=20
+// --repeat=10
// --heap-pages=4096
-// --output=./pallets/nftmart-auction/src
-// --template=./.maintain/frame-weight-template.hbs
+// --template=./.maintain/pallet-weight-template.hbs
+// --output=./pallets/unet-auction/src/weights.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
-#![allow(clippy::all)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
-/// Weight functions needed for nftmart_auction.
+/// Weight functions needed for unet_auction.
pub trait WeightInfo {
fn submit_dutch_auction(c: u32, ) -> Weight;
+ fn submit_british_auction(c: u32, ) -> Weight;
+ fn bid_dutch_auction() -> Weight;
+ fn bid_british_auction() -> Weight;
+ fn redeem_dutch_auction() -> Weight;
+ fn redeem_british_auction() -> Weight;
+ fn remove_dutch_auction() -> Weight;
+ fn remove_british_auction() -> Weight;
}
-/// Weights for nftmart_auction using the Substrate node and recommended hardware.
+/// Weights for unet_auction using the Substrate node and recommended hardware.
pub struct SubstrateWeight(PhantomData);
impl WeightInfo for SubstrateWeight {
+ // Storage: UnetConf MaxCommissionRewardRate (r:1 w:0)
+ // Storage: UnetConf MinOrderDeposit (r:1 w:0)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetAuction DutchAuctions (r:0 w:1)
+ // Storage: UnetAuction DutchAuctionBids (r:0 w:1)
fn submit_dutch_auction(c: u32, ) -> Weight {
- (74_914_000 as Weight)
- // Standard Error: 6_000
- .saturating_add((14_471_000 as Weight).saturating_mul(c as Weight))
- .saturating_add(T::DbWeight::get().reads(3 as Weight))
- .saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
- .saturating_add(T::DbWeight::get().writes(4 as Weight))
- .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
+ 33_399_000_u64 // Standard Error: 68_000
+ .saturating_add((10_193_000_u64).saturating_mul(c as Weight))
+ .saturating_add(T::DbWeight::get().reads(3_u64))
+ .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c as Weight)))
+ .saturating_add(T::DbWeight::get().writes(3_u64))
+ .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c as Weight)))
+ }
+ // Storage: UnetConf MaxCommissionRewardRate (r:1 w:0)
+ // Storage: UnetConf MinOrderDeposit (r:1 w:0)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetAuction BritishAuctions (r:0 w:1)
+ // Storage: UnetAuction BritishAuctionBids (r:0 w:1)
+ fn submit_british_auction(c: u32, ) -> Weight {
+ 30_629_000_u64 // Standard Error: 62_000
+ .saturating_add((10_074_000_u64).saturating_mul(c as Weight))
+ .saturating_add(T::DbWeight::get().reads(4_u64))
+ .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c as Weight)))
+ .saturating_add(T::DbWeight::get().writes(4_u64))
+ .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c as Weight)))
+ }
+ // Storage: UnetAuction DutchAuctions (r:1 w:0)
+ // Storage: UnetAuction DutchAuctionBids (r:1 w:1)
+ fn bid_dutch_auction() -> Weight {
+ 33_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetAuction BritishAuctions (r:1 w:0)
+ // Storage: UnetAuction BritishAuctionBids (r:1 w:1)
+ fn bid_british_auction() -> Weight {
+ 33_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetAuction DutchAuctionBids (r:1 w:1)
+ // Storage: UnetAuction DutchAuctions (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: UnetConf AuctionCloseDelay (r:1 w:0)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf PlatformFeeRate (r:1 w:0)
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn redeem_dutch_auction() -> Weight {
+ 115_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(10_u64))
+ .saturating_add(T::DbWeight::get().writes(7_u64))
+ }
+ // Storage: UnetAuction BritishAuctionBids (r:1 w:1)
+ // Storage: UnetAuction BritishAuctions (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf PlatformFeeRate (r:1 w:0)
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn redeem_british_auction() -> Weight {
+ 113_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(9_u64))
+ .saturating_add(T::DbWeight::get().writes(7_u64))
+ }
+ // Storage: UnetAuction DutchAuctionBids (r:1 w:1)
+ // Storage: UnetAuction DutchAuctions (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ fn remove_dutch_auction() -> Weight {
+ 35_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(4_u64))
+ .saturating_add(T::DbWeight::get().writes(4_u64))
+ }
+ // Storage: UnetAuction BritishAuctionBids (r:1 w:1)
+ // Storage: UnetAuction BritishAuctions (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ fn remove_british_auction() -> Weight {
+ 35_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(4_u64))
+ .saturating_add(T::DbWeight::get().writes(4_u64))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
+ // Storage: UnetConf MaxCommissionRewardRate (r:1 w:0)
+ // Storage: UnetConf MinOrderDeposit (r:1 w:0)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetAuction DutchAuctions (r:0 w:1)
+ // Storage: UnetAuction DutchAuctionBids (r:0 w:1)
fn submit_dutch_auction(c: u32, ) -> Weight {
- (74_914_000 as Weight)
- // Standard Error: 6_000
- .saturating_add((14_471_000 as Weight).saturating_mul(c as Weight))
- .saturating_add(RocksDbWeight::get().reads(3 as Weight))
- .saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
- .saturating_add(RocksDbWeight::get().writes(4 as Weight))
- .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
- }
-}
\ No newline at end of file
+ 33_399_000_u64 // Standard Error: 68_000
+ .saturating_add((10_193_000_u64).saturating_mul(c as Weight))
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
+ .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(3_u64))
+ .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c as Weight)))
+ }
+ // Storage: UnetConf MaxCommissionRewardRate (r:1 w:0)
+ // Storage: UnetConf MinOrderDeposit (r:1 w:0)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetAuction BritishAuctions (r:0 w:1)
+ // Storage: UnetAuction BritishAuctionBids (r:0 w:1)
+ fn submit_british_auction(c: u32, ) -> Weight {
+ 30_629_000_u64 // Standard Error: 62_000
+ .saturating_add((10_074_000_u64).saturating_mul(c as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4_u64))
+ .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(4_u64))
+ .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c as Weight)))
+ }
+ // Storage: UnetAuction DutchAuctions (r:1 w:0) // Storage: UnetAuction DutchAuctionBids (r:1 w:1)
+ fn bid_dutch_auction() -> Weight {
+ 33_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetAuction BritishAuctions (r:1 w:0) // Storage: UnetAuction BritishAuctionBids (r:1 w:1)
+ fn bid_british_auction() -> Weight {
+ 33_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetAuction DutchAuctionBids (r:1 w:1)
+ // Storage: UnetAuction DutchAuctions (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: UnetConf AuctionCloseDelay (r:1 w:0)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf PlatformFeeRate (r:1 w:0)
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn redeem_dutch_auction() -> Weight {
+ 115_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(10_u64))
+ .saturating_add(RocksDbWeight::get().writes(7_u64))
+ }
+ // Storage: UnetAuction BritishAuctionBids (r:1 w:1)
+ // Storage: UnetAuction BritishAuctions (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf PlatformFeeRate (r:1 w:0)
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn redeem_british_auction() -> Weight {
+ 113_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(9_u64))
+ .saturating_add(RocksDbWeight::get().writes(7_u64))
+ }
+ // Storage: UnetAuction DutchAuctionBids (r:1 w:1) // Storage: UnetAuction DutchAuctions (r:1 w:1) // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ fn remove_dutch_auction() -> Weight {
+ 35_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(4_u64))
+ .saturating_add(RocksDbWeight::get().writes(4_u64))
+ }
+ // Storage: UnetAuction BritishAuctionBids (r:1 w:1)
+ // Storage: UnetAuction BritishAuctions (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ fn remove_british_auction() -> Weight {
+ 35_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(4_u64))
+ .saturating_add(RocksDbWeight::get().writes(4_u64))
+ }
+}
diff --git a/pallets/unet-config/Cargo.toml b/pallets/unet-config/Cargo.toml
index e900365..e84db59 100644
--- a/pallets/unet-config/Cargo.toml
+++ b/pallets/unet-config/Cargo.toml
@@ -24,6 +24,7 @@ frame-system = { default-features = false, git = 'https://github.com/paritytech/
pallet-proxy = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18' }
pallet-timestamp = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18' }
unet-traits = { default-features = false, path = "../unet-traits" }
+frame-benchmarking = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18', optional = true }
[dev-dependencies]
sp-io = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18' }
@@ -44,3 +45,4 @@ std = [
"pallet-timestamp/std",
"unet-traits/std",
]
+runtime-benchmarks = ["frame-benchmarking"]
diff --git a/pallets/unet-config/src/benchmarking.rs b/pallets/unet-config/src/benchmarking.rs
new file mode 100644
index 0000000..5a172b7
--- /dev/null
+++ b/pallets/unet-config/src/benchmarking.rs
@@ -0,0 +1,46 @@
+#![cfg(feature = "runtime-benchmarks")]
+
+use super::*;
+use crate::Pallet as UnetConf;
+use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};
+use frame_system::RawOrigin;
+
+benchmarks! {
+ add_whitelist {
+ let caller_origin = T::Origin::from(RawOrigin::Root);
+ let bob: T::AccountId = whitelisted_caller();
+ }: {
+ UnetConf::::add_whitelist(caller_origin, bob)?;
+ }
+
+ remove_whitelist {
+ let caller_origin = T::Origin::from(RawOrigin::Root);
+ let bob: T::AccountId = whitelisted_caller();
+ }: {
+ UnetConf::::remove_whitelist(caller_origin, bob)?;
+ }
+
+ create_category {
+ let caller_origin = T::Origin::from(RawOrigin::Root);
+ }: {
+ UnetConf::::create_category(caller_origin, Vec::from("1"),)?;
+ }
+
+ update_category {
+ let caller_origin = T::Origin::from(RawOrigin::Root);
+ }: {
+ UnetConf::::update_category(caller_origin, 1, Vec::from("2"),)?;
+ }
+
+ update_auction_close_delay {
+ let caller_origin = T::Origin::from(RawOrigin::Root);
+ }: {
+ UnetConf::::update_auction_close_delay(caller_origin, T::BlockNumber::default())?;
+ }
+
+ en_disable_whitelist {
+ let caller_origin = T::Origin::from(RawOrigin::Root);
+ }: {
+ UnetConf::::en_disable_whitelist(caller_origin)?;
+ }
+}
diff --git a/pallets/unet-config/src/lib.rs b/pallets/unet-config/src/lib.rs
index aa63f8f..9a2acf5 100644
--- a/pallets/unet-config/src/lib.rs
+++ b/pallets/unet-config/src/lib.rs
@@ -14,6 +14,10 @@ use unet_traits::{
time, CategoryData, NFTMetadata, UnetConfig,
};
+mod benchmarking;
+mod weights;
+use crate::weights::WeightInfo;
+
#[frame_support::pallet]
pub mod pallet {
use super::*;
@@ -21,6 +25,8 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
type Event: From> + IsType<::Event>;
+ /// Weight information for extrinsics in this pallet.
+ type WeightInfo: weights::WeightInfo;
}
#[pallet::error]
@@ -175,7 +181,7 @@ pub mod pallet {
#[pallet::call]
impl Pallet {
/// add an account into whitelist
- #[pallet::weight((100_000, DispatchClass::Operational))]
+ #[pallet::weight(T::WeightInfo::add_whitelist())]
#[transactional]
pub fn add_whitelist(
origin: OriginFor,
@@ -187,7 +193,7 @@ pub mod pallet {
}
/// remove an account from whitelist
- #[pallet::weight((100_000, DispatchClass::Operational))]
+ #[pallet::weight(T::WeightInfo::remove_whitelist())]
#[transactional]
pub fn remove_whitelist(
origin: OriginFor,
@@ -203,7 +209,7 @@ pub mod pallet {
/// A Selling NFT should belong to a category.
///
/// - `metadata`: metadata
- #[pallet::weight((100_000, DispatchClass::Operational, Pays::Yes))]
+ #[pallet::weight(T::WeightInfo::create_category())]
#[transactional]
pub fn create_category(
origin: OriginFor,
@@ -218,7 +224,7 @@ pub mod pallet {
///
/// - `category_id`: category ID
/// - `metadata`: metadata
- #[pallet::weight((100_000, DispatchClass::Operational, Pays::Yes))]
+ #[pallet::weight(T::WeightInfo::update_category())]
#[transactional]
pub fn update_category(
origin: OriginFor,
@@ -234,7 +240,7 @@ pub mod pallet {
Ok((None, Pays::No).into())
}
- #[pallet::weight((100_000, DispatchClass::Operational, Pays::Yes))]
+ #[pallet::weight(T::WeightInfo::update_auction_close_delay())]
#[transactional]
pub fn update_auction_close_delay(
origin: OriginFor,
@@ -246,7 +252,7 @@ pub mod pallet {
}
/// En/disable feature whitelist check
- #[pallet::weight((100_000, DispatchClass::Operational))]
+ #[pallet::weight(T::WeightInfo::en_disable_whitelist())]
#[transactional]
pub fn en_disable_whitelist(origin: OriginFor) -> DispatchResultWithPostInfo {
ensure_root(origin)?;
diff --git a/pallets/unet-config/src/weights.rs b/pallets/unet-config/src/weights.rs
new file mode 100644
index 0000000..5d96648
--- /dev/null
+++ b/pallets/unet-config/src/weights.rs
@@ -0,0 +1,112 @@
+//! Autogenerated weights for unet_config
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-10-05, STEPS: `20`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
+
+// Executed Command:
+// target/release/uniqueone-appchain
+// benchmark
+// --chain=dev
+// --execution=wasm
+// --wasm-execution=compiled
+// --pallet=unet_config
+// --extrinsic=*
+// --steps=20
+// --repeat=10
+// --heap-pages=4096
+// --template=./.maintain/pallet-weight-template.hbs
+// --output=./pallets/unet-config/src/weights.rs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for unet_config.
+pub trait WeightInfo {
+ fn add_whitelist() -> Weight;
+ fn remove_whitelist() -> Weight;
+ fn create_category() -> Weight;
+ fn update_category() -> Weight;
+ fn update_auction_close_delay() -> Weight;
+ fn en_disable_whitelist() -> Weight;
+}
+
+/// Weights for unet_config using the Substrate node and recommended hardware.
+pub struct SubstrateWeight(PhantomData);
+impl WeightInfo for SubstrateWeight {
+ // Storage: UnetConf AccountWhitelist (r:0 w:1)
+ fn add_whitelist() -> Weight {
+ 13_000_000_u64
+ .saturating_add(T::DbWeight::get().writes(1_u64)) }
+ // Storage: UnetConf AccountWhitelist (r:0 w:1)
+ fn remove_whitelist() -> Weight {
+ 13_000_000_u64
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetConf Categories (r:0 w:1)
+ fn create_category() -> Weight {
+ 16_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ }
+ // Storage: UnetConf Categories (r:1 w:1)
+ fn update_category() -> Weight {
+ 16_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetConf AuctionCloseDelay (r:0 w:1)
+ fn update_auction_close_delay() -> Weight {
+ 1_000_000_u64
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetConf IsWhiteListActivated (r:1 w:1)
+ fn en_disable_whitelist() -> Weight {
+ 4_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ // Storage: UnetConf AccountWhitelist (r:0 w:1)
+ fn add_whitelist() -> Weight {
+ 13_000_000_u64
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetConf AccountWhitelist (r:0 w:1)
+ fn remove_whitelist() -> Weight {
+ 13_000_000_u64
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetConf Categories (r:0 w:1)
+ fn create_category() -> Weight {
+ 16_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
+ .saturating_add(RocksDbWeight::get().writes(2_u64))
+ }
+ // Storage: UnetConf Categories (r:1 w:1)
+ fn update_category() -> Weight {
+ 16_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetConf AuctionCloseDelay (r:0 w:1)
+ fn update_auction_close_delay() -> Weight {
+ 1_000_000_u64
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+ // Storage: UnetConf IsWhiteListActivated (r:1 w:1)
+ fn en_disable_whitelist() -> Weight {
+ 4_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+}
diff --git a/pallets/unet-nft/Cargo.toml b/pallets/unet-nft/Cargo.toml
index a6419d0..277c576 100644
--- a/pallets/unet-nft/Cargo.toml
+++ b/pallets/unet-nft/Cargo.toml
@@ -26,6 +26,7 @@ pallet-timestamp = { default-features = false, git = 'https://github.com/parityt
unet-orml-traits = { version = "0.4.1-dev", default-features = false, path = "../unet-orml-traits" }
unet-orml-nft = { version = "0.4.1-dev", default-features = false, path = "../unet-orml-nft" }
unet-traits = { default-features = false, path = "../unet-traits" }
+frame-benchmarking = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18', optional = true }
[dev-dependencies]
sp-io = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18' }
@@ -49,3 +50,4 @@ std = [
"unet-orml-nft/std",
"unet-traits/std",
]
+runtime-benchmarks = ["frame-benchmarking"]
diff --git a/pallets/unet-nft/src/benchmarking.rs b/pallets/unet-nft/src/benchmarking.rs
new file mode 100644
index 0000000..2e95f6e
--- /dev/null
+++ b/pallets/unet-nft/src/benchmarking.rs
@@ -0,0 +1,238 @@
+#![cfg(feature = "runtime-benchmarks")]
+
+use super::*;
+use crate::*;
+use crate::{utils::test_helper::*, Pallet as UnetNft};
+
+use frame_benchmarking::{
+ account, benchmarks, impl_benchmark_test_suite, whitelist_account, whitelisted_caller,
+};
+use frame_system::RawOrigin;
+use sp_std::vec::Vec;
+const SEED: u32 = 0;
+
+benchmarks! {
+ create_class {
+ let alice: T::AccountId = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ let _ = ::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = ::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ add_whitelist::(&alice);
+ }: { UnetNft::::create_class(
+ RawOrigin::Signed(alice.clone()).into(),
+ Vec::from("1"),
+ Vec::from("1"),
+ Vec::from("1"),
+ PerU16::from_percent(5),
+ Properties(ClassProperty::Transferable | ClassProperty::Burnable),
+ vec![0, 1],
+ )?;
+ }
+
+ proxy_mint {
+ let alice: T::AccountId = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ let _ = ::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = ::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ add_whitelist::(&alice);
+
+ let class_id = unet_orml_nft::NextClassId::::get();
+ UnetNft::::create_class(
+ RawOrigin::Signed(alice.clone()).into(),
+ Vec::from("1"),
+ Vec::from("1"),
+ Vec::from("1"),
+ PerU16::from_percent(5),
+ Properties(ClassProperty::Transferable | ClassProperty::Burnable),
+ vec![0, 1],
+ )?;
+ let recipient_lookup: ::Source = T::Lookup::unlookup(alice.clone());
+ }: {
+ UnetNft::::proxy_mint(
+ RawOrigin::Signed(alice.clone()).into(),
+ recipient_lookup,
+ class_id,
+ Vec::from("1"),
+ into!(1),
+ Some(PerU16::from_percent(5)),
+ )?;
+ }
+
+ transfer {
+ let c in 1 .. 100;
+ let alice: T::AccountId = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ let _ = ::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = ::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ add_whitelist::(&alice);
+
+ let class_id = unet_orml_nft::NextClassId::::get();
+ UnetNft::::create_class(
+ RawOrigin::Signed(alice.clone()).into(),
+ Vec::from("1"),
+ Vec::from("1"),
+ Vec::from("1"),
+ PerU16::from_percent(5),
+ Properties(ClassProperty::Transferable | ClassProperty::Burnable),
+ vec![0, 1],
+ )?;
+
+ let owner: ::Source = T::Lookup::unlookup(alice.clone());
+ let to: ::Source = T::Lookup::unlookup(bob.clone());
+
+ UnetNft::::proxy_mint(
+ RawOrigin::Signed(alice.clone()).into(),
+ owner.clone(),
+ class_id,
+ Vec::from("1"),
+ into!(1),
+ Some(PerU16::from_percent(5)),
+ )?;
+
+ let mut tokens = Vec::new();
+ tokens.push((class_id, into!(0), into!(1)));
+ for i in 0..(c-1) {
+ UnetNft::::proxy_mint(
+ RawOrigin::Signed(alice.clone()).into(),
+ owner.clone(),
+ class_id,
+ Vec::from("1"),
+ into!(1),
+ Some(PerU16::from_percent(5)),
+ )?;
+ tokens.push((class_id, into!(i+1), into!(1)));
+ }
+ }: {
+ UnetNft::::transfer(
+ RawOrigin::Signed(alice.clone()).into(),
+ to,
+ tokens,
+ )?;
+ }
+
+ burn {
+ let alice: T::AccountId = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ let _ = ::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = ::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ add_whitelist::(&alice);
+
+ let class_id = unet_orml_nft::NextClassId::::get();
+ UnetNft::::create_class(
+ RawOrigin::Signed(alice.clone()).into(),
+ Vec::from("1"),
+ Vec::from("1"),
+ Vec::from("1"),
+ PerU16::from_percent(5),
+ Properties(ClassProperty::Transferable | ClassProperty::Burnable),
+ vec![0, 1],
+ )?;
+
+ let owner: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetNft::::proxy_mint(
+ RawOrigin::Signed(alice.clone()).into(),
+ owner,
+ class_id,
+ Vec::from("1"),
+ into!(1),
+ Some(PerU16::from_percent(5)),
+ )?;
+ }: {
+ UnetNft::::burn(
+ RawOrigin::Signed(alice.clone()).into(),
+ class_id,
+ into!(0),
+ into!(1),
+ )?;
+ }
+
+ update_token_royalty {
+ let alice: T::AccountId = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ let _ = ::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = ::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ add_whitelist::(&alice);
+
+ let class_id = unet_orml_nft::NextClassId::::get();
+ UnetNft::::create_class(
+ RawOrigin::Signed(alice.clone()).into(),
+ Vec::from("1"),
+ Vec::from("1"),
+ Vec::from("1"),
+ PerU16::from_percent(5),
+ Properties(ClassProperty::Transferable | ClassProperty::Burnable),
+ vec![0, 1],
+ )?;
+
+ let owner: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetNft::::proxy_mint(
+ RawOrigin::Signed(alice.clone()).into(),
+ owner,
+ class_id,
+ Vec::from("1"),
+ into!(1),
+ Some(PerU16::from_percent(5)),
+ )?;
+ }: {
+ UnetNft::::update_token_royalty(
+ RawOrigin::Signed(alice.clone()).into(),
+ class_id,
+ into!(0),
+ Some(PerU16::from_percent(5)),
+ )?;
+ }
+
+ update_token_royalty_beneficiary {
+ let alice: T::AccountId = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ let _ = ::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = ::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ add_whitelist::(&alice);
+
+ let class_id = unet_orml_nft::NextClassId::::get();
+ UnetNft::::create_class(
+ RawOrigin::Signed(alice.clone()).into(),
+ Vec::from("1"),
+ Vec::from("1"),
+ Vec::from("1"),
+ PerU16::from_percent(5),
+ Properties(ClassProperty::Transferable | ClassProperty::Burnable),
+ vec![0, 1],
+ )?;
+
+ let owner: ::Source = T::Lookup::unlookup(alice.clone());
+ let to: ::Source = T::Lookup::unlookup(bob.clone());
+
+ UnetNft::::proxy_mint(
+ RawOrigin::Signed(alice.clone()).into(),
+ owner,
+ class_id,
+ Vec::from("1"),
+ into!(1),
+ Some(PerU16::from_percent(5)),
+ )?;
+ }: {
+ UnetNft::::update_token_royalty_beneficiary(
+ RawOrigin::Signed(alice.clone()).into(),
+ class_id,
+ into!(0),
+ to,
+ )?;
+ }
+}
+
+impl_benchmark_test_suite!(UnetNft, crate::mock::new_test_ext(), crate::mock::Runtime,);
diff --git a/pallets/unet-nft/src/lib.rs b/pallets/unet-nft/src/lib.rs
index 9e6dbf6..b77ed3a 100644
--- a/pallets/unet-nft/src/lib.rs
+++ b/pallets/unet-nft/src/lib.rs
@@ -10,10 +10,12 @@ use frame_system::pallet_prelude::*;
pub use scale_info::TypeInfo;
use sp_runtime::{
traits::{
- AccountIdConversion, AtLeast32BitUnsigned, Bounded, CheckedAdd, One, StaticLookup, Zero,
+ AccountIdConversion, AtLeast32BitUnsigned, Bounded, CheckedAdd, One,
+ StaticLookup, Zero,
},
PerU16, RuntimeDebug, SaturatedConversion,
};
+
use sp_std::vec::Vec;
use unet_orml_traits::{MultiCurrency, MultiReservableCurrency};
@@ -31,6 +33,12 @@ pub type CurrencyIdOf = <::MultiCurrency as MultiCurrenc
>>::CurrencyId;
pub type BlockNumberOf = ::BlockNumber;
+mod benchmarking;
+pub mod utils;
+pub use utils::*;
+mod weights;
+use crate::weights::WeightInfo;
+
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)]
enum Releases {
V1_0_0,
@@ -183,6 +191,9 @@ pub mod pallet {
/// The currency mechanism.
type Currency: ReservableCurrency;
+
+ /// Weight information for extrinsics in this pallet.
+ type WeightInfo: weights::WeightInfo;
}
#[pallet::error]
@@ -391,7 +402,7 @@ pub mod pallet {
/// - `properties`: class property, include `Transferable` `Burnable`
/// - `name`: class name, with len limitation.
/// - `description`: class description, with len limitation.
- #[pallet::weight(100_000)]
+ #[pallet::weight(::WeightInfo::create_class())]
#[transactional]
pub fn create_class(
origin: OriginFor,
@@ -416,7 +427,7 @@ pub mod pallet {
}
/// Update token royalty.
- #[pallet::weight(100_000)]
+ #[pallet::weight(::WeightInfo::update_token_royalty())]
#[transactional]
pub fn update_token_royalty(
origin: OriginFor,
@@ -452,7 +463,7 @@ pub mod pallet {
}
/// Update token royalty beneficiary.
- #[pallet::weight(100_000)]
+ #[pallet::weight(::WeightInfo::update_token_royalty_beneficiary())]
#[transactional]
pub fn update_token_royalty_beneficiary(
origin: OriginFor,
@@ -510,7 +521,7 @@ pub mod pallet {
/// Mint NFT token by a proxy account.
///
/// - `origin`: a proxy account
- #[pallet::weight(100_000)]
+ #[pallet::weight(::WeightInfo::proxy_mint())]
#[transactional]
pub fn proxy_mint(
origin: OriginFor,
@@ -533,7 +544,7 @@ pub mod pallet {
/// - `class_id`: class id
/// - `token_id`: token id
/// - `quantity`: quantity
- #[pallet::weight(100_000)]
+ #[pallet::weight(::WeightInfo::transfer(items.len() as u32))]
#[transactional]
pub fn transfer(
origin: OriginFor,
@@ -555,7 +566,7 @@ pub mod pallet {
/// - `class_id`: class id
/// - `token_id`: token id
/// - `quantity`: quantity
- #[pallet::weight(100_000)]
+ #[pallet::weight(::WeightInfo::burn())]
#[transactional]
pub fn burn(
origin: OriginFor,
diff --git a/pallets/unet-nft/src/utils.rs b/pallets/unet-nft/src/utils.rs
new file mode 100644
index 0000000..1c31e3c
--- /dev/null
+++ b/pallets/unet-nft/src/utils.rs
@@ -0,0 +1,29 @@
+use crate::*;
+
+#[cfg(any(test, feature = "runtime-benchmarks"))]
+pub mod test_helper {
+ use crate::*;
+ use frame_support::assert_ok;
+ use sp_std::{vec, vec::Vec};
+
+ #[macro_export]
+ macro_rules! balances {
+ ($amount: expr) => {
+ unet_traits::constants_types::ACCURACY.saturating_mul($amount).saturated_into()
+ };
+ }
+
+ #[macro_export]
+ macro_rules! into {
+ ($amount: expr) => {
+ ($amount as u128).saturated_into()
+ };
+ }
+
+ pub fn add_whitelist(who: &Runtime::AccountId)
+ where
+ Runtime: crate::Config,
+ {
+ Runtime::ExtraConfig::do_add_whitelist(who);
+ }
+}
diff --git a/pallets/unet-nft/src/weights.rs b/pallets/unet-nft/src/weights.rs
new file mode 100644
index 0000000..2733dce
--- /dev/null
+++ b/pallets/unet-nft/src/weights.rs
@@ -0,0 +1,166 @@
+//! Autogenerated weights for unet_nft
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-10-12, STEPS: `20`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
+
+// Executed Command:
+// target/release/uniqueone-appchain
+// benchmark
+// --chain=dev
+// --execution=wasm
+// --wasm-execution=compiled
+// --pallet=unet_nft
+// --extrinsic=*
+// --steps=20
+// --repeat=10
+// --heap-pages=4096
+// --template=./.maintain/pallet-weight-template.hbs
+// --output=./pallets/unet-nft/src/weights.rs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for unet_nft.
+pub trait WeightInfo {
+ fn create_class() -> Weight;
+ fn proxy_mint() -> Weight;
+ fn transfer(c: u32, ) -> Weight;
+ fn burn() -> Weight;
+ fn update_token_royalty() -> Weight;
+ fn update_token_royalty_beneficiary() -> Weight;
+}
+
+/// Weights for unet_nft using the Substrate node and recommended hardware.
+pub struct SubstrateWeight(PhantomData)
+;impl WeightInfo for SubstrateWeight {
+ // Storage: UnetConf IsWhiteListActivated (r:1 w:0)
+ // Storage: UnetConf AccountWhitelist (r:1 w:0)
+ // Storage: UnetConf RoyaltiesRate (r:1 w:0)
+ // Storage: OrmlNFT NextClassId (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: Proxy Proxies (r:1 w:1)
+ // Storage: UnetConf Categories (r:2 w:2)
+ // Storage: OrmlNFT Classes (r:0 w:1)
+ fn create_class() -> Weight {
+ 95_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(9_u64))
+ .saturating_add(T::DbWeight::get().writes(7_u64))
+ }
+ // Storage: OrmlNFT Classes (r:1 w:1)
+ // Storage: Proxy Proxies (r:1 w:0)
+ // Storage: System Account (r:2 w:2)
+ // Storage: UnetConf IsWhiteListActivated (r:1 w:0)
+ // Storage: UnetConf AccountWhitelist (r:1 w:0)
+ // Storage: UnetConf RoyaltiesRate (r:1 w:0)
+ // Storage: OrmlNFT NextTokenId (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:0 w:1)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:0 w:1)
+ fn proxy_mint() -> Weight {
+ 78_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(8_u64))
+ .saturating_add(T::DbWeight::get().writes(7_u64))
+ }
+ // Storage: OrmlNFT Classes (r:1 w:0) // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:2)
+ fn transfer(c: u32, ) -> Weight {
+ 0_u64 // Standard Error: 109_000
+ .saturating_add((22_088_000_u64).saturating_mul(c as Weight))
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c as Weight)))
+ .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(c as Weight)))
+ }
+ // Storage: OrmlNFT Classes (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn burn() -> Weight {
+ 65_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(5_u64))
+ .saturating_add(T::DbWeight::get().writes(6_u64))
+ }
+ // Storage: OrmlNFT Tokens (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:0)
+ fn update_token_royalty() -> Weight {
+ 12_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+ // Storage: OrmlNFT Tokens (r:1 w:1)
+ fn update_token_royalty_beneficiary() -> Weight {
+ 7_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ // Storage: UnetConf IsWhiteListActivated (r:1 w:0)
+ // Storage: UnetConf AccountWhitelist (r:1 w:0)
+ // Storage: UnetConf RoyaltiesRate (r:1 w:0)
+ // Storage: OrmlNFT NextClassId (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: Proxy Proxies (r:1 w:1)
+ // Storage: UnetConf Categories (r:2 w:2)
+ // Storage: OrmlNFT Classes (r:0 w:1)
+ fn create_class() -> Weight {
+ 95_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(9_u64))
+ .saturating_add(RocksDbWeight::get().writes(7_u64))
+ }
+ // Storage: OrmlNFT Classes (r:1 w:1)
+ // Storage: Proxy Proxies (r:1 w:0)
+ // Storage: System Account (r:2 w:2)
+ // Storage: UnetConf IsWhiteListActivated (r:1 w:0)
+ // Storage: UnetConf AccountWhitelist (r:1 w:0)
+ // Storage: UnetConf RoyaltiesRate (r:1 w:0)
+ // Storage: OrmlNFT NextTokenId (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:0 w:1)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:0 w:1)
+ fn proxy_mint() -> Weight {
+ 78_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(8_u64))
+ .saturating_add(RocksDbWeight::get().writes(7_u64))
+ }
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:2)
+ fn transfer(c: u32, ) -> Weight {
+ 0_u64 // Standard Error: 109_000
+ .saturating_add((22_088_000_u64).saturating_mul(c as Weight))
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
+ .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c as Weight)))
+ .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(c as Weight)))
+ }
+ // Storage: OrmlNFT Classes (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn burn() -> Weight {
+ 65_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(5_u64))
+ .saturating_add(RocksDbWeight::get().writes(6_u64))
+ }
+ // Storage: OrmlNFT Tokens (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:0)
+ fn update_token_royalty() -> Weight {
+ 12_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+ // Storage: OrmlNFT Tokens (r:1 w:1)
+ fn update_token_royalty_beneficiary() -> Weight {
+ 7_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(1_u64))
+ .saturating_add(RocksDbWeight::get().writes(1_u64))
+ }
+}
diff --git a/pallets/unet-order/Cargo.toml b/pallets/unet-order/Cargo.toml
index 1ac58e1..b48bd5c 100644
--- a/pallets/unet-order/Cargo.toml
+++ b/pallets/unet-order/Cargo.toml
@@ -25,6 +25,7 @@ pallet-proxy = { default-features = false, git = 'https://github.com/paritytech/
pallet-timestamp = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18' }
unet-orml-traits = { version = "0.4.1-dev", default-features = false, path = "../unet-orml-traits" }
unet-traits = { default-features = false, path = "../unet-traits" }
+frame-benchmarking = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18', optional = true }
[dev-dependencies]
sp-io = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.18' }
@@ -49,3 +50,4 @@ std = [
"unet-orml-traits/std",
"unet-traits/std",
]
+runtime-benchmarks = ["frame-benchmarking"]
diff --git a/pallets/unet-order/src/benchmarking.rs b/pallets/unet-order/src/benchmarking.rs
new file mode 100644
index 0000000..d9e9c99
--- /dev/null
+++ b/pallets/unet-order/src/benchmarking.rs
@@ -0,0 +1,228 @@
+#![cfg(feature = "runtime-benchmarks")]
+
+use super::*;
+use crate::{utils::test_helper::*, Pallet as UnetOrder};
+use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};
+use frame_system::RawOrigin;
+use unet_traits::time::MINUTES;
+
+const SEED: u32 = 0;
+
+benchmarks! {
+ submit_order {
+ let c in 1 .. 100;
+
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+ for i in 0..(c-1) {
+ add_token::(alice.clone(), alice.clone(), class_id, into!(40), Some(PerU16::zero()));
+ tokens.push((class_id, into!(i+1), into!(10)));
+ }
+
+ let auction_id = current_gid::();
+ }: {
+ UnetOrder::::submit_order(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ into!(ACCURACY), // deposit
+ 200, // price
+ into!((MINUTES as u64) * 120 + 1), // deadline
+ tokens,
+ PerU16::zero(),
+ )?;
+ }
+
+ submit_offer {
+ let c in 1 .. 100;
+
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+ for i in 0..(c-1) {
+ add_token::(alice.clone(), alice.clone(), class_id, into!(40), Some(PerU16::zero()));
+ tokens.push((class_id, into!(i+1), into!(10)));
+ }
+
+ let auction_id = current_gid::();
+ }: {
+ UnetOrder::::submit_offer(
+ RawOrigin::Signed(bob.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ 200, // price
+ into!((MINUTES as u64) * 120 + 1), // deadline
+ tokens,
+ PerU16::zero(),
+ )?;
+ }
+
+ take_order {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+ let recipient_lookup: ::Source = T::Lookup::unlookup(alice.clone());
+
+ UnetOrder::::submit_order(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ into!(ACCURACY), // deposit
+ 200, // price
+ into!((MINUTES as u64) * 120 + 1), // deadline
+ tokens,
+ PerU16::zero(),
+ )?;
+ }: {
+ UnetOrder::::take_order(
+ RawOrigin::Signed(bob.clone()).into(),
+ auction_id,
+ recipient_lookup,
+ None,
+ None,
+ )?;
+ }
+
+ take_offer {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+ let recipient_lookup: ::Source = T::Lookup::unlookup(bob.clone());
+
+ UnetOrder::::submit_offer(
+ RawOrigin::Signed(bob.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ 200, // price
+ into!((MINUTES as u64) * 120 + 1), // deadline
+ tokens,
+ PerU16::zero(),
+ )?;
+ }: {
+ UnetOrder::::take_offer(
+ RawOrigin::Signed(alice.clone()).into(),
+ auction_id,
+ recipient_lookup,
+ None,
+ None,
+ )?;
+ }
+
+ remove_order {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+
+ UnetOrder::::submit_order(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ into!(ACCURACY), // deposit
+ 200, // price
+ into!((MINUTES as u64) * 120 + 1), // deadline
+ tokens,
+ PerU16::zero(),
+ )?;
+ }: {
+ UnetOrder::::remove_order(
+ RawOrigin::Signed(alice.clone()).into(),
+ auction_id,
+ )?;
+ }
+
+ remove_offer {
+ let alice = account("account", 0, SEED);
+ let bob: T::AccountId = whitelisted_caller();
+
+ add_whitelist::(&alice);
+ add_whitelist::(&bob);
+
+ let _ = T::Currency::make_free_balance_be(&alice, balances!(60000));
+ let _ = T::Currency::make_free_balance_be(&bob, balances!(60000));
+
+ let class_id = peek_next_class_id::();
+ add_class::(alice.clone());
+
+ let mut tokens = Vec::new();
+ add_token::(alice.clone(), alice.clone(), class_id, into!(20), Some(PerU16::from_percent(5)));
+ tokens.push((class_id, into!(0), into!(10)));
+
+ let auction_id = current_gid::();
+
+ UnetOrder::::submit_offer(
+ RawOrigin::Signed(alice.clone()).into(),
+ into!(NATIVE_CURRENCY_ID),
+ 200, // price
+ into!((MINUTES as u64) * 120 + 1), // deadline
+ tokens,
+ PerU16::zero(),
+ )?;
+ }: {
+ UnetOrder::::remove_offer(
+ RawOrigin::Signed(alice.clone()).into(),
+ auction_id,
+ )?;
+ }
+}
diff --git a/pallets/unet-order/src/lib.rs b/pallets/unet-order/src/lib.rs
index 183229b..1a0e536 100644
--- a/pallets/unet-order/src/lib.rs
+++ b/pallets/unet-order/src/lib.rs
@@ -19,6 +19,13 @@ pub use unet_traits::*;
pub use pallet::*;
+pub mod utils;
+pub use utils::*;
+
+mod benchmarking;
+mod weights;
+use crate::weights::WeightInfo;
+
#[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct Order {
@@ -123,6 +130,9 @@ pub mod pallet {
/// The treasury's pallet id, used for deriving its sovereign account ID.
#[pallet::constant]
type TreasuryPalletId: Get;
+
+ /// Weight information for extrinsics in this pallet.
+ type WeightInfo: weights::WeightInfo;
}
#[pallet::error]
@@ -237,7 +247,7 @@ pub mod pallet {
/// - `price`: nfts' price.
/// - `deadline`: deadline
/// - `items`: a list of `(class_id, token_id, quantity, price)`
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::submit_order(items.len() as u32))]
#[transactional]
pub fn submit_order(
origin: OriginFor,
@@ -287,7 +297,7 @@ pub mod pallet {
///
/// - `order_id`: order id
/// - `order_owner`: token owner
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::take_order())]
#[transactional]
pub fn take_order(
origin: OriginFor,
@@ -342,7 +352,7 @@ pub mod pallet {
/// remove an order by order owner.
///
/// - `order_id`: order id
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::remove_order())]
#[transactional]
pub fn remove_order(
origin: OriginFor,
@@ -357,7 +367,7 @@ pub mod pallet {
/// remove an offer by offer owner.
///
/// - `offer_id`: offer id
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::remove_offer())]
#[transactional]
pub fn remove_offer(
origin: OriginFor,
@@ -369,7 +379,7 @@ pub mod pallet {
Ok(().into())
}
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::submit_offer(items.len() as u32))]
#[transactional]
pub fn submit_offer(
origin: OriginFor,
@@ -414,7 +424,7 @@ pub mod pallet {
///
/// - `offer_id`: offer id
/// - `offer_owner`: token owner
- #[pallet::weight(100_000)]
+ #[pallet::weight(T::WeightInfo::take_offer())]
#[transactional]
pub fn take_offer(
origin: OriginFor,
diff --git a/pallets/unet-order/src/utils.rs b/pallets/unet-order/src/utils.rs
new file mode 100644
index 0000000..dddef20
--- /dev/null
+++ b/pallets/unet-order/src/utils.rs
@@ -0,0 +1,90 @@
+use crate::*;
+
+#[cfg(any(test, feature = "runtime-benchmarks"))]
+pub mod test_helper {
+ use crate::*;
+ use frame_support::assert_ok;
+ use sp_std::{vec, vec::Vec};
+
+ #[macro_export]
+ macro_rules! balances {
+ ($amount: expr) => {
+ unet_traits::constants_types::ACCURACY.saturating_mul($amount).saturated_into()
+ };
+ }
+
+ #[macro_export]
+ macro_rules! into {
+ ($amount: expr) => {
+ ($amount as u128).saturated_into()
+ };
+ }
+
+ pub fn add_whitelist(who: &Runtime::AccountId)
+ where
+ Runtime: crate::Config,
+ {
+ Runtime::ExtraConfig::do_add_whitelist(who);
+ }
+
+ pub fn add_class(who: Runtime::AccountId)
+ where
+ Runtime: crate::Config,
+ {
+ let cate_id1 = current_gid::();
+ add_category::();
+ let cate_id2 = current_gid::();
+ add_category::();
+ assert_ok!(Runtime::NFT::create_class(
+ &who,
+ Vec::from("1"),
+ Vec::from("1"),
+ Vec::from("1"),
+ PerU16::from_percent(5),
+ Properties(ClassProperty::Transferable | ClassProperty::Burnable),
+ vec![cate_id1, cate_id2],
+ ));
+ }
+
+ pub fn last_event() -> Runtime::Event
+ where
+ Runtime: frame_system::Config,
+ {
+ frame_system::Pallet::::events().pop().expect("Event expected").event
+ }
+
+ pub fn assert_last_event(generic_event: ::Event) {
+ frame_system::Pallet::::assert_last_event(generic_event.into());
+ }
+
+ pub fn add_token(
+ who: Runtime::AccountId,
+ to: Runtime::AccountId,
+ class_id: Runtime::ClassId,
+ quantity: Runtime::TokenId,
+ charge_royalty: Option,
+ ) where
+ Runtime: crate::Config,
+ {
+ assert_ok!(Runtime::NFT::proxy_mint(
+ &who,
+ &to,
+ class_id,
+ Vec::from("1"),
+ quantity,
+ charge_royalty
+ ));
+ }
+
+ pub fn add_category() {
+ assert_ok!(Runtime::ExtraConfig::do_create_category(Vec::from("1")));
+ }
+
+ pub fn current_gid() -> GlobalId {
+ Runtime::ExtraConfig::peek_next_gid()
+ }
+
+ pub fn peek_next_class_id() -> Runtime::ClassId {
+ Runtime::NFT::peek_next_class_id()
+ }
+}
diff --git a/pallets/unet-order/src/weights.rs b/pallets/unet-order/src/weights.rs
new file mode 100644
index 0000000..5bf3c14
--- /dev/null
+++ b/pallets/unet-order/src/weights.rs
@@ -0,0 +1,175 @@
+//! Autogenerated weights for unet_order
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2022-10-10, STEPS: `20`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
+
+// Executed Command:
+// target/release/uniqueone-appchain
+// benchmark
+// --chain=dev
+// --execution=wasm
+// --wasm-execution=compiled
+// --pallet=unet_order
+// --extrinsic=*
+// --steps=20
+// --repeat=10
+// --heap-pages=4096
+// --template=./.maintain/pallet-weight-template.hbs
+// --output=./pallets/unet-order/src/weights.rs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use sp_std::marker::PhantomData;
+
+/// Weight functions needed for unet_order.
+pub trait WeightInfo {
+ fn submit_order(c: u32, ) -> Weight;
+ fn submit_offer(c: u32, ) -> Weight;
+ fn take_order() -> Weight;
+ fn take_offer() -> Weight;
+ fn remove_order() -> Weight;
+ fn remove_offer() -> Weight;
+}
+
+/// Weights for unet_order using the Substrate node and recommended hardware.
+pub struct SubstrateWeight(PhantomData);
+impl WeightInfo for SubstrateWeight {
+ // Storage: UnetConf MaxCommissionRewardRate (r:1 w:0)
+ // Storage: UnetConf MinOrderDeposit (r:1 w:0)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetOrder Orders (r:0 w:1)
+ fn submit_order(c: u32, ) -> Weight {
+ 17_587_000_u64 // Standard Error: 81_000
+ .saturating_add((10_585_000_u64).saturating_mul(c as Weight))
+ .saturating_add(T::DbWeight::get().reads(4_u64))
+ .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c as Weight)))
+ .saturating_add(T::DbWeight::get().writes(3_u64))
+ .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c as Weight)))
+ }
+ // Storage: UnetConf MaxCommissionRewardRate (r:1 w:0)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetOrder Offers (r:0 w:1)
+ fn submit_offer(c: u32, ) -> Weight {
+ 16_481_000_u64 // Standard Error: 54_000
+ .saturating_add((5_410_000_u64).saturating_mul(c as Weight))
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c as Weight)))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ }
+ // Storage: UnetOrder Orders (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf PlatformFeeRate (r:1 w:0)
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn take_order() -> Weight {
+ 112_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(8_u64))
+ .saturating_add(T::DbWeight::get().writes(6_u64))
+ }
+ // Storage: UnetOrder Offers (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf PlatformFeeRate (r:1 w:0)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn take_offer() -> Weight {
+ 109_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(8_u64))
+ .saturating_add(T::DbWeight::get().writes(6_u64))
+ }
+ // Storage: UnetOrder Orders (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ fn remove_order() -> Weight {
+ 35_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(3_u64))
+ .saturating_add(T::DbWeight::get().writes(3_u64))
+ }
+ // Storage: UnetOrder Offers (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ fn remove_offer() -> Weight {
+ 29_000_000_u64
+ .saturating_add(T::DbWeight::get().reads(2_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ }
+}
+
+// For backwards compatibility and tests
+impl WeightInfo for () {
+ // Storage: UnetConf MaxCommissionRewardRate (r:1 w:0)
+ // Storage: UnetConf MinOrderDeposit (r:1 w:0)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetOrder Orders (r:0 w:1)
+ fn submit_order(c: u32, ) -> Weight {
+ 17_587_000_u64 // Standard Error: 81_000
+ .saturating_add((10_585_000_u64).saturating_mul(c as Weight))
+ .saturating_add(RocksDbWeight::get().reads(4_u64))
+ .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(c as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(3_u64))
+ .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c as Weight)))
+ }
+ // Storage: UnetConf MaxCommissionRewardRate (r:1 w:0)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf NextId (r:1 w:1)
+ // Storage: UnetOrder Offers (r:0 w:1)
+ fn submit_offer(c: u32, ) -> Weight {
+ 16_481_000_u64 // Standard Error: 54_000
+ .saturating_add((5_410_000_u64).saturating_mul(c as Weight))
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c as Weight)))
+ .saturating_add(RocksDbWeight::get().writes(2_u64))
+ }
+ // Storage: UnetOrder Orders (r:1 w:1)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf PlatformFeeRate (r:1 w:0)
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn take_order() -> Weight {
+ 112_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(8_u64))
+ .saturating_add(RocksDbWeight::get().writes(6_u64))
+ }
+ // Storage: UnetOrder Offers (r:1 w:1)
+ // Storage: OrmlNFT Tokens (r:1 w:0)
+ // Storage: UnetConf PlatformFeeRate (r:1 w:0)
+ // Storage: System Account (r:2 w:2)
+ // Storage: OrmlNFT Classes (r:1 w:0)
+ // Storage: OrmlNFT TokensByOwner (r:2 w:2)
+ // Storage: OrmlNFT OwnersByToken (r:0 w:1)
+ fn take_offer() -> Weight {
+ 109_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(8_u64))
+ .saturating_add(RocksDbWeight::get().writes(6_u64))
+ }
+ // Storage: UnetOrder Orders (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ // Storage: OrmlNFT TokensByOwner (r:1 w:1)
+ fn remove_order() -> Weight {
+ 35_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(3_u64))
+ .saturating_add(RocksDbWeight::get().writes(3_u64))
+ }
+ // Storage: UnetOrder Offers (r:1 w:1)
+ // Storage: System Account (r:1 w:1)
+ fn remove_offer() -> Weight {
+ 29_000_000_u64
+ .saturating_add(RocksDbWeight::get().reads(2_u64))
+ .saturating_add(RocksDbWeight::get().writes(2_u64))
+ }
+}
diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml
index 25efe98..7632b3d 100644
--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -7,7 +7,7 @@ license = 'Apache-2.0'
name = 'uniqueone-appchain-runtime'
publish = false
repository = 'https://github.com/Unique-One-Official/uniqueone-appchain'
-version = '1.5.7'
+version = '1.5.8'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
@@ -245,4 +245,13 @@ runtime-benchmarks = [
'pallet-society/runtime-benchmarks',
'pallet-utility/runtime-benchmarks',
'pallet-identity/runtime-benchmarks',
+
+ # EVM Pallet
+ 'pallet-ethereum/runtime-benchmarks',
+
+ # Custom Pallets
+ 'unet-auction/runtime-benchmarks',
+ 'unet-nft/runtime-benchmarks',
+ 'unet-config/runtime-benchmarks',
+ 'unet-order/runtime-benchmarks',
]
diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs
index 8e672ba..65750d2 100644
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -157,6 +157,20 @@ pub struct BaseFeeThreshold;
pub struct RuntimeGasWeightMapping;
pub struct EthereumTransactionConverter;
+#[cfg(feature = "runtime-benchmarks")]
+#[macro_use]
+extern crate frame_benchmarking;
+
+#[cfg(feature = "runtime-benchmarks")]
+mod benches {
+ define_benchmarks!(
+ [unet_auction, UnetAuction]
+ [unet_nft, UnetNft]
+ [unet_config, UnetConf]
+ [unet_order, UnetOrder]
+ );
+}
+
/// The type used to represent the kinds of proxying allowed.
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(
@@ -242,7 +256,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
- spec_version: 115,
+ spec_version: 116,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
@@ -1294,6 +1308,7 @@ impl unet_orml_nft::Config for Runtime {
impl unet_config::Config for Runtime {
type Event = Event;
+ type WeightInfo = ();
}
parameter_types! {
@@ -1312,6 +1327,7 @@ impl unet_nft::Config for Runtime {
type ModuleId = NftModuleId;
type Currency = Balances;
type MultiCurrency = Currencies;
+ type WeightInfo = ();
}
impl unet_order::Config for Runtime {
@@ -1323,6 +1339,7 @@ impl unet_order::Config for Runtime {
type NFT = UnetNft;
type ExtraConfig = UnetConf;
type TreasuryPalletId = TreasuryId;
+ type WeightInfo = ();
}
impl unet_auction::Config for Runtime {
@@ -1827,13 +1844,16 @@ impl_runtime_apis! {
use frame_benchmarking::baseline::Pallet as BaselineBench;
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
+ use unet_auction::Pallet as UnetAuctionBench;
let mut list = Vec::::new();
- list_benchmark!(list, extra, frame_benchmarking, BaselineBench::);
- list_benchmark!(list, extra, frame_system, SystemBench::);
- list_benchmark!(list, extra, pallet_balances, Balances);
- list_benchmark!(list, extra, pallet_timestamp, Timestamp);
+ // list_benchmark!(list, extra, frame_benchmarking, BaselineBench::);
+ // list_benchmark!(list, extra, frame_system, SystemBench::