mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
Pallet Indices (#7137)
This commit is contained in:
@@ -320,7 +320,7 @@ impl pallet_indices::Trait for Runtime {
|
||||
type Currency = Balances;
|
||||
type Deposit = IndexDeposit;
|
||||
type Event = Event;
|
||||
type WeightInfo = ();
|
||||
type WeightInfo = weights::pallet_indices::WeightInfo;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -20,6 +20,7 @@ pub mod pallet_balances;
|
||||
pub mod pallet_collective;
|
||||
pub mod pallet_democracy;
|
||||
pub mod pallet_identity;
|
||||
pub mod pallet_indices;
|
||||
pub mod pallet_im_online;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_staking;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2017-2020 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.
|
||||
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
|
||||
|
||||
pub struct WeightInfo;
|
||||
impl pallet_indices::WeightInfo for WeightInfo {
|
||||
fn claim() -> Weight {
|
||||
(56_237_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn transfer() -> Weight {
|
||||
(63_665_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn free() -> Weight {
|
||||
(50_736_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_transfer() -> Weight {
|
||||
(52_361_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn freeze() -> Weight {
|
||||
(46_483_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -32,9 +32,7 @@ benchmarks! {
|
||||
_ { }
|
||||
|
||||
claim {
|
||||
// Index being claimed
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
let account_index = T::AccountIndex::from(SEED);
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
}: _(RawOrigin::Signed(caller.clone()), account_index)
|
||||
@@ -43,13 +41,11 @@ benchmarks! {
|
||||
}
|
||||
|
||||
transfer {
|
||||
// Index being claimed
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
let account_index = T::AccountIndex::from(SEED);
|
||||
// Setup accounts
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
let recipient: T::AccountId = account("recipient", i, SEED);
|
||||
let recipient: T::AccountId = account("recipient", 0, SEED);
|
||||
T::Currency::make_free_balance_be(&recipient, BalanceOf::<T>::max_value());
|
||||
// Claim the index
|
||||
Indices::<T>::claim(RawOrigin::Signed(caller.clone()).into(), account_index)?;
|
||||
@@ -59,9 +55,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
free {
|
||||
// Index being claimed
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
let account_index = T::AccountIndex::from(SEED);
|
||||
// Setup accounts
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
@@ -73,13 +67,11 @@ benchmarks! {
|
||||
}
|
||||
|
||||
force_transfer {
|
||||
// Index being claimed
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
let account_index = T::AccountIndex::from(SEED);
|
||||
// Setup accounts
|
||||
let original: T::AccountId = account("original", 0, SEED);
|
||||
T::Currency::make_free_balance_be(&original, BalanceOf::<T>::max_value());
|
||||
let recipient: T::AccountId = account("recipient", i, SEED);
|
||||
let recipient: T::AccountId = account("recipient", 0, SEED);
|
||||
T::Currency::make_free_balance_be(&recipient, BalanceOf::<T>::max_value());
|
||||
// Claim the index
|
||||
Indices::<T>::claim(RawOrigin::Signed(original).into(), account_index)?;
|
||||
@@ -89,9 +81,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
freeze {
|
||||
// Index being claimed
|
||||
let i in 0 .. 1000;
|
||||
let account_index = T::AccountIndex::from(i);
|
||||
let account_index = T::AccountIndex::from(SEED);
|
||||
// Setup accounts
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2017-2020 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.
|
||||
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
|
||||
|
||||
impl crate::WeightInfo for () {
|
||||
fn claim() -> Weight {
|
||||
(56_237_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn transfer() -> Weight {
|
||||
(63_665_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn free() -> Weight {
|
||||
(50_736_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_transfer() -> Weight {
|
||||
(52_361_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn freeze() -> Weight {
|
||||
(46_483_000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ use sp_runtime::traits::{
|
||||
use frame_support::{Parameter, decl_module, decl_error, decl_event, decl_storage, ensure};
|
||||
use frame_support::dispatch::DispatchResult;
|
||||
use frame_support::traits::{Currency, ReservableCurrency, Get, BalanceStatus::Reserved};
|
||||
use frame_support::weights::{Weight, constants::WEIGHT_PER_MICROS};
|
||||
use frame_support::weights::Weight;
|
||||
use frame_system::{ensure_signed, ensure_root};
|
||||
use self::address::Address as RawAddress;
|
||||
|
||||
@@ -36,24 +36,17 @@ mod mock;
|
||||
pub mod address;
|
||||
mod tests;
|
||||
mod benchmarking;
|
||||
mod default_weights;
|
||||
|
||||
pub type Address<T> = RawAddress<<T as frame_system::Trait>::AccountId, <T as Trait>::AccountIndex>;
|
||||
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn claim(i: u32, ) -> Weight;
|
||||
fn transfer(i: u32, ) -> Weight;
|
||||
fn free(i: u32, ) -> Weight;
|
||||
fn force_transfer(i: u32, ) -> Weight;
|
||||
fn freeze(i: u32, ) -> Weight;
|
||||
}
|
||||
|
||||
impl WeightInfo for () {
|
||||
fn claim(_i: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn transfer(_i: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn free(_i: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn force_transfer(_i: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn freeze(_i: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn claim() -> Weight;
|
||||
fn transfer() -> Weight;
|
||||
fn free() -> Weight;
|
||||
fn force_transfer() -> Weight;
|
||||
fn freeze() -> Weight;
|
||||
}
|
||||
|
||||
/// The module's config trait.
|
||||
@@ -142,10 +135,9 @@ decl_module! {
|
||||
/// - One reserve operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - Base Weight: 28.69 µs
|
||||
/// - DB Weight: 1 Read/Write (Accounts)
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 30 * WEIGHT_PER_MICROS]
|
||||
#[weight = T::WeightInfo::claim()]
|
||||
fn claim(origin, index: T::AccountIndex) {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
@@ -173,12 +165,11 @@ decl_module! {
|
||||
/// - One transfer operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - Base Weight: 33.74 µs
|
||||
/// - DB Weight:
|
||||
/// - Reads: Indices Accounts, System Account (recipient)
|
||||
/// - Writes: Indices Accounts, System Account (recipient)
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(2, 2) + 35 * WEIGHT_PER_MICROS]
|
||||
#[weight = T::WeightInfo::transfer()]
|
||||
fn transfer(origin, new: T::AccountId, index: T::AccountIndex) {
|
||||
let who = ensure_signed(origin)?;
|
||||
ensure!(who != new, Error::<T>::NotTransfer);
|
||||
@@ -210,10 +201,9 @@ decl_module! {
|
||||
/// - One reserve operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - Base Weight: 25.53 µs
|
||||
/// - DB Weight: 1 Read/Write (Accounts)
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 25 * WEIGHT_PER_MICROS]
|
||||
#[weight = T::WeightInfo::free()]
|
||||
fn free(origin, index: T::AccountIndex) {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
@@ -244,12 +234,11 @@ decl_module! {
|
||||
/// - Up to one reserve operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - Base Weight: 26.83 µs
|
||||
/// - DB Weight:
|
||||
/// - Reads: Indices Accounts, System Account (original owner)
|
||||
/// - Writes: Indices Accounts, System Account (original owner)
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(2, 2) + 25 * WEIGHT_PER_MICROS]
|
||||
#[weight = T::WeightInfo::force_transfer()]
|
||||
fn force_transfer(origin, new: T::AccountId, index: T::AccountIndex, freeze: bool) {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -277,10 +266,9 @@ decl_module! {
|
||||
/// - Up to one slash operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - Base Weight: 30.86 µs
|
||||
/// - DB Weight: 1 Read/Write (Accounts)
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 30 * WEIGHT_PER_MICROS]
|
||||
#[weight = T::WeightInfo::freeze()]
|
||||
fn freeze(origin, index: T::AccountIndex) {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user