Allow to set the max supply for collection (#11441)

* Allow to set the max supply for collection

* Update error

* Add weights info

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Update frame/uniques/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Jegor Sidorenko
2022-05-18 13:23:44 +02:00
committed by GitHub
parent ce77cb1735
commit 236cc98be2
5 changed files with 199 additions and 63 deletions
@@ -398,5 +398,15 @@ benchmarks_instance_pallet! {
}.into());
}
set_collection_max_supply {
let (collection, caller, _) = create_collection::<T, I>();
}: _(SystemOrigin::Signed(caller.clone()), collection, u32::MAX)
verify {
assert_last_event::<T, I>(Event::CollectionMaxSupplySet {
collection,
max_supply: u32::MAX,
}.into());
}
impl_benchmark_test_suite!(Uniques, crate::mock::new_test_ext(), crate::mock::Test);
}
+4
View File
@@ -142,6 +142,10 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
with_details(collection_details)?;
if let Ok(max_supply) = CollectionMaxSupply::<T, I>::try_get(&collection) {
ensure!(collection_details.items < max_supply, Error::<T, I>::MaxSupplyReached);
}
let items =
collection_details.items.checked_add(1).ok_or(ArithmeticError::Overflow)?;
collection_details.items = items;
+52
View File
@@ -245,6 +245,11 @@ pub mod pallet {
OptionQuery,
>;
#[pallet::storage]
/// Keeps track of the number of items a collection might have.
pub(super) type CollectionMaxSupply<T: Config<I>, I: 'static = ()> =
StorageMap<_, Blake2_128Concat, T::CollectionId, u32, OptionQuery>;
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config<I>, I: 'static = ()> {
@@ -334,6 +339,8 @@ pub mod pallet {
},
/// Ownership acceptance has changed for an account.
OwnershipAcceptanceChanged { who: T::AccountId, maybe_collection: Option<T::CollectionId> },
/// Max supply has been set for a collection.
CollectionMaxSupplySet { collection: T::CollectionId, max_supply: u32 },
}
#[pallet::error]
@@ -362,6 +369,12 @@ pub mod pallet {
Unaccepted,
/// The item is locked.
Locked,
/// All items have been minted.
MaxSupplyReached,
/// The max supply has already been set.
MaxSupplyAlreadySet,
/// The provided max supply is less to the amount of items a collection already has.
MaxSupplyTooSmall,
}
impl<T: Config<I>, I: 'static> Pallet<T, I> {
@@ -1356,5 +1369,44 @@ pub mod pallet {
Self::deposit_event(Event::OwnershipAcceptanceChanged { who, maybe_collection });
Ok(())
}
/// Set the maximum amount of items a collection could have.
///
/// Origin must be either `ForceOrigin` or `Signed` and the sender should be the Owner of
/// the `collection`.
///
/// Note: This function can only succeed once per collection.
///
/// - `collection`: The identifier of the collection to change.
/// - `max_supply`: The maximum amount of items a collection could have.
///
/// Emits `CollectionMaxSupplySet` event when successful.
#[pallet::weight(T::WeightInfo::set_collection_max_supply())]
pub fn set_collection_max_supply(
origin: OriginFor<T>,
collection: T::CollectionId,
max_supply: u32,
) -> DispatchResult {
let maybe_check_owner = T::ForceOrigin::try_origin(origin)
.map(|_| None)
.or_else(|origin| ensure_signed(origin).map(Some))?;
ensure!(
!CollectionMaxSupply::<T, I>::contains_key(&collection),
Error::<T, I>::MaxSupplyAlreadySet
);
let details =
Collection::<T, I>::get(&collection).ok_or(Error::<T, I>::UnknownCollection)?;
if let Some(check_owner) = &maybe_check_owner {
ensure!(check_owner == &details.owner, Error::<T, I>::NoPermission);
}
ensure!(details.items <= max_supply, Error::<T, I>::MaxSupplyTooSmall);
CollectionMaxSupply::<T, I>::insert(&collection, max_supply);
Self::deposit_event(Event::CollectionMaxSupplySet { collection, max_supply });
Ok(())
}
}
}
+55 -2
View File
@@ -17,8 +17,7 @@
//! Tests for Uniques pallet.
use super::*;
use crate::mock::*;
use crate::{mock::*, Event, *};
use frame_support::{assert_noop, assert_ok, traits::Currency};
use pallet_balances::Error as BalancesError;
use sp_std::prelude::*;
@@ -71,6 +70,18 @@ fn attributes(collection: u32) -> Vec<(Option<u32>, Vec<u8>, Vec<u8>)> {
s
}
fn events() -> Vec<Event<Test>> {
let result = System::events()
.into_iter()
.map(|r| r.event)
.filter_map(|e| if let mock::Event::Uniques(inner) = e { Some(inner) } else { None })
.collect::<Vec<_>>();
System::reset_events();
result
}
#[test]
fn basic_setup_works() {
new_test_ext().execute_with(|| {
@@ -633,3 +644,45 @@ fn cancel_approval_works_with_force() {
);
});
}
#[test]
fn max_supply_should_work() {
new_test_ext().execute_with(|| {
let collection_id = 0;
let user_id = 1;
let max_supply = 2;
// validate set_collection_max_supply
assert_ok!(Uniques::force_create(Origin::root(), collection_id, user_id, true));
assert!(!CollectionMaxSupply::<Test>::contains_key(collection_id));
assert_ok!(Uniques::set_collection_max_supply(
Origin::signed(user_id),
collection_id,
max_supply
));
assert_eq!(CollectionMaxSupply::<Test>::get(collection_id).unwrap(), max_supply);
assert!(events().contains(&Event::<Test>::CollectionMaxSupplySet {
collection: collection_id,
max_supply,
}));
assert_noop!(
Uniques::set_collection_max_supply(
Origin::signed(user_id),
collection_id,
max_supply + 1
),
Error::<Test>::MaxSupplyAlreadySet
);
// validate we can't mint more to max supply
assert_ok!(Uniques::mint(Origin::signed(user_id), collection_id, 0, user_id));
assert_ok!(Uniques::mint(Origin::signed(user_id), collection_id, 1, user_id));
assert_noop!(
Uniques::mint(Origin::signed(user_id), collection_id, 2, user_id),
Error::<Test>::MaxSupplyReached
);
});
}
+78 -61
View File
@@ -18,7 +18,7 @@
//! Autogenerated weights for pallet_uniques
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-05-12, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-05-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
@@ -68,6 +68,7 @@ pub trait WeightInfo {
fn approve_transfer() -> Weight;
fn cancel_approval() -> Weight;
fn set_accept_ownership() -> Weight;
fn set_collection_max_supply() -> Weight;
}
/// Weights for pallet_uniques using the Substrate node and recommended hardware.
@@ -76,14 +77,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn create() -> Weight {
(24_319_000 as Weight)
(23_770_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn force_create() -> Weight {
(13_572_000 as Weight)
(13_759_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -96,12 +97,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Account (r:0 w:20)
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 15_000
.saturating_add((9_433_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 15_000
.saturating_add((980_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 15_000
.saturating_add((852_000 as Weight).saturating_mul(a as Weight))
// Standard Error: 16_000
.saturating_add((9_387_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 16_000
.saturating_add((967_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 16_000
.saturating_add((799_000 as Weight).saturating_mul(a as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
@@ -111,17 +112,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
}
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques CollectionMaxSupply (r:1 w:0)
// Storage: Uniques Account (r:0 w:1)
fn mint() -> Weight {
(29_884_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
(31_588_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Account (r:0 w:1)
fn burn() -> Weight {
(31_384_000 as Weight)
(31_125_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -129,7 +131,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Account (r:0 w:2)
fn transfer() -> Weight {
(23_254_000 as Weight)
(22_955_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -137,8 +139,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Asset (r:100 w:100)
fn redeposit(i: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 13_000
.saturating_add((11_718_000 as Weight).saturating_mul(i as Weight))
// Standard Error: 12_000
.saturating_add((11_761_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
@@ -147,26 +149,26 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn freeze() -> Weight {
(17_807_000 as Weight)
(17_808_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn thaw() -> Weight {
(17_904_000 as Weight)
(18_342_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn freeze_collection() -> Weight {
(13_828_000 as Weight)
(13_423_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn thaw_collection() -> Weight {
(13_636_000 as Weight)
(13_453_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -174,20 +176,20 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:2)
fn transfer_ownership() -> Weight {
(20_897_000 as Weight)
(20_745_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn set_team() -> Weight {
(14_340_000 as Weight)
(14_192_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn force_item_status() -> Weight {
(16_355_000 as Weight)
(16_488_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -195,7 +197,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
// Storage: Uniques Attribute (r:1 w:1)
fn set_attribute() -> Weight {
(37_035_000 as Weight)
(37_207_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -203,58 +205,65 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
// Storage: Uniques Attribute (r:1 w:1)
fn clear_attribute() -> Weight {
(34_957_000 as Weight)
(35_432_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
fn set_metadata() -> Weight {
(28_337_000 as Weight)
(28_655_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
fn clear_metadata() -> Weight {
(29_166_000 as Weight)
(28_898_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassMetadataOf (r:1 w:1)
fn set_collection_metadata() -> Weight {
(28_246_000 as Weight)
(27_890_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques ClassMetadataOf (r:1 w:1)
fn clear_collection_metadata() -> Weight {
(26_637_000 as Weight)
(26_538_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
fn approve_transfer() -> Weight {
(18_938_000 as Weight)
(18_961_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
fn cancel_approval() -> Weight {
(18_465_000 as Weight)
(19_116_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
fn set_accept_ownership() -> Weight {
(16_675_000 as Weight)
(17_154_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Uniques CollectionMaxSupply (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn set_collection_max_supply() -> Weight {
(16_060_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
// For backwards compatibility and tests
@@ -262,14 +271,14 @@ impl WeightInfo for () {
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn create() -> Weight {
(24_319_000 as Weight)
(23_770_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn force_create() -> Weight {
(13_572_000 as Weight)
(13_759_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -282,12 +291,12 @@ impl WeightInfo for () {
// Storage: Uniques Account (r:0 w:20)
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 15_000
.saturating_add((9_433_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 15_000
.saturating_add((980_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 15_000
.saturating_add((852_000 as Weight).saturating_mul(a as Weight))
// Standard Error: 16_000
.saturating_add((9_387_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 16_000
.saturating_add((967_000 as Weight).saturating_mul(m as Weight))
// Standard Error: 16_000
.saturating_add((799_000 as Weight).saturating_mul(a as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
@@ -297,17 +306,18 @@ impl WeightInfo for () {
}
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques CollectionMaxSupply (r:1 w:0)
// Storage: Uniques Account (r:0 w:1)
fn mint() -> Weight {
(29_884_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
(31_588_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Account (r:0 w:1)
fn burn() -> Weight {
(31_384_000 as Weight)
(31_125_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -315,7 +325,7 @@ impl WeightInfo for () {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Account (r:0 w:2)
fn transfer() -> Weight {
(23_254_000 as Weight)
(22_955_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -323,8 +333,8 @@ impl WeightInfo for () {
// Storage: Uniques Asset (r:100 w:100)
fn redeposit(i: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 13_000
.saturating_add((11_718_000 as Weight).saturating_mul(i as Weight))
// Standard Error: 12_000
.saturating_add((11_761_000 as Weight).saturating_mul(i as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
@@ -333,26 +343,26 @@ impl WeightInfo for () {
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn freeze() -> Weight {
(17_807_000 as Weight)
(17_808_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Asset (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn thaw() -> Weight {
(17_904_000 as Weight)
(18_342_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn freeze_collection() -> Weight {
(13_828_000 as Weight)
(13_423_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn thaw_collection() -> Weight {
(13_636_000 as Weight)
(13_453_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -360,20 +370,20 @@ impl WeightInfo for () {
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:2)
fn transfer_ownership() -> Weight {
(20_897_000 as Weight)
(20_745_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
fn set_team() -> Weight {
(14_340_000 as Weight)
(14_192_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassAccount (r:0 w:1)
fn force_item_status() -> Weight {
(16_355_000 as Weight)
(16_488_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -381,7 +391,7 @@ impl WeightInfo for () {
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
// Storage: Uniques Attribute (r:1 w:1)
fn set_attribute() -> Weight {
(37_035_000 as Weight)
(37_207_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -389,56 +399,63 @@ impl WeightInfo for () {
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
// Storage: Uniques Attribute (r:1 w:1)
fn clear_attribute() -> Weight {
(34_957_000 as Weight)
(35_432_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
fn set_metadata() -> Weight {
(28_337_000 as Weight)
(28_655_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
fn clear_metadata() -> Weight {
(29_166_000 as Weight)
(28_898_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:1)
// Storage: Uniques ClassMetadataOf (r:1 w:1)
fn set_collection_metadata() -> Weight {
(28_246_000 as Weight)
(27_890_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques ClassMetadataOf (r:1 w:1)
fn clear_collection_metadata() -> Weight {
(26_637_000 as Weight)
(26_538_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
fn approve_transfer() -> Weight {
(18_938_000 as Weight)
(18_961_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques Class (r:1 w:0)
// Storage: Uniques Asset (r:1 w:1)
fn cancel_approval() -> Weight {
(18_465_000 as Weight)
(19_116_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
fn set_accept_ownership() -> Weight {
(16_675_000 as Weight)
(17_154_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Uniques CollectionMaxSupply (r:1 w:1)
// Storage: Uniques Class (r:1 w:0)
fn set_collection_max_supply() -> Weight {
(16_060_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
}