mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 21:27:57 +00:00
This reverts commit 658b179686.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
committed by
GitHub
parent
9d75f3e3e7
commit
b0ff805740
@@ -42,10 +42,13 @@ fn create_collection<T: Config<I>, I: 'static>(
|
||||
let caller_lookup = T::Lookup::unlookup(caller.clone());
|
||||
let collection = T::Helper::collection(0);
|
||||
T::Currency::make_free_balance_be(&caller, DepositBalanceOf::<T, I>::max_value());
|
||||
assert!(
|
||||
Uniques::<T, I>::force_create(SystemOrigin::Root.into(), caller_lookup.clone(), false,)
|
||||
.is_ok()
|
||||
);
|
||||
assert!(Uniques::<T, I>::force_create(
|
||||
SystemOrigin::Root.into(),
|
||||
collection,
|
||||
caller_lookup.clone(),
|
||||
false,
|
||||
)
|
||||
.is_ok());
|
||||
(collection, caller, caller_lookup)
|
||||
}
|
||||
|
||||
@@ -139,7 +142,7 @@ benchmarks_instance_pallet! {
|
||||
whitelist_account!(caller);
|
||||
let admin = T::Lookup::unlookup(caller.clone());
|
||||
T::Currency::make_free_balance_be(&caller, DepositBalanceOf::<T, I>::max_value());
|
||||
let call = Call::<T, I>::create { admin };
|
||||
let call = Call::<T, I>::create { collection, admin };
|
||||
}: { call.dispatch_bypass_filter(origin)? }
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Created { collection: T::Helper::collection(0), creator: caller.clone(), owner: caller }.into());
|
||||
@@ -148,7 +151,7 @@ benchmarks_instance_pallet! {
|
||||
force_create {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let caller_lookup = T::Lookup::unlookup(caller.clone());
|
||||
}: _(SystemOrigin::Root, caller_lookup, true)
|
||||
}: _(SystemOrigin::Root, T::Helper::collection(0), caller_lookup, true)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::ForceCreated { collection: T::Helper::collection(0), owner: caller }.into());
|
||||
}
|
||||
@@ -404,16 +407,6 @@ benchmarks_instance_pallet! {
|
||||
}.into());
|
||||
}
|
||||
|
||||
try_increment_id {
|
||||
let (_, caller, _) = create_collection::<T, I>();
|
||||
Uniques::<T, I>::set_next_id(0);
|
||||
}: _(SystemOrigin::Signed(caller.clone()))
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::NextCollectionIdIncremented {
|
||||
next_id: 1u32.into()
|
||||
}.into());
|
||||
}
|
||||
|
||||
set_price {
|
||||
let (collection, caller, _) = create_collection::<T, I>();
|
||||
let (item, ..) = mint_item::<T, I>(0);
|
||||
|
||||
@@ -88,12 +88,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
},
|
||||
);
|
||||
|
||||
let next_id = collection.saturating_add(1u32.into());
|
||||
|
||||
CollectionAccount::<T, I>::insert(&owner, &collection, ());
|
||||
NextCollectionId::<T, I>::set(next_id);
|
||||
|
||||
Self::deposit_event(Event::NextCollectionIdIncremented { next_id });
|
||||
Self::deposit_event(event);
|
||||
Ok(())
|
||||
}
|
||||
@@ -213,16 +208,6 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "runtime-benchmarks"))]
|
||||
pub fn set_next_id(count: u32) {
|
||||
NextCollectionId::<T, I>::set(count.into());
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn get_next_id() -> T::CollectionId {
|
||||
NextCollectionId::<T, I>::get()
|
||||
}
|
||||
|
||||
pub fn do_set_price(
|
||||
collection: T::CollectionId,
|
||||
item: T::ItemId,
|
||||
|
||||
@@ -51,7 +51,7 @@ use frame_support::{
|
||||
};
|
||||
use frame_system::Config as SystemConfig;
|
||||
use sp_runtime::{
|
||||
traits::{AtLeast32BitUnsigned, Saturating, StaticLookup, Zero},
|
||||
traits::{Saturating, StaticLookup, Zero},
|
||||
ArithmeticError, RuntimeDebug,
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
@@ -94,12 +94,7 @@ pub mod pallet {
|
||||
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
|
||||
/// Identifier for the collection of item.
|
||||
type CollectionId: Member
|
||||
+ Parameter
|
||||
+ MaxEncodedLen
|
||||
+ Copy
|
||||
+ Default
|
||||
+ AtLeast32BitUnsigned;
|
||||
type CollectionId: Member + Parameter + MaxEncodedLen + Copy;
|
||||
|
||||
/// The type used to identify a unique item within a collection.
|
||||
type ItemId: Member + Parameter + MaxEncodedLen + Copy;
|
||||
@@ -273,12 +268,6 @@ pub mod pallet {
|
||||
pub(super) type CollectionMaxSupply<T: Config<I>, I: 'static = ()> =
|
||||
StorageMap<_, Blake2_128Concat, T::CollectionId, u32, OptionQuery>;
|
||||
|
||||
#[pallet::storage]
|
||||
/// Stores the `CollectionId` that is going to be used for the next collection.
|
||||
/// This gets incremented by 1 whenever a new collection is created.
|
||||
pub(super) type NextCollectionId<T: Config<I>, I: 'static = ()> =
|
||||
StorageValue<_, T::CollectionId, ValueQuery>;
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config<I>, I: 'static = ()> {
|
||||
@@ -370,8 +359,6 @@ pub mod pallet {
|
||||
OwnershipAcceptanceChanged { who: T::AccountId, maybe_collection: Option<T::CollectionId> },
|
||||
/// Max supply has been set for a collection.
|
||||
CollectionMaxSupplySet { collection: T::CollectionId, max_supply: u32 },
|
||||
/// Event gets emmited when the `NextCollectionId` gets incremented.
|
||||
NextCollectionIdIncremented { next_id: T::CollectionId },
|
||||
/// The price was set for the instance.
|
||||
ItemPriceSet {
|
||||
collection: T::CollectionId,
|
||||
@@ -423,10 +410,6 @@ pub mod pallet {
|
||||
MaxSupplyAlreadySet,
|
||||
/// The provided max supply is less to the amount of items a collection already has.
|
||||
MaxSupplyTooSmall,
|
||||
/// The `CollectionId` in `NextCollectionId` is not being used.
|
||||
///
|
||||
/// This means that you can directly proceed to call `create`.
|
||||
NextIdNotUsed,
|
||||
/// The given item ID is unknown.
|
||||
UnknownItem,
|
||||
/// Item is not for sale.
|
||||
@@ -458,6 +441,7 @@ pub mod pallet {
|
||||
/// `ItemDeposit` funds of sender are reserved.
|
||||
///
|
||||
/// Parameters:
|
||||
/// - `collection`: The identifier of the new collection. This must not be currently in use.
|
||||
/// - `admin`: The admin of this collection. The admin is the initial address of each
|
||||
/// member of the collection's admin team.
|
||||
///
|
||||
@@ -465,9 +449,11 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::weight(T::WeightInfo::create())]
|
||||
pub fn create(origin: OriginFor<T>, admin: AccountIdLookupOf<T>) -> DispatchResult {
|
||||
let collection = NextCollectionId::<T, I>::get();
|
||||
|
||||
pub fn create(
|
||||
origin: OriginFor<T>,
|
||||
collection: T::CollectionId,
|
||||
admin: AccountIdLookupOf<T>,
|
||||
) -> DispatchResult {
|
||||
let owner = T::CreateOrigin::ensure_origin(origin, &collection)?;
|
||||
let admin = T::Lookup::lookup(admin)?;
|
||||
|
||||
@@ -489,6 +475,7 @@ pub mod pallet {
|
||||
///
|
||||
/// Unlike `create`, no funds are reserved.
|
||||
///
|
||||
/// - `collection`: The identifier of the new item. This must not be currently in use.
|
||||
/// - `owner`: The owner of this collection of items. The owner has full superuser
|
||||
/// permissions
|
||||
/// over this item, but may later change and configure the permissions using
|
||||
@@ -500,14 +487,13 @@ pub mod pallet {
|
||||
#[pallet::weight(T::WeightInfo::force_create())]
|
||||
pub fn force_create(
|
||||
origin: OriginFor<T>,
|
||||
collection: T::CollectionId,
|
||||
owner: AccountIdLookupOf<T>,
|
||||
free_holding: bool,
|
||||
) -> DispatchResult {
|
||||
T::ForceOrigin::ensure_origin(origin)?;
|
||||
let owner = T::Lookup::lookup(owner)?;
|
||||
|
||||
let collection = NextCollectionId::<T, I>::get();
|
||||
|
||||
Self::do_create_collection(
|
||||
collection,
|
||||
owner.clone(),
|
||||
@@ -518,31 +504,6 @@ pub mod pallet {
|
||||
)
|
||||
}
|
||||
|
||||
/// Increments the `CollectionId` stored in `NextCollectionId`.
|
||||
///
|
||||
/// This is only callable when the next `CollectionId` is already being
|
||||
/// used for some other collection.
|
||||
///
|
||||
/// The origin must be Signed and the sender must have sufficient funds
|
||||
/// free.
|
||||
///
|
||||
/// Emits `NextCollectionIdIncremented` event when successful.
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::weight(T::WeightInfo::try_increment_id())]
|
||||
pub fn try_increment_id(origin: OriginFor<T>) -> DispatchResult {
|
||||
ensure_signed(origin)?;
|
||||
ensure!(
|
||||
Collection::<T, I>::contains_key(NextCollectionId::<T, I>::get()),
|
||||
Error::<T, I>::NextIdNotUsed
|
||||
);
|
||||
|
||||
let next_id = NextCollectionId::<T, I>::get().saturating_add(1u32.into());
|
||||
NextCollectionId::<T, I>::set(next_id);
|
||||
Self::deposit_event(Event::NextCollectionIdIncremented { next_id });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Destroy a collection of fungible items.
|
||||
///
|
||||
/// The origin must conform to `ForceOrigin` or must be `Signed` and the sender must be the
|
||||
|
||||
@@ -92,12 +92,12 @@ fn basic_setup_works() {
|
||||
#[test]
|
||||
fn basic_minting_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_eq!(collections(), vec![(1, 0)]);
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 1));
|
||||
assert_eq!(items(), vec![(1, 0, 42)]);
|
||||
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 2, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, 2, true));
|
||||
assert_eq!(collections(), vec![(1, 0), (2, 1)]);
|
||||
assert_ok!(Uniques::mint(Origin::signed(2), 1, 69, 1));
|
||||
assert_eq!(items(), vec![(1, 0, 42), (1, 1, 69)]);
|
||||
@@ -108,7 +108,7 @@ fn basic_minting_should_work() {
|
||||
fn lifecycle_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
Balances::make_free_balance_be(&1, 100);
|
||||
assert_ok!(Uniques::create(Origin::signed(1), 1));
|
||||
assert_ok!(Uniques::create(Origin::signed(1), 0, 1));
|
||||
assert_eq!(Balances::reserved_balance(&1), 2);
|
||||
assert_eq!(collections(), vec![(1, 0)]);
|
||||
assert_ok!(Uniques::set_collection_metadata(Origin::signed(1), 0, bvec![0, 0], false));
|
||||
@@ -151,7 +151,7 @@ fn lifecycle_should_work() {
|
||||
fn destroy_with_bad_witness_should_not_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
Balances::make_free_balance_be(&1, 100);
|
||||
assert_ok!(Uniques::create(Origin::signed(1), 1));
|
||||
assert_ok!(Uniques::create(Origin::signed(1), 0, 1));
|
||||
|
||||
let w = Collection::<Test>::get(0).unwrap().destroy_witness();
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 1));
|
||||
@@ -162,7 +162,7 @@ fn destroy_with_bad_witness_should_not_work() {
|
||||
#[test]
|
||||
fn mint_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 1));
|
||||
assert_eq!(Uniques::owner(0, 42).unwrap(), 1);
|
||||
assert_eq!(collections(), vec![(1, 0)]);
|
||||
@@ -173,7 +173,7 @@ fn mint_should_work() {
|
||||
#[test]
|
||||
fn transfer_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 2));
|
||||
|
||||
assert_ok!(Uniques::transfer(Origin::signed(2), 0, 42, 3));
|
||||
@@ -188,7 +188,7 @@ fn transfer_should_work() {
|
||||
#[test]
|
||||
fn freezing_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 1));
|
||||
assert_ok!(Uniques::freeze(Origin::signed(1), 0, 42));
|
||||
assert_noop!(Uniques::transfer(Origin::signed(1), 0, 42, 2), Error::<Test>::Frozen);
|
||||
@@ -205,7 +205,7 @@ fn freezing_should_work() {
|
||||
#[test]
|
||||
fn origin_guards_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 1));
|
||||
|
||||
Balances::make_free_balance_be(&2, 100);
|
||||
@@ -230,7 +230,7 @@ fn transfer_owner_should_work() {
|
||||
Balances::make_free_balance_be(&1, 100);
|
||||
Balances::make_free_balance_be(&2, 100);
|
||||
Balances::make_free_balance_be(&3, 100);
|
||||
assert_ok!(Uniques::create(Origin::signed(1), 1));
|
||||
assert_ok!(Uniques::create(Origin::signed(1), 0, 1));
|
||||
assert_eq!(collections(), vec![(1, 0)]);
|
||||
assert_noop!(
|
||||
Uniques::transfer_ownership(Origin::signed(1), 0, 2),
|
||||
@@ -275,7 +275,7 @@ fn transfer_owner_should_work() {
|
||||
#[test]
|
||||
fn set_team_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::set_team(Origin::signed(1), 0, 2, 3, 4));
|
||||
|
||||
assert_ok!(Uniques::mint(Origin::signed(2), 0, 42, 2));
|
||||
@@ -294,7 +294,7 @@ fn set_collection_metadata_should_work() {
|
||||
Uniques::set_collection_metadata(Origin::signed(1), 0, bvec![0u8; 20], false),
|
||||
Error::<Test>::UnknownCollection,
|
||||
);
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, false));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, false));
|
||||
// Cannot add metadata to unowned item
|
||||
assert_noop!(
|
||||
Uniques::set_collection_metadata(Origin::signed(2), 0, bvec![0u8; 20], false),
|
||||
@@ -354,7 +354,7 @@ fn set_item_metadata_should_work() {
|
||||
Balances::make_free_balance_be(&1, 30);
|
||||
|
||||
// Cannot add metadata to unknown item
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, false));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, false));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 1));
|
||||
// Cannot add metadata to unowned item
|
||||
assert_noop!(
|
||||
@@ -410,7 +410,7 @@ fn set_attribute_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
Balances::make_free_balance_be(&1, 100);
|
||||
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, false));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, false));
|
||||
|
||||
assert_ok!(Uniques::set_attribute(Origin::signed(1), 0, None, bvec![0], bvec![0]));
|
||||
assert_ok!(Uniques::set_attribute(Origin::signed(1), 0, Some(0), bvec![0], bvec![0]));
|
||||
@@ -455,7 +455,7 @@ fn set_attribute_should_respect_freeze() {
|
||||
new_test_ext().execute_with(|| {
|
||||
Balances::make_free_balance_be(&1, 100);
|
||||
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, false));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, false));
|
||||
|
||||
assert_ok!(Uniques::set_attribute(Origin::signed(1), 0, None, bvec![0], bvec![0]));
|
||||
assert_ok!(Uniques::set_attribute(Origin::signed(1), 0, Some(0), bvec![0], bvec![0]));
|
||||
@@ -487,7 +487,7 @@ fn force_item_status_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
Balances::make_free_balance_be(&1, 100);
|
||||
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, false));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, false));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 1));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 69, 2));
|
||||
assert_ok!(Uniques::set_collection_metadata(Origin::signed(1), 0, bvec![0; 20], false));
|
||||
@@ -521,7 +521,7 @@ fn force_item_status_should_work() {
|
||||
fn burn_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
Balances::make_free_balance_be(&1, 100);
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, false));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, false));
|
||||
assert_ok!(Uniques::set_team(Origin::signed(1), 0, 2, 3, 4));
|
||||
|
||||
assert_noop!(
|
||||
@@ -545,7 +545,7 @@ fn burn_works() {
|
||||
#[test]
|
||||
fn approval_lifecycle_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 2));
|
||||
assert_ok!(Uniques::approve_transfer(Origin::signed(2), 0, 42, 3));
|
||||
assert_ok!(Uniques::transfer(Origin::signed(3), 0, 42, 4));
|
||||
@@ -560,7 +560,7 @@ fn approval_lifecycle_works() {
|
||||
#[test]
|
||||
fn cancel_approval_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 2));
|
||||
|
||||
assert_ok!(Uniques::approve_transfer(Origin::signed(2), 0, 42, 3));
|
||||
@@ -592,7 +592,7 @@ fn cancel_approval_works() {
|
||||
#[test]
|
||||
fn cancel_approval_works_with_admin() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 2));
|
||||
|
||||
assert_ok!(Uniques::approve_transfer(Origin::signed(2), 0, 42, 3));
|
||||
@@ -620,7 +620,7 @@ fn cancel_approval_works_with_admin() {
|
||||
#[test]
|
||||
fn cancel_approval_works_with_force() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 0, 1, true));
|
||||
assert_ok!(Uniques::mint(Origin::signed(1), 0, 42, 2));
|
||||
|
||||
assert_ok!(Uniques::approve_transfer(Origin::signed(2), 0, 42, 3));
|
||||
@@ -653,7 +653,7 @@ fn max_supply_should_work() {
|
||||
let max_supply = 2;
|
||||
|
||||
// validate set_collection_max_supply
|
||||
assert_ok!(Uniques::force_create(Origin::root(), user_id, true));
|
||||
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(
|
||||
@@ -695,48 +695,15 @@ fn max_supply_should_work() {
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn try_increment_id_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// should fail because the next `CollectionId` is not being used.
|
||||
assert_noop!(Uniques::try_increment_id(Origin::signed(2)), Error::<Test>::NextIdNotUsed);
|
||||
|
||||
// create two collections & check for events.
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert!(events().contains(&Event::<Test>::NextCollectionIdIncremented { next_id: 1 }));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), 1, true));
|
||||
assert!(events().contains(&Event::<Test>::NextCollectionIdIncremented { next_id: 2 }));
|
||||
|
||||
// there are now two collections.
|
||||
assert_eq!(Uniques::get_next_id(), 2);
|
||||
|
||||
// reset the collections counter to test if the `try_increment_id`
|
||||
// works.
|
||||
Uniques::set_next_id(0);
|
||||
assert_ok!(Uniques::try_increment_id(Origin::signed(2)));
|
||||
|
||||
// `try_increment_id` should emit an event when successful.
|
||||
assert!(events().contains(&Event::<Test>::NextCollectionIdIncremented { next_id: 1 }));
|
||||
|
||||
// because reset, the collections count should be now 1
|
||||
assert_eq!(Uniques::get_next_id(), 1);
|
||||
|
||||
// increment the collections count again.
|
||||
assert_ok!(Uniques::try_increment_id(Origin::signed(2)));
|
||||
// should fail because the next `CollectionId` is not being used.
|
||||
assert_noop!(Uniques::try_increment_id(Origin::signed(2)), Error::<Test>::NextIdNotUsed);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_price_should_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let user_id = 1;
|
||||
let collection_id: u32 = 0;
|
||||
let collection_id = 0;
|
||||
let item_1 = 1;
|
||||
let item_2 = 2;
|
||||
|
||||
assert_ok!(Uniques::force_create(Origin::root(), user_id, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), collection_id, user_id, true));
|
||||
|
||||
assert_ok!(Uniques::mint(Origin::signed(user_id), collection_id, item_1, user_id));
|
||||
assert_ok!(Uniques::mint(Origin::signed(user_id), collection_id, item_2, user_id));
|
||||
@@ -788,7 +755,7 @@ fn buy_item_should_work() {
|
||||
let user_1 = 1;
|
||||
let user_2 = 2;
|
||||
let user_3 = 3;
|
||||
let collection_id: u32 = 0;
|
||||
let collection_id = 0;
|
||||
let item_1 = 1;
|
||||
let item_2 = 2;
|
||||
let item_3 = 3;
|
||||
@@ -800,7 +767,7 @@ fn buy_item_should_work() {
|
||||
Balances::make_free_balance_be(&user_2, initial_balance);
|
||||
Balances::make_free_balance_be(&user_3, initial_balance);
|
||||
|
||||
assert_ok!(Uniques::force_create(Origin::root(), user_1, true));
|
||||
assert_ok!(Uniques::force_create(Origin::root(), collection_id, user_1, true));
|
||||
|
||||
assert_ok!(Uniques::mint(Origin::signed(user_1), collection_id, item_1, user_1));
|
||||
assert_ok!(Uniques::mint(Origin::signed(user_1), collection_id, item_2, user_1));
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
//! Autogenerated weights for pallet_uniques
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-07-15, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! DATE: 2022-07-13, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `test-bench-bot`, CPU: `Intel(R) Xeon(R) CPU @ 3.10GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// /home/benchbot/cargo_target_dir/production/substrate
|
||||
// target/production/substrate
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
@@ -70,7 +70,6 @@ pub trait WeightInfo {
|
||||
fn cancel_approval() -> Weight;
|
||||
fn set_accept_ownership() -> Weight;
|
||||
fn set_collection_max_supply() -> Weight;
|
||||
fn try_increment_id() -> Weight;
|
||||
fn set_price() -> Weight;
|
||||
fn buy_item() -> Weight;
|
||||
}
|
||||
@@ -78,21 +77,19 @@ pub trait WeightInfo {
|
||||
/// Weights for pallet_uniques using the Substrate node and recommended hardware.
|
||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn create() -> Weight {
|
||||
(30_481_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
(33_075_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn force_create() -> Weight {
|
||||
(19_811_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
(19_528_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 Asset (r:1 w:0)
|
||||
@@ -107,12 +104,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `a` is `[0, 1000]`.
|
||||
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((10_950_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((1_657_000 as Weight).saturating_mul(m as Weight))
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((1_512_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 25_000
|
||||
.saturating_add((13_639_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 25_000
|
||||
.saturating_add((2_393_000 as Weight).saturating_mul(m as Weight))
|
||||
// Standard Error: 25_000
|
||||
.saturating_add((2_217_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(4 as Weight))
|
||||
@@ -125,7 +122,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Uniques CollectionMaxSupply (r:1 w:0)
|
||||
// Storage: Uniques Account (r:0 w:1)
|
||||
fn mint() -> Weight {
|
||||
(36_980_000 as Weight)
|
||||
(42_146_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
@@ -134,7 +131,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Uniques Account (r:0 w:1)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn burn() -> Weight {
|
||||
(38_771_000 as Weight)
|
||||
(42_960_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
@@ -143,7 +140,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Uniques Account (r:0 w:2)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(29_914_000 as Weight)
|
||||
(33_025_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
@@ -152,8 +149,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// The range of component `i` is `[0, 5000]`.
|
||||
fn redeposit(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 16_000
|
||||
.saturating_add((12_759_000 as Weight).saturating_mul(i as Weight))
|
||||
// Standard Error: 24_000
|
||||
.saturating_add((15_540_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))
|
||||
@@ -162,26 +159,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 {
|
||||
(22_425_000 as Weight)
|
||||
(25_194_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 {
|
||||
(23_011_000 as Weight)
|
||||
(25_397_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 {
|
||||
(17_718_000 as Weight)
|
||||
(19_278_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 {
|
||||
(17_619_000 as Weight)
|
||||
(19_304_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
@@ -189,20 +186,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 {
|
||||
(25_869_000 as Weight)
|
||||
(28_615_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 {
|
||||
(18_058_000 as Weight)
|
||||
(19_943_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 {
|
||||
(20_720_000 as Weight)
|
||||
(22_583_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
@@ -210,7 +207,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 {
|
||||
(41_808_000 as Weight)
|
||||
(47_520_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
@@ -218,76 +215,69 @@ 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 {
|
||||
(39_866_000 as Weight)
|
||||
(45_316_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 {
|
||||
(34_767_000 as Weight)
|
||||
(38_391_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 {
|
||||
(33_910_000 as Weight)
|
||||
(38_023_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 {
|
||||
(33_827_000 as Weight)
|
||||
(37_398_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 {
|
||||
(31_998_000 as Weight)
|
||||
(35_621_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 {
|
||||
(23_607_000 as Weight)
|
||||
(25_856_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 {
|
||||
(23_341_000 as Weight)
|
||||
(26_098_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 {
|
||||
(21_969_000 as Weight)
|
||||
(24_076_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 {
|
||||
(20_355_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn try_increment_id() -> Weight {
|
||||
(19_233_000 as Weight)
|
||||
(22_035_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:0)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn set_price() -> Weight {
|
||||
(20_733_000 as Weight)
|
||||
(22_534_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
@@ -296,7 +286,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Account (r:0 w:2)
|
||||
fn buy_item() -> Weight {
|
||||
(40_798_000 as Weight)
|
||||
(45_272_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
@@ -304,21 +294,19 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
|
||||
// For backwards compatibility and tests
|
||||
impl WeightInfo for () {
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn create() -> Weight {
|
||||
(30_481_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||
(33_075_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn force_create() -> Weight {
|
||||
(19_811_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||
(19_528_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 Asset (r:1 w:0)
|
||||
@@ -333,12 +321,12 @@ impl WeightInfo for () {
|
||||
/// The range of component `a` is `[0, 1000]`.
|
||||
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((10_950_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((1_657_000 as Weight).saturating_mul(m as Weight))
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((1_512_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 25_000
|
||||
.saturating_add((13_639_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 25_000
|
||||
.saturating_add((2_393_000 as Weight).saturating_mul(m as Weight))
|
||||
// Standard Error: 25_000
|
||||
.saturating_add((2_217_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(4 as Weight))
|
||||
@@ -351,7 +339,7 @@ impl WeightInfo for () {
|
||||
// Storage: Uniques CollectionMaxSupply (r:1 w:0)
|
||||
// Storage: Uniques Account (r:0 w:1)
|
||||
fn mint() -> Weight {
|
||||
(36_980_000 as Weight)
|
||||
(42_146_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
@@ -360,7 +348,7 @@ impl WeightInfo for () {
|
||||
// Storage: Uniques Account (r:0 w:1)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn burn() -> Weight {
|
||||
(38_771_000 as Weight)
|
||||
(42_960_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
@@ -369,7 +357,7 @@ impl WeightInfo for () {
|
||||
// Storage: Uniques Account (r:0 w:2)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(29_914_000 as Weight)
|
||||
(33_025_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
@@ -378,8 +366,8 @@ impl WeightInfo for () {
|
||||
/// The range of component `i` is `[0, 5000]`.
|
||||
fn redeposit(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 16_000
|
||||
.saturating_add((12_759_000 as Weight).saturating_mul(i as Weight))
|
||||
// Standard Error: 24_000
|
||||
.saturating_add((15_540_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))
|
||||
@@ -388,26 +376,26 @@ impl WeightInfo for () {
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn freeze() -> Weight {
|
||||
(22_425_000 as Weight)
|
||||
(25_194_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 {
|
||||
(23_011_000 as Weight)
|
||||
(25_397_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 {
|
||||
(17_718_000 as Weight)
|
||||
(19_278_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 {
|
||||
(17_619_000 as Weight)
|
||||
(19_304_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
@@ -415,20 +403,20 @@ impl WeightInfo for () {
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:2)
|
||||
fn transfer_ownership() -> Weight {
|
||||
(25_869_000 as Weight)
|
||||
(28_615_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 {
|
||||
(18_058_000 as Weight)
|
||||
(19_943_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 {
|
||||
(20_720_000 as Weight)
|
||||
(22_583_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
@@ -436,7 +424,7 @@ impl WeightInfo for () {
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
|
||||
// Storage: Uniques Attribute (r:1 w:1)
|
||||
fn set_attribute() -> Weight {
|
||||
(41_808_000 as Weight)
|
||||
(47_520_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
@@ -444,76 +432,69 @@ impl WeightInfo for () {
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
|
||||
// Storage: Uniques Attribute (r:1 w:1)
|
||||
fn clear_attribute() -> Weight {
|
||||
(39_866_000 as Weight)
|
||||
(45_316_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 {
|
||||
(34_767_000 as Weight)
|
||||
(38_391_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 {
|
||||
(33_910_000 as Weight)
|
||||
(38_023_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 {
|
||||
(33_827_000 as Weight)
|
||||
(37_398_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 {
|
||||
(31_998_000 as Weight)
|
||||
(35_621_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 {
|
||||
(23_607_000 as Weight)
|
||||
(25_856_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 {
|
||||
(23_341_000 as Weight)
|
||||
(26_098_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 {
|
||||
(21_969_000 as Weight)
|
||||
(24_076_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 {
|
||||
(20_355_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn try_increment_id() -> Weight {
|
||||
(19_233_000 as Weight)
|
||||
(22_035_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:0)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn set_price() -> Weight {
|
||||
(20_733_000 as Weight)
|
||||
(22_534_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
@@ -522,7 +503,7 @@ impl WeightInfo for () {
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Account (r:0 w:2)
|
||||
fn buy_item() -> Weight {
|
||||
(40_798_000 as Weight)
|
||||
(45_272_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user