feat: Rebrand Polkadot/Substrate references to PezkuwiChain

This commit systematically rebrands various references from Parity Technologies'
Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk.

Key changes include:
- Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks.
- Modified internal documentation and code comments to reflect PezkuwiChain naming and structure.
- Replaced direct references to  with  or specific paths within the  for XCM, Pezkuwi, and other modules.
- Cleaned up deprecated  issue and PR references in various  and  files, particularly in  and  modules.
- Adjusted image and logo URLs in documentation to point to PezkuwiChain assets.
- Removed or rephrased comments related to external Polkadot/Substrate PRs and issues.

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
2025-12-14 00:04:10 +03:00
parent 286de54384
commit 1c0e57d984
9084 changed files with 997839 additions and 997557 deletions
+55
View File
@@ -0,0 +1,55 @@
[package]
name = "pezpallet-uniques"
version = "28.0.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
homepage.workspace = true
repository.workspace = true
description = "FRAME NFT asset management pallet"
readme = "README.md"
[lints]
workspace = true
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { workspace = true }
pezframe-benchmarking = { optional = true, workspace = true }
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
log = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
pezsp-runtime = { workspace = true }
[dev-dependencies]
pezpallet-balances = { workspace = true, default-features = true }
pezsp-io = { workspace = true, default-features = true }
[features]
default = ["std"]
std = [
"codec/std",
"pezframe-benchmarking?/std",
"pezframe-support/std",
"pezframe-system/std",
"log/std",
"scale-info/std",
"pezsp-runtime/std",
]
runtime-benchmarks = [
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezpallet-balances/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
]
try-runtime = [
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezpallet-balances/try-runtime",
"pezsp-runtime/try-runtime",
]
+82
View File
@@ -0,0 +1,82 @@
# Uniques Module
A simple, secure module for dealing with non-fungible assets.
## Overview
The Uniques module provides functionality for non-fungible tokens' management, including:
* Collection Creation
* Item Minting
* Item Transfers
* Item Trading methods
* Attributes Management
* Item Burning
To use it in your runtime, you need to implement
[`uniques::Config`](https://docs.pezkuwichain.io/bizinikiwi/master/pallet_uniques/pallet/trait.Config.html).
The supported dispatchable functions are documented in the
[`uniques::Call`](https://docs.pezkuwichain.io/bizinikiwi/master/pallet_uniques/pallet/enum.Call.html) enum.
### Terminology
* **Collection creation:** The creation of a new collection.
* **Item minting:** The action of creating a new item within a collection.
* **Item transfer:** The action of sending an item from one account to another.
* **Item burning:** The destruction of an item.
* **Non-fungible token (NFT):** An item for which each unit has unique characteristics. There is exactly one instance of
such an item in existence and there is exactly one owning account.
### Goals
The Uniques pallet in Bizinikiwi is designed to make the following possible:
* Allow accounts to permissionlessly create NFT collections.
* Allow a named (permissioned) account to mint and burn unique items within a collection.
* Move items between accounts permissionlessly.
* Allow a named (permissioned) account to freeze and unfreeze unique items within a collection or the entire collection.
* Allow the owner of an item to delegate the ability to transfer the item to some named third-party.
## Interface
### Permissionless dispatchables
* `create`: Create a new collection by placing a deposit.
* `transfer`: Transfer an item to a new owner.
* `redeposit`: Update the deposit amount of an item, potentially freeing funds.
* `approve_transfer`: Name a delegate who may authorise a transfer.
* `cancel_approval`: Revert the effects of a previous `approve_transfer`.
### Permissioned dispatchables
* `destroy`: Destroy a collection.
* `mint`: Mint a new item within a collection.
* `burn`: Burn an item within a collection.
* `freeze`: Prevent an individual item from being transferred.
* `thaw`: Revert the effects of a previous `freeze`.
* `freeze_collection`: Prevent all items within a collection from being transferred.
* `thaw_collection`: Revert the effects of a previous `freeze_collection`.
* `transfer_ownership`: Alter the owner of a collection, moving all associated deposits.
* `set_team`: Alter the permissioned accounts of a collection.
### Metadata (permissioned) dispatchables
* `set_attribute`: Set an attribute of an item or collection.
* `clear_attribute`: Remove an attribute of an item or collection.
* `set_metadata`: Set general metadata of an item.
* `clear_metadata`: Remove general metadata of an item.
* `set_collection_metadata`: Set general metadata of a collection.
* `clear_collection_metadata`: Remove general metadata of a collection.
### Force (i.e. governance) dispatchables
* `force_create`: Create a new collection.
* `force_asset_status`: Alter the underlying characteristics of a collection.
Please refer to the [`Call`](https://docs.pezkuwichain.io/bizinikiwi/master/pallet_uniques/pallet/enum.Call.html) enum
and its associated variants for documentation on each function.
## Related Modules
* [`System`](https://docs.rs/pezframe-system/latest/frame_system/)
* [`Support`](https://docs.rs/pezframe-support/latest/frame_support/)
* [`Assets`](https://docs.rs/pezpallet-assets/latest/pallet_assets/)
License: Apache-2.0
@@ -0,0 +1,166 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
use core::marker::PhantomData;
use crate::{
asset_strategies::{Attribute, WithCollectionConfig},
Collection as CollectionStorage, *,
};
use pezframe_support::{
ensure,
traits::{
tokens::asset_ops::{
common_strategies::{
Bytes, CheckOrigin, CheckState, ConfigValue, IfOwnedBy, Owner, WithConfig,
WithWitness,
},
AssetDefinition, Create, Destroy, Inspect,
},
EnsureOrigin, Get,
},
BoundedSlice,
};
use pezframe_system::ensure_signed;
use pezsp_runtime::{DispatchError, DispatchResult};
pub struct Collection<PalletInstance>(PhantomData<PalletInstance>);
impl<T: Config<I>, I: 'static> AssetDefinition for Collection<Pallet<T, I>> {
type Id = T::CollectionId;
}
impl<T: Config<I>, I: 'static> Inspect<Owner<T::AccountId>> for Collection<Pallet<T, I>> {
fn inspect(
collection: &Self::Id,
_ownership: Owner<T::AccountId>,
) -> Result<T::AccountId, DispatchError> {
CollectionStorage::<T, I>::get(collection)
.map(|a| a.owner)
.ok_or(Error::<T, I>::UnknownCollection.into())
}
}
impl<T: Config<I>, I: 'static> Inspect<Bytes> for Collection<Pallet<T, I>> {
fn inspect(collection: &Self::Id, _bytes: Bytes) -> Result<Vec<u8>, DispatchError> {
CollectionMetadataOf::<T, I>::get(collection)
.map(|m| m.data.into())
.ok_or(Error::<T, I>::NoMetadata.into())
}
}
impl<'a, T: Config<I>, I: 'static> Inspect<Bytes<Attribute<'a>>> for Collection<Pallet<T, I>> {
fn inspect(
collection: &Self::Id,
strategy: Bytes<Attribute>,
) -> Result<Vec<u8>, DispatchError> {
let Bytes(Attribute(attribute)) = strategy;
let attribute =
BoundedSlice::try_from(attribute).map_err(|_| Error::<T, I>::WrongAttribute)?;
crate::Attribute::<T, I>::get((collection, Option::<T::ItemId>::None, attribute))
.map(|a| a.0.into())
.ok_or(Error::<T, I>::AttributeNotFound.into())
}
}
impl<T: Config<I>, I: 'static> Create<WithCollectionConfig<T, I>> for Collection<Pallet<T, I>> {
fn create(strategy: WithCollectionConfig<T, I>) -> Result<T::CollectionId, DispatchError> {
let WithConfig { config, extra: id_assignment } = strategy;
let collection = id_assignment.params;
let (ConfigValue(owner), ConfigValue(admin)) = config;
<Pallet<T, I>>::do_create_collection(
collection.clone(),
owner.clone(),
admin.clone(),
T::CollectionDeposit::get(),
false,
Event::Created { collection: collection.clone(), creator: owner, owner: admin },
)?;
Ok(collection)
}
}
impl<T: Config<I>, I: 'static> Create<CheckOrigin<T::RuntimeOrigin, WithCollectionConfig<T, I>>>
for Collection<Pallet<T, I>>
{
fn create(
strategy: CheckOrigin<T::RuntimeOrigin, WithCollectionConfig<T, I>>,
) -> Result<T::CollectionId, DispatchError> {
let CheckOrigin(origin, creation) = strategy;
let WithConfig { config, extra: id_assignment } = &creation;
let collection = &id_assignment.params;
let (ConfigValue(owner), ..) = config;
let maybe_check_signer =
T::ForceOrigin::try_origin(origin).map(|_| None).or_else(|origin| {
T::CreateOrigin::ensure_origin(origin, collection)
.map(Some)
.map_err(DispatchError::from)
})?;
if let Some(signer) = maybe_check_signer {
ensure!(signer == *owner, Error::<T, I>::NoPermission);
}
Self::create(creation)
}
}
impl<T: Config<I>, I: 'static> Destroy<WithWitness<DestroyWitness>> for Collection<Pallet<T, I>> {
fn destroy(collection: &Self::Id, strategy: WithWitness<DestroyWitness>) -> DispatchResult {
let CheckState(witness, _) = strategy;
<Pallet<T, I>>::do_destroy_collection(collection.clone(), witness, None).map(|_witness| ())
}
}
impl<T: Config<I>, I: 'static> Destroy<IfOwnedBy<T::AccountId, WithWitness<DestroyWitness>>>
for Collection<Pallet<T, I>>
{
fn destroy(
collection: &Self::Id,
strategy: IfOwnedBy<T::AccountId, WithWitness<DestroyWitness>>,
) -> DispatchResult {
let CheckState(owner, CheckState(witness, _)) = strategy;
<Pallet<T, I>>::do_destroy_collection(collection.clone(), witness, Some(owner))
.map(|_witness| ())
}
}
impl<T: Config<I>, I: 'static> Destroy<CheckOrigin<T::RuntimeOrigin, WithWitness<DestroyWitness>>>
for Collection<Pallet<T, I>>
{
fn destroy(
collection: &Self::Id,
strategy: CheckOrigin<T::RuntimeOrigin, WithWitness<DestroyWitness>>,
) -> DispatchResult {
let CheckOrigin(origin, CheckState(witness, _)) = strategy;
let maybe_check_owner = match T::ForceOrigin::try_origin(origin) {
Ok(_) => None,
Err(origin) => Some(ensure_signed(origin)?),
};
<Pallet<T, I>>::do_destroy_collection(collection.clone(), witness, maybe_check_owner)
.map(|_witness| ())
}
}
@@ -0,0 +1,232 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
use core::marker::PhantomData;
use crate::{
asset_strategies::{Attribute, WithItemConfig},
Item as ItemStorage, *,
};
use pezframe_support::{
dispatch::DispatchResult,
ensure,
traits::tokens::asset_ops::{
common_strategies::{
Bytes, CanUpdate, ChangeOwnerFrom, CheckOrigin, CheckState, ConfigValue, IfOwnedBy,
NoParams, Owner, PredefinedId, WithConfig,
},
AssetDefinition, Create, Inspect, Restore, Stash, Update,
},
BoundedSlice,
};
use pezframe_system::ensure_signed;
use pezsp_runtime::DispatchError;
pub struct Item<PalletInstance>(PhantomData<PalletInstance>);
impl<T: Config<I>, I: 'static> AssetDefinition for Item<Pallet<T, I>> {
type Id = (T::CollectionId, T::ItemId);
}
impl<T: Config<I>, I: 'static> Inspect<Owner<T::AccountId>> for Item<Pallet<T, I>> {
fn inspect(
(collection, item): &Self::Id,
_ownership: Owner<T::AccountId>,
) -> Result<T::AccountId, DispatchError> {
ItemStorage::<T, I>::get(collection, item)
.map(|a| a.owner)
.ok_or(Error::<T, I>::UnknownItem.into())
}
}
impl<T: Config<I>, I: 'static> Inspect<Bytes> for Item<Pallet<T, I>> {
fn inspect((collection, item): &Self::Id, _bytes: Bytes) -> Result<Vec<u8>, DispatchError> {
ItemMetadataOf::<T, I>::get(collection, item)
.map(|m| m.data.into())
.ok_or(Error::<T, I>::NoMetadata.into())
}
}
impl<'a, T: Config<I>, I: 'static> Inspect<Bytes<Attribute<'a>>> for Item<Pallet<T, I>> {
fn inspect(
(collection, item): &Self::Id,
strategy: Bytes<Attribute>,
) -> Result<Vec<u8>, DispatchError> {
let Bytes(Attribute(attribute)) = strategy;
let attribute =
BoundedSlice::try_from(attribute).map_err(|_| Error::<T, I>::WrongAttribute)?;
crate::Attribute::<T, I>::get((collection, Some(item), attribute))
.map(|a| a.0.into())
.ok_or(Error::<T, I>::AttributeNotFound.into())
}
}
impl<T: Config<I>, I: 'static> Inspect<CanUpdate<Owner<T::AccountId>>> for Item<Pallet<T, I>> {
fn inspect(
(collection, item): &Self::Id,
_can_update: CanUpdate<Owner<T::AccountId>>,
) -> Result<bool, DispatchError> {
match (Collection::<T, I>::get(collection), ItemStorage::<T, I>::get(collection, item)) {
(Some(cd), Some(id)) => Ok(!cd.is_frozen && !id.is_frozen),
_ => Err(Error::<T, I>::UnknownItem.into()),
}
}
}
impl<T: Config<I>, I: 'static> Create<WithItemConfig<T, I>> for Item<Pallet<T, I>> {
fn create(
strategy: WithItemConfig<T, I>,
) -> Result<(T::CollectionId, T::ItemId), DispatchError> {
let WithConfig { config: ConfigValue::<_>(owner), extra: id_assignment } = strategy;
let (collection, item) = id_assignment.params;
<Pallet<T, I>>::do_mint(collection.clone(), item, owner, |_| Ok(()))?;
Ok((collection, item))
}
}
impl<T: Config<I>, I: 'static> Create<CheckOrigin<T::RuntimeOrigin, WithItemConfig<T, I>>>
for Item<Pallet<T, I>>
{
fn create(
strategy: CheckOrigin<T::RuntimeOrigin, WithItemConfig<T, I>>,
) -> Result<(T::CollectionId, T::ItemId), DispatchError> {
let CheckOrigin(
origin,
WithConfig { config: ConfigValue::<_>(owner), extra: id_assignment },
) = strategy;
let (collection, item) = id_assignment.params;
let signer = ensure_signed(origin)?;
<Pallet<T, I>>::do_mint(collection.clone(), item, owner, |collection_details| {
ensure!(collection_details.issuer == signer, Error::<T, I>::NoPermission);
Ok(())
})?;
Ok((collection, item))
}
}
impl<T: Config<I>, I: 'static> Update<Owner<T::AccountId>> for Item<Pallet<T, I>> {
fn update(
(collection, item): &Self::Id,
_strategy: Owner<T::AccountId>,
dest: &T::AccountId,
) -> DispatchResult {
<Pallet<T, I>>::do_transfer(collection.clone(), *item, dest.clone(), |_, _| Ok(()))
}
}
impl<T: Config<I>, I: 'static> Update<CheckOrigin<T::RuntimeOrigin, Owner<T::AccountId>>>
for Item<Pallet<T, I>>
{
fn update(
(collection, item): &Self::Id,
strategy: CheckOrigin<T::RuntimeOrigin, Owner<T::AccountId>>,
dest: &T::AccountId,
) -> DispatchResult {
let CheckOrigin(origin, ..) = strategy;
let signer = ensure_signed(origin)?;
<Pallet<T, I>>::do_transfer(
collection.clone(),
*item,
dest.clone(),
|collection_details, details| {
if details.owner != signer && collection_details.admin != signer {
let approved = details.approved.take().map_or(false, |i| i == signer);
ensure!(approved, Error::<T, I>::NoPermission);
}
Ok(())
},
)
}
}
impl<T: Config<I>, I: 'static> Update<ChangeOwnerFrom<T::AccountId>> for Item<Pallet<T, I>> {
fn update(
(collection, item): &Self::Id,
strategy: ChangeOwnerFrom<T::AccountId>,
dest: &T::AccountId,
) -> DispatchResult {
let CheckState(from, ..) = strategy;
<Pallet<T, I>>::do_transfer(collection.clone(), *item, dest.clone(), |_, details| {
ensure!(details.owner == from, Error::<T, I>::WrongOwner);
Ok(())
})
}
}
impl<T: Config<I>, I: 'static> Stash<NoParams> for Item<Pallet<T, I>> {
fn stash((collection, item): &Self::Id, _strategy: NoParams) -> DispatchResult {
<Pallet<T, I>>::do_burn(collection.clone(), *item, |_, _| Ok(()))
}
}
impl<T: Config<I>, I: 'static> Stash<CheckOrigin<T::RuntimeOrigin>> for Item<Pallet<T, I>> {
fn stash(
(collection, item): &Self::Id,
strategy: CheckOrigin<T::RuntimeOrigin>,
) -> DispatchResult {
let CheckOrigin(origin, ..) = strategy;
let signer = ensure_signed(origin)?;
<Pallet<T, I>>::do_burn(collection.clone(), *item, |collection_details, details| {
let is_permitted = collection_details.admin == signer || details.owner == signer;
ensure!(is_permitted, Error::<T, I>::NoPermission);
Ok(())
})
}
}
impl<T: Config<I>, I: 'static> Stash<IfOwnedBy<T::AccountId>> for Item<Pallet<T, I>> {
fn stash((collection, item): &Self::Id, strategy: IfOwnedBy<T::AccountId>) -> DispatchResult {
let CheckState(who, ..) = strategy;
<Pallet<T, I>>::do_burn(collection.clone(), *item, |_, d| {
ensure!(d.owner == who, Error::<T, I>::NoPermission);
Ok(())
})
}
}
// NOTE: pezpallet-uniques create and restore operations are equivalent.
// If an NFT was burned, it can be "re-created" (equivalently, "restored").
// It will be "re-created" with all the data still bound to it.
// If an NFT is minted for the first time, it can be regarded as "restored" with an empty data
// because it is indistinguishable from a burned empty NFT from the chain's perspective.
impl<T: Config<I>, I: 'static> Restore<WithConfig<ConfigValue<Owner<T::AccountId>>>>
for Item<Pallet<T, I>>
{
fn restore(
(collection, item): &Self::Id,
strategy: WithConfig<ConfigValue<Owner<T::AccountId>>>,
) -> DispatchResult {
Self::create(WithConfig::new(
strategy.config,
PredefinedId::from((collection.clone(), *item)),
))?;
Ok(())
}
}
@@ -0,0 +1,22 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
mod collection;
mod item;
pub use collection::Collection;
pub use item::Item;
@@ -0,0 +1,448 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
//! Uniques pallet benchmarking.
#![cfg(feature = "runtime-benchmarks")]
use super::*;
use alloc::{vec, vec::Vec};
use pezframe_benchmarking::v1::{
account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, BenchmarkError,
};
use pezframe_support::{
traits::{EnsureOrigin, Get, UnfilteredDispatchable},
BoundedVec,
};
use pezframe_system::RawOrigin as SystemOrigin;
use pezsp_runtime::traits::Bounded;
use crate::Pallet as Uniques;
const SEED: u32 = 0;
fn create_collection<T: Config<I>, I: 'static>(
) -> (T::CollectionId, T::AccountId, AccountIdLookupOf<T>) {
let caller: T::AccountId = whitelisted_caller();
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(),
collection.clone(),
caller_lookup.clone(),
false,
)
.is_ok());
(collection, caller, caller_lookup)
}
fn add_collection_metadata<T: Config<I>, I: 'static>() -> (T::AccountId, AccountIdLookupOf<T>) {
let caller = Collection::<T, I>::get(T::Helper::collection(0)).unwrap().owner;
if caller != whitelisted_caller() {
whitelist_account!(caller);
}
let caller_lookup = T::Lookup::unlookup(caller.clone());
assert!(Uniques::<T, I>::set_collection_metadata(
SystemOrigin::Signed(caller.clone()).into(),
T::Helper::collection(0),
vec![0; T::StringLimit::get() as usize].try_into().unwrap(),
false,
)
.is_ok());
(caller, caller_lookup)
}
fn mint_item<T: Config<I>, I: 'static>(
index: u16,
) -> (T::ItemId, T::AccountId, AccountIdLookupOf<T>) {
let caller = Collection::<T, I>::get(T::Helper::collection(0)).unwrap().admin;
if caller != whitelisted_caller() {
whitelist_account!(caller);
}
let caller_lookup = T::Lookup::unlookup(caller.clone());
let item = T::Helper::item(index);
assert!(Uniques::<T, I>::mint(
SystemOrigin::Signed(caller.clone()).into(),
T::Helper::collection(0),
item,
caller_lookup.clone(),
)
.is_ok());
(item, caller, caller_lookup)
}
fn add_item_metadata<T: Config<I>, I: 'static>(
item: T::ItemId,
) -> (T::AccountId, AccountIdLookupOf<T>) {
let caller = Collection::<T, I>::get(T::Helper::collection(0)).unwrap().owner;
if caller != whitelisted_caller() {
whitelist_account!(caller);
}
let caller_lookup = T::Lookup::unlookup(caller.clone());
assert!(Uniques::<T, I>::set_metadata(
SystemOrigin::Signed(caller.clone()).into(),
T::Helper::collection(0),
item,
vec![0; T::StringLimit::get() as usize].try_into().unwrap(),
false,
)
.is_ok());
(caller, caller_lookup)
}
fn add_item_attribute<T: Config<I>, I: 'static>(
item: T::ItemId,
) -> (BoundedVec<u8, T::KeyLimit>, T::AccountId, AccountIdLookupOf<T>) {
let caller = Collection::<T, I>::get(T::Helper::collection(0)).unwrap().owner;
if caller != whitelisted_caller() {
whitelist_account!(caller);
}
let caller_lookup = T::Lookup::unlookup(caller.clone());
let key: BoundedVec<_, _> = vec![0; T::KeyLimit::get() as usize].try_into().unwrap();
assert!(Uniques::<T, I>::set_attribute(
SystemOrigin::Signed(caller.clone()).into(),
T::Helper::collection(0),
Some(item),
key.clone(),
vec![0; T::ValueLimit::get() as usize].try_into().unwrap(),
)
.is_ok());
(key, caller, caller_lookup)
}
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
let events = pezframe_system::Pallet::<T>::events();
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
// compare to the last event record
let pezframe_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
}
benchmarks_instance_pallet! {
create {
let collection = T::Helper::collection(0);
let origin = T::CreateOrigin::try_successful_origin(&collection)
.map_err(|_| BenchmarkError::Weightless)?;
let caller = T::CreateOrigin::ensure_origin(origin.clone(), &collection).unwrap();
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 { 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());
}
force_create {
let caller: T::AccountId = whitelisted_caller();
let caller_lookup = T::Lookup::unlookup(caller.clone());
}: _(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());
}
destroy {
let n in 0 .. 1_000;
let m in 0 .. 1_000;
let a in 0 .. 1_000;
let (collection, caller, caller_lookup) = create_collection::<T, I>();
add_collection_metadata::<T, I>();
for i in 0..n {
mint_item::<T, I>(i as u16);
}
for i in 0..m {
add_item_metadata::<T, I>(T::Helper::item(i as u16));
}
for i in 0..a {
add_item_attribute::<T, I>(T::Helper::item(i as u16));
}
let witness = Collection::<T, I>::get(collection.clone()).unwrap().destroy_witness();
}: _(SystemOrigin::Signed(caller), collection.clone(), witness)
verify {
assert_last_event::<T, I>(Event::Destroyed { collection: collection.clone() }.into());
}
mint {
let (collection, caller, caller_lookup) = create_collection::<T, I>();
let item = T::Helper::item(0);
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), item, caller_lookup)
verify {
assert_last_event::<T, I>(Event::Issued { collection: collection.clone(), item, owner: caller }.into());
}
burn {
let (collection, caller, caller_lookup) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), item, Some(caller_lookup))
verify {
assert_last_event::<T, I>(Event::Burned { collection: collection.clone(), item, owner: caller }.into());
}
transfer {
let (collection, caller, caller_lookup) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
let target: T::AccountId = account("target", 0, SEED);
let target_lookup = T::Lookup::unlookup(target.clone());
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), item, target_lookup)
verify {
assert_last_event::<T, I>(Event::Transferred { collection: collection.clone(), item, from: caller, to: target }.into());
}
redeposit {
let i in 0 .. 5_000;
let (collection, caller, caller_lookup) = create_collection::<T, I>();
let items = (0..i).map(|x| mint_item::<T, I>(x as u16).0).collect::<Vec<_>>();
Uniques::<T, I>::force_item_status(
SystemOrigin::Root.into(),
collection.clone(),
caller_lookup.clone(),
caller_lookup.clone(),
caller_lookup.clone(),
caller_lookup,
true,
false,
)?;
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), items.clone())
verify {
assert_last_event::<T, I>(Event::Redeposited { collection: collection.clone(), successful_items: items }.into());
}
freeze {
let (collection, caller, caller_lookup) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
}: _(SystemOrigin::Signed(caller.clone()), T::Helper::collection(0), T::Helper::item(0))
verify {
assert_last_event::<T, I>(Event::Frozen { collection: T::Helper::collection(0), item: T::Helper::item(0) }.into());
}
thaw {
let (collection, caller, caller_lookup) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
Uniques::<T, I>::freeze(
SystemOrigin::Signed(caller.clone()).into(),
collection.clone(),
item,
)?;
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), item)
verify {
assert_last_event::<T, I>(Event::Thawed { collection: collection.clone(), item }.into());
}
freeze_collection {
let (collection, caller, caller_lookup) = create_collection::<T, I>();
}: _(SystemOrigin::Signed(caller.clone()), collection.clone())
verify {
assert_last_event::<T, I>(Event::CollectionFrozen { collection: collection.clone() }.into());
}
thaw_collection {
let (collection, caller, caller_lookup) = create_collection::<T, I>();
let origin = SystemOrigin::Signed(caller.clone()).into();
Uniques::<T, I>::freeze_collection(origin, collection.clone())?;
}: _(SystemOrigin::Signed(caller.clone()), collection.clone())
verify {
assert_last_event::<T, I>(Event::CollectionThawed { collection: collection.clone() }.into());
}
transfer_ownership {
let (collection, caller, _) = create_collection::<T, I>();
let target: T::AccountId = account("target", 0, SEED);
let target_lookup = T::Lookup::unlookup(target.clone());
T::Currency::make_free_balance_be(&target, T::Currency::minimum_balance());
let origin = SystemOrigin::Signed(target.clone()).into();
Uniques::<T, I>::set_accept_ownership(origin, Some(collection.clone()))?;
}: _(SystemOrigin::Signed(caller), collection.clone(), target_lookup)
verify {
assert_last_event::<T, I>(Event::OwnerChanged { collection: collection.clone(), new_owner: target }.into());
}
set_team {
let (collection, caller, _) = create_collection::<T, I>();
let target0 = T::Lookup::unlookup(account("target", 0, SEED));
let target1 = T::Lookup::unlookup(account("target", 1, SEED));
let target2 = T::Lookup::unlookup(account("target", 2, SEED));
}: _(SystemOrigin::Signed(caller), collection.clone(), target0, target1, target2)
verify {
assert_last_event::<T, I>(Event::TeamChanged{
collection: collection.clone(),
issuer: account("target", 0, SEED),
admin: account("target", 1, SEED),
freezer: account("target", 2, SEED),
}.into());
}
force_item_status {
let (collection, caller, caller_lookup) = create_collection::<T, I>();
let origin =
T::ForceOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let call = Call::<T, I>::force_item_status {
collection: collection.clone(),
owner: caller_lookup.clone(),
issuer: caller_lookup.clone(),
admin: caller_lookup.clone(),
freezer: caller_lookup,
free_holding: true,
is_frozen: false,
};
}: { call.dispatch_bypass_filter(origin)? }
verify {
assert_last_event::<T, I>(Event::ItemStatusChanged { collection: collection.clone() }.into());
}
set_attribute {
let key: BoundedVec<_, _> = vec![0u8; T::KeyLimit::get() as usize].try_into().unwrap();
let value: BoundedVec<_, _> = vec![0u8; T::ValueLimit::get() as usize].try_into().unwrap();
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
add_item_metadata::<T, I>(item);
}: _(SystemOrigin::Signed(caller), collection.clone(), Some(item), key.clone(), value.clone())
verify {
assert_last_event::<T, I>(Event::AttributeSet { collection: collection.clone(), maybe_item: Some(item), key, value }.into());
}
clear_attribute {
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
add_item_metadata::<T, I>(item);
let (key, ..) = add_item_attribute::<T, I>(item);
}: _(SystemOrigin::Signed(caller), collection.clone(), Some(item), key.clone())
verify {
assert_last_event::<T, I>(Event::AttributeCleared { collection: collection.clone(), maybe_item: Some(item), key }.into());
}
set_metadata {
let data: BoundedVec<_, _> = vec![0u8; T::StringLimit::get() as usize].try_into().unwrap();
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
}: _(SystemOrigin::Signed(caller), collection.clone(), item, data.clone(), false)
verify {
assert_last_event::<T, I>(Event::MetadataSet { collection: collection.clone(), item, data, is_frozen: false }.into());
}
clear_metadata {
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
add_item_metadata::<T, I>(item);
}: _(SystemOrigin::Signed(caller), collection.clone(), item)
verify {
assert_last_event::<T, I>(Event::MetadataCleared { collection: collection.clone(), item }.into());
}
set_collection_metadata {
let data: BoundedVec<_, _> = vec![0u8; T::StringLimit::get() as usize].try_into().unwrap();
let (collection, caller, _) = create_collection::<T, I>();
}: _(SystemOrigin::Signed(caller), collection.clone(), data.clone(), false)
verify {
assert_last_event::<T, I>(Event::CollectionMetadataSet { collection: collection.clone(), data, is_frozen: false }.into());
}
clear_collection_metadata {
let (collection, caller, _) = create_collection::<T, I>();
add_collection_metadata::<T, I>();
}: _(SystemOrigin::Signed(caller), collection.clone())
verify {
assert_last_event::<T, I>(Event::CollectionMetadataCleared { collection: collection.clone() }.into());
}
approve_transfer {
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), item, delegate_lookup)
verify {
assert_last_event::<T, I>(Event::ApprovedTransfer { collection: collection.clone(), item, owner: caller, delegate }.into());
}
cancel_approval {
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let origin = SystemOrigin::Signed(caller.clone()).into();
Uniques::<T, I>::approve_transfer(origin, collection.clone(), item, delegate_lookup.clone())?;
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), item, Some(delegate_lookup))
verify {
assert_last_event::<T, I>(Event::ApprovalCancelled { collection: collection.clone(), item, owner: caller, delegate }.into());
}
set_accept_ownership {
let caller: T::AccountId = whitelisted_caller();
T::Currency::make_free_balance_be(&caller, DepositBalanceOf::<T, I>::max_value());
let collection = T::Helper::collection(0);
}: _(SystemOrigin::Signed(caller.clone()), Some(collection.clone()))
verify {
assert_last_event::<T, I>(Event::OwnershipAcceptanceChanged {
who: caller,
maybe_collection: Some(collection),
}.into());
}
set_collection_max_supply {
let (collection, caller, _) = create_collection::<T, I>();
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), u32::MAX)
verify {
assert_last_event::<T, I>(Event::CollectionMaxSupplySet {
collection: collection.clone(),
max_supply: u32::MAX,
}.into());
}
set_price {
let (collection, caller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
let delegate: T::AccountId = account("delegate", 0, SEED);
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
let price = ItemPrice::<T, I>::from(100u32);
}: _(SystemOrigin::Signed(caller.clone()), collection.clone(), item, Some(price), Some(delegate_lookup))
verify {
assert_last_event::<T, I>(Event::ItemPriceSet {
collection: collection.clone(),
item,
price,
whitelisted_buyer: Some(delegate),
}.into());
}
buy_item {
let (collection, seller, _) = create_collection::<T, I>();
let (item, ..) = mint_item::<T, I>(0);
let buyer: T::AccountId = account("buyer", 0, SEED);
let buyer_lookup = T::Lookup::unlookup(buyer.clone());
let price = ItemPrice::<T, I>::from(0u32);
let origin = SystemOrigin::Signed(seller.clone()).into();
Uniques::<T, I>::set_price(origin, collection.clone(), item, Some(price), Some(buyer_lookup))?;
T::Currency::make_free_balance_be(&buyer, DepositBalanceOf::<T, I>::max_value());
}: _(SystemOrigin::Signed(buyer.clone()), collection.clone(), item, price)
verify {
assert_last_event::<T, I>(Event::ItemBought {
collection: collection.clone(),
item,
price,
seller,
buyer,
}.into());
}
impl_benchmark_test_suite!(Uniques, crate::mock::new_test_ext(), crate::mock::Test);
}
@@ -0,0 +1,352 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
//! Various pieces of common functionality.
use super::*;
use pezframe_support::{
ensure,
traits::{ExistenceRequirement, Get},
};
use pezsp_runtime::{DispatchError, DispatchResult};
impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Perform a transfer of an item from one account to another within a collection.
///
/// # Errors
/// This function returns a dispatch error in the following cases:
/// - The collection or item does not exist
/// ([`UnknownCollection`](crate::Error::UnknownCollection)).
/// - The collection is frozen, and no transfers are allowed ([`Frozen`](crate::Error::Frozen)).
/// - The item is locked, and transfers are not permitted ([`Locked`](crate::Error::Locked)).
/// - The `with_details` closure returns an error.
pub fn do_transfer(
collection: T::CollectionId,
item: T::ItemId,
dest: T::AccountId,
with_details: impl FnOnce(
&CollectionDetailsFor<T, I>,
&mut ItemDetailsFor<T, I>,
) -> DispatchResult,
) -> DispatchResult {
let collection_details =
Collection::<T, I>::get(&collection).ok_or(Error::<T, I>::UnknownCollection)?;
ensure!(!collection_details.is_frozen, Error::<T, I>::Frozen);
ensure!(!T::Locker::is_locked(collection.clone(), item), Error::<T, I>::Locked);
let mut details =
Item::<T, I>::get(&collection, &item).ok_or(Error::<T, I>::UnknownCollection)?;
ensure!(!details.is_frozen, Error::<T, I>::Frozen);
with_details(&collection_details, &mut details)?;
Account::<T, I>::remove((&details.owner, &collection, &item));
Account::<T, I>::insert((&dest, &collection, &item), ());
let origin = details.owner;
details.owner = dest;
// The approved account has to be reset to `None`, because otherwise pre-approve attack
// would be possible, where the owner can approve their second account before making the
// transaction and then claiming the item back.
details.approved = None;
Item::<T, I>::insert(&collection, &item, &details);
ItemPriceOf::<T, I>::remove(&collection, &item);
Self::deposit_event(Event::Transferred {
collection,
item,
from: origin,
to: details.owner,
});
Ok(())
}
/// Create a new collection with the provided details.
///
/// # Errors
/// This function returns a dispatch error in the following cases:
/// - If the collection ID is already in use ([`InUse`](crate::Error::InUse)).
/// - If reserving the deposit fails (e.g., insufficient funds).
pub fn do_create_collection(
collection: T::CollectionId,
owner: T::AccountId,
admin: T::AccountId,
deposit: DepositBalanceOf<T, I>,
free_holding: bool,
event: Event<T, I>,
) -> DispatchResult {
ensure!(!Collection::<T, I>::contains_key(collection.clone()), Error::<T, I>::InUse);
T::Currency::reserve(&owner, deposit)?;
Collection::<T, I>::insert(
collection.clone(),
CollectionDetails {
owner: owner.clone(),
issuer: admin.clone(),
admin: admin.clone(),
freezer: admin,
total_deposit: deposit,
free_holding,
items: 0,
item_metadatas: 0,
attributes: 0,
is_frozen: false,
},
);
CollectionAccount::<T, I>::insert(&owner, &collection, ());
Self::deposit_event(event);
Ok(())
}
/// Destroy a collection along with its associated items and metadata.
///
/// # Errors
/// This function returns a dispatch error in the following cases:
/// - The collection does not exist ([`UnknownCollection`](crate::Error::UnknownCollection)).
/// - The provided witness does not match the actual counts
/// ([`BadWitness`](crate::Error::BadWitness)).
/// - The caller is not the owner of the collection
/// ([`NoPermission`](crate::Error::NoPermission)).
pub fn do_destroy_collection(
collection: T::CollectionId,
witness: DestroyWitness,
maybe_check_owner: Option<T::AccountId>,
) -> Result<DestroyWitness, DispatchError> {
Collection::<T, I>::try_mutate_exists(collection.clone(), |maybe_details| {
let collection_details =
maybe_details.take().ok_or(Error::<T, I>::UnknownCollection)?;
if let Some(check_owner) = maybe_check_owner {
ensure!(collection_details.owner == check_owner, Error::<T, I>::NoPermission);
}
ensure!(collection_details.items == witness.items, Error::<T, I>::BadWitness);
ensure!(
collection_details.item_metadatas == witness.item_metadatas,
Error::<T, I>::BadWitness
);
ensure!(collection_details.attributes == witness.attributes, Error::<T, I>::BadWitness);
for (item, details) in Item::<T, I>::drain_prefix(&collection) {
Account::<T, I>::remove((&details.owner, &collection, &item));
}
#[allow(deprecated)]
ItemMetadataOf::<T, I>::remove_prefix(&collection, None);
#[allow(deprecated)]
ItemPriceOf::<T, I>::remove_prefix(&collection, None);
CollectionMetadataOf::<T, I>::remove(&collection);
#[allow(deprecated)]
Attribute::<T, I>::remove_prefix((&collection,), None);
CollectionAccount::<T, I>::remove(&collection_details.owner, &collection);
T::Currency::unreserve(&collection_details.owner, collection_details.total_deposit);
CollectionMaxSupply::<T, I>::remove(&collection);
Self::deposit_event(Event::Destroyed { collection });
Ok(DestroyWitness {
items: collection_details.items,
item_metadatas: collection_details.item_metadatas,
attributes: collection_details.attributes,
})
})
}
/// Mint (create) a new item within a collection and assign ownership to an account.
///
/// # Errors
/// This function returns a dispatch error in the following cases:
/// - The item already exists in the collection
/// ([`AlreadyExists`](crate::Error::AlreadyExists)).
/// - The collection does not exist ([`UnknownCollection`](crate::Error::UnknownCollection)).
/// - The provided closure `with_details` returns an error.
/// - The collection has reached its maximum supply
/// ([`MaxSupplyReached`](crate::Error::MaxSupplyReached)).
/// - An arithmetic overflow occurs when incrementing the number of items in the collection.
/// - The currency reserve operation for the item deposit fails for any reason.
pub fn do_mint(
collection: T::CollectionId,
item: T::ItemId,
owner: T::AccountId,
with_details: impl FnOnce(&CollectionDetailsFor<T, I>) -> DispatchResult,
) -> DispatchResult {
ensure!(
!Item::<T, I>::contains_key(collection.clone(), item),
Error::<T, I>::AlreadyExists
);
Collection::<T, I>::try_mutate(
&collection,
|maybe_collection_details| -> DispatchResult {
let collection_details =
maybe_collection_details.as_mut().ok_or(Error::<T, I>::UnknownCollection)?;
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;
let deposit = match collection_details.free_holding {
true => Zero::zero(),
false => T::ItemDeposit::get(),
};
T::Currency::reserve(&collection_details.owner, deposit)?;
collection_details.total_deposit += deposit;
let owner = owner.clone();
Account::<T, I>::insert((&owner, &collection, &item), ());
let details = ItemDetails { owner, approved: None, is_frozen: false, deposit };
Item::<T, I>::insert(&collection, &item, details);
Ok(())
},
)?;
Self::deposit_event(Event::Issued { collection, item, owner });
Ok(())
}
/// Burn (destroy) an item from a collection.
///
/// # Errors
/// This function returns a `Dispatch` error in the following cases:
/// - The item is locked and burns are not permitted ([`Locked`](crate::Error::Locked)).
/// - The collection or item does not exist
/// ([`UnknownCollection`](crate::Error::UnknownCollection)).
/// - The `with_details` closure returns an error.
pub fn do_burn(
collection: T::CollectionId,
item: T::ItemId,
with_details: impl FnOnce(&CollectionDetailsFor<T, I>, &ItemDetailsFor<T, I>) -> DispatchResult,
) -> DispatchResult {
ensure!(!T::Locker::is_locked(collection.clone(), item), Error::<T, I>::Locked);
let owner = Collection::<T, I>::try_mutate(
&collection,
|maybe_collection_details| -> Result<T::AccountId, DispatchError> {
let collection_details =
maybe_collection_details.as_mut().ok_or(Error::<T, I>::UnknownCollection)?;
// TODO should it be UnknownItem instead of UnknownCollection?
let details = Item::<T, I>::get(&collection, &item)
.ok_or(Error::<T, I>::UnknownCollection)?;
with_details(collection_details, &details)?;
// Return the deposit.
T::Currency::unreserve(&collection_details.owner, details.deposit);
collection_details.total_deposit.saturating_reduce(details.deposit);
collection_details.items.saturating_dec();
Ok(details.owner)
},
)?;
Item::<T, I>::remove(&collection, &item);
Account::<T, I>::remove((&owner, &collection, &item));
ItemPriceOf::<T, I>::remove(&collection, &item);
Self::deposit_event(Event::Burned { collection, item, owner });
Ok(())
}
/// Set or remove the price for an item in a collection.
///
/// # Errors
/// This function returns a dispatch error in the following cases:
/// - The item or collection does not exist ([`UnknownItem`](crate::Error::UnknownItem) or
/// [`UnknownCollection`](crate::Error::UnknownCollection)).
/// - The sender is not the owner of the item ([`NoPermission`](crate::Error::NoPermission)).
pub fn do_set_price(
collection: T::CollectionId,
item: T::ItemId,
sender: T::AccountId,
price: Option<ItemPrice<T, I>>,
whitelisted_buyer: Option<T::AccountId>,
) -> DispatchResult {
let details = Item::<T, I>::get(&collection, &item).ok_or(Error::<T, I>::UnknownItem)?;
ensure!(details.owner == sender, Error::<T, I>::NoPermission);
if let Some(ref price) = price {
ItemPriceOf::<T, I>::insert(&collection, &item, (price, whitelisted_buyer.clone()));
Self::deposit_event(Event::ItemPriceSet {
collection,
item,
price: *price,
whitelisted_buyer,
});
} else {
ItemPriceOf::<T, I>::remove(&collection, &item);
Self::deposit_event(Event::ItemPriceRemoved { collection, item });
}
Ok(())
}
/// Buy an item from a collection.
///
/// # Errors
/// This function returns a dispatch error in the following cases:
/// - The item or collection does not exist ([`UnknownItem`](crate::Error::UnknownItem) or
/// [`UnknownCollection`](crate::Error::UnknownCollection)).
/// - The buyer is the current owner of the item ([`NoPermission`](crate::Error::NoPermission)).
/// - The item is not for sale ([`NotForSale`](crate::Error::NotForSale)).
/// - The bid price is lower than the item's sale price
/// ([`BidTooLow`](crate::Error::BidTooLow)).
/// - The item is set to be sold only to a specific buyer, and the provided buyer is not the
/// whitelisted buyer ([`NoPermission`](crate::Error::NoPermission)).
/// - The currency transfer between the buyer and the owner fails for any reason.
pub fn do_buy_item(
collection: T::CollectionId,
item: T::ItemId,
buyer: T::AccountId,
bid_price: ItemPrice<T, I>,
) -> DispatchResult {
let details = Item::<T, I>::get(&collection, &item).ok_or(Error::<T, I>::UnknownItem)?;
ensure!(details.owner != buyer, Error::<T, I>::NoPermission);
let price_info =
ItemPriceOf::<T, I>::get(&collection, &item).ok_or(Error::<T, I>::NotForSale)?;
ensure!(bid_price >= price_info.0, Error::<T, I>::BidTooLow);
if let Some(only_buyer) = price_info.1 {
ensure!(only_buyer == buyer, Error::<T, I>::NoPermission);
}
T::Currency::transfer(
&buyer,
&details.owner,
price_info.0,
ExistenceRequirement::KeepAlive,
)?;
let old_owner = details.owner.clone();
Self::do_transfer(collection.clone(), item, buyer.clone(), |_, _| Ok(()))?;
Self::deposit_event(Event::ItemBought {
collection,
item,
price: price_info.0,
seller: old_owner,
buyer,
});
Ok(())
}
}
@@ -0,0 +1,199 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
//! Implementations for `nonfungibles` traits.
use super::*;
use alloc::vec::Vec;
use pezframe_support::{
storage::KeyPrefixIterator,
traits::{tokens::nonfungibles::*, Get},
BoundedSlice,
};
use pezsp_runtime::{DispatchError, DispatchResult};
impl<T: Config<I>, I: 'static> Inspect<<T as SystemConfig>::AccountId> for Pallet<T, I> {
type ItemId = T::ItemId;
type CollectionId = T::CollectionId;
fn owner(
collection: &Self::CollectionId,
item: &Self::ItemId,
) -> Option<<T as SystemConfig>::AccountId> {
Item::<T, I>::get(collection, item).map(|a| a.owner)
}
fn collection_owner(collection: &Self::CollectionId) -> Option<<T as SystemConfig>::AccountId> {
Collection::<T, I>::get(collection).map(|a| a.owner)
}
/// Returns the attribute value of `item` of `collection` corresponding to `key`.
///
/// When `key` is empty, we return the item metadata value.
///
/// By default this is `None`; no attributes are defined.
fn attribute(
collection: &Self::CollectionId,
item: &Self::ItemId,
key: &[u8],
) -> Option<Vec<u8>> {
if key.is_empty() {
// We make the empty key map to the item metadata value.
ItemMetadataOf::<T, I>::get(collection, item).map(|m| m.data.into())
} else {
let key = BoundedSlice::<_, _>::try_from(key).ok()?;
Attribute::<T, I>::get((collection, Some(item), key)).map(|a| a.0.into())
}
}
/// Returns the attribute value of `item` of `collection` corresponding to `key`.
///
/// When `key` is empty, we return the item metadata value.
///
/// By default this is `None`; no attributes are defined.
fn collection_attribute(collection: &Self::CollectionId, key: &[u8]) -> Option<Vec<u8>> {
if key.is_empty() {
// We make the empty key map to the item metadata value.
CollectionMetadataOf::<T, I>::get(collection).map(|m| m.data.into())
} else {
let key = BoundedSlice::<_, _>::try_from(key).ok()?;
Attribute::<T, I>::get((collection, Option::<T::ItemId>::None, key)).map(|a| a.0.into())
}
}
/// Returns `true` if the `item` of `collection` may be transferred.
///
/// Default implementation is that all items are transferable.
fn can_transfer(collection: &Self::CollectionId, item: &Self::ItemId) -> bool {
match (Collection::<T, I>::get(collection), Item::<T, I>::get(collection, item)) {
(Some(cd), Some(id)) if !cd.is_frozen && !id.is_frozen => true,
_ => false,
}
}
}
impl<T: Config<I>, I: 'static> Create<<T as SystemConfig>::AccountId> for Pallet<T, I> {
/// Create a `collection` of nonfungible items to be owned by `who` and managed by `admin`.
fn create_collection(
collection: &Self::CollectionId,
who: &T::AccountId,
admin: &T::AccountId,
) -> DispatchResult {
Self::do_create_collection(
collection.clone(),
who.clone(),
admin.clone(),
T::CollectionDeposit::get(),
false,
Event::Created {
collection: collection.clone(),
creator: who.clone(),
owner: admin.clone(),
},
)
}
}
impl<T: Config<I>, I: 'static> Destroy<<T as SystemConfig>::AccountId> for Pallet<T, I> {
type DestroyWitness = DestroyWitness;
fn get_destroy_witness(collection: &Self::CollectionId) -> Option<DestroyWitness> {
Collection::<T, I>::get(collection).map(|a| a.destroy_witness())
}
fn destroy(
collection: Self::CollectionId,
witness: Self::DestroyWitness,
maybe_check_owner: Option<T::AccountId>,
) -> Result<Self::DestroyWitness, DispatchError> {
Self::do_destroy_collection(collection, witness, maybe_check_owner)
}
}
impl<T: Config<I>, I: 'static> Mutate<<T as SystemConfig>::AccountId> for Pallet<T, I> {
fn mint_into(
collection: &Self::CollectionId,
item: &Self::ItemId,
who: &T::AccountId,
) -> DispatchResult {
Self::do_mint(collection.clone(), *item, who.clone(), |_| Ok(()))
}
fn burn(
collection: &Self::CollectionId,
item: &Self::ItemId,
maybe_check_owner: Option<&T::AccountId>,
) -> DispatchResult {
Self::do_burn(collection.clone(), *item, |_, d| {
if let Some(check_owner) = maybe_check_owner {
if &d.owner != check_owner {
return Err(Error::<T, I>::NoPermission.into());
}
}
Ok(())
})
}
}
impl<T: Config<I>, I: 'static> Transfer<T::AccountId> for Pallet<T, I> {
fn transfer(
collection: &Self::CollectionId,
item: &Self::ItemId,
destination: &T::AccountId,
) -> DispatchResult {
Self::do_transfer(collection.clone(), *item, destination.clone(), |_, _| Ok(()))
}
}
impl<T: Config<I>, I: 'static> InspectEnumerable<T::AccountId> for Pallet<T, I> {
type CollectionsIterator = KeyPrefixIterator<<T as Config<I>>::CollectionId>;
type ItemsIterator = KeyPrefixIterator<<T as Config<I>>::ItemId>;
type OwnedIterator =
KeyPrefixIterator<(<T as Config<I>>::CollectionId, <T as Config<I>>::ItemId)>;
type OwnedInCollectionIterator = KeyPrefixIterator<<T as Config<I>>::ItemId>;
/// Returns an iterator of the collections in existence.
///
/// NOTE: iterating this list invokes a storage read per item.
fn collections() -> Self::CollectionsIterator {
CollectionMetadataOf::<T, I>::iter_keys()
}
/// Returns an iterator of the items of a `collection` in existence.
///
/// NOTE: iterating this list invokes a storage read per item.
fn items(collection: &Self::CollectionId) -> Self::ItemsIterator {
ItemMetadataOf::<T, I>::iter_key_prefix(collection)
}
/// Returns an iterator of the items of all collections owned by `who`.
///
/// NOTE: iterating this list invokes a storage read per item.
fn owned(who: &T::AccountId) -> Self::OwnedIterator {
Account::<T, I>::iter_key_prefix((who,))
}
/// Returns an iterator of the items of `collection` owned by `who`.
///
/// NOTE: iterating this list invokes a storage read per item.
fn owned_in_collection(
collection: &Self::CollectionId,
who: &T::AccountId,
) -> Self::OwnedInCollectionIterator {
Account::<T, I>::iter_key_prefix((who, collection))
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,55 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
//! Various pieces of common functionality.
use super::*;
use core::marker::PhantomData;
use pezframe_support::traits::{Get, UncheckedOnRuntimeUpgrade};
mod v1 {
use super::*;
/// Actual implementation of the storage migration.
pub struct UncheckedMigrateToV1Impl<T, I>(PhantomData<(T, I)>);
impl<T: Config<I>, I: 'static> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV1Impl<T, I> {
fn on_runtime_upgrade() -> pezframe_support::weights::Weight {
let mut count = 0;
for (collection, detail) in Collection::<T, I>::iter() {
CollectionAccount::<T, I>::insert(&detail.owner, &collection, ());
count += 1;
}
log::info!(
target: LOG_TARGET,
"Storage migration v1 for uniques finished.",
);
// calculate and return migration weights
T::DbWeight::get().reads_writes(count as u64 + 1, count as u64 + 1)
}
}
}
/// Migrate the pallet storage from `0` to `1`.
pub type MigrateV0ToV1<T, I> = pezframe_support::migrations::VersionedMigration<
0,
1,
v1::UncheckedMigrateToV1Impl<T, I>,
Pallet<T, I>,
<T as pezframe_system::Config>::DbWeight,
>;
+78
View File
@@ -0,0 +1,78 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
//! Test environment for Uniques pallet.
use super::*;
use crate as pezpallet_uniques;
use pezframe_support::{
construct_runtime, derive_impl,
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64},
};
use pezsp_runtime::BuildStorage;
type Block = pezframe_system::mocking::MockBlock<Test>;
construct_runtime!(
pub enum Test
{
System: pezframe_system,
Balances: pezpallet_balances,
Uniques: pezpallet_uniques,
}
);
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for Test {
type Block = Block;
type AccountData = pezpallet_balances::AccountData<u64>;
}
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for Test {
type AccountStore = System;
}
impl Config for Test {
type RuntimeEvent = RuntimeEvent;
type CollectionId = u32;
type ItemId = u32;
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<pezframe_system::EnsureSigned<u64>>;
type ForceOrigin = pezframe_system::EnsureRoot<u64>;
type Locker = ();
type CollectionDeposit = ConstU64<2>;
type ItemDeposit = ConstU64<1>;
type MetadataDepositBase = ConstU64<1>;
type AttributeDepositBase = ConstU64<1>;
type DepositPerByte = ConstU64<1>;
type StringLimit = ConstU32<50>;
type KeyLimit = ConstU32<50>;
type ValueLimit = ConstU32<50>;
type WeightInfo = ();
#[cfg(feature = "runtime-benchmarks")]
type Helper = ();
}
pub(crate) fn new_test_ext() -> pezsp_io::TestExternalities {
let t = pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap();
let mut ext = pezsp_io::TestExternalities::new(t);
ext.execute_with(|| System::set_block_number(1));
ext
}
File diff suppressed because it is too large Load Diff
+165
View File
@@ -0,0 +1,165 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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.
//! Various basic types for use in the Uniques pallet.
use super::*;
use pezframe_support::{
pezpallet_prelude::{BoundedVec, MaxEncodedLen},
traits::Get,
};
use scale_info::TypeInfo;
/// A type alias for handling balance deposits.
pub type DepositBalanceOf<T, I = ()> =
<<T as Config<I>>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;
/// A type alias representing the details of a collection.
pub type CollectionDetailsFor<T, I> =
CollectionDetails<<T as SystemConfig>::AccountId, DepositBalanceOf<T, I>>;
/// A type alias for the details of a single item.
pub type ItemDetailsFor<T, I> = ItemDetails<<T as SystemConfig>::AccountId, DepositBalanceOf<T, I>>;
/// A type alias to represent the price of an item.
pub type ItemPrice<T, I = ()> =
<<T as Config<I>>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
pub struct CollectionDetails<AccountId, DepositBalance> {
/// Can change `owner`, `issuer`, `freezer` and `admin` accounts.
pub owner: AccountId,
/// Can mint tokens.
pub issuer: AccountId,
/// Can thaw tokens, force transfers and burn tokens from any account.
pub admin: AccountId,
/// Can freeze tokens.
pub freezer: AccountId,
/// The total balance deposited for the all storage associated with this collection.
/// Used by `destroy`.
pub total_deposit: DepositBalance,
/// If `true`, then no deposit is needed to hold items of this collection.
pub free_holding: bool,
/// The total number of outstanding items of this collection.
pub items: u32,
/// The total number of outstanding item metadata of this collection.
pub item_metadatas: u32,
/// The total number of attributes for this collection.
pub attributes: u32,
/// Whether the collection is frozen for non-admin transfers.
pub is_frozen: bool,
}
/// Witness data for the destroy transactions.
#[derive(
Copy,
Clone,
Encode,
Decode,
DecodeWithMemTracking,
Eq,
PartialEq,
RuntimeDebug,
TypeInfo,
MaxEncodedLen,
)]
pub struct DestroyWitness {
/// The total number of outstanding items of this collection.
#[codec(compact)]
pub items: u32,
/// The total number of items in this collection that have outstanding item metadata.
#[codec(compact)]
pub item_metadatas: u32,
#[codec(compact)]
/// The total number of attributes for this collection.
pub attributes: u32,
}
impl<AccountId, DepositBalance> CollectionDetails<AccountId, DepositBalance> {
pub fn destroy_witness(&self) -> DestroyWitness {
DestroyWitness {
items: self.items,
item_metadatas: self.item_metadatas,
attributes: self.attributes,
}
}
}
/// Information concerning the ownership of a single unique item.
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo, MaxEncodedLen)]
pub struct ItemDetails<AccountId, DepositBalance> {
/// The owner of this item.
pub owner: AccountId,
/// The approved transferrer of this item, if one is set.
pub approved: Option<AccountId>,
/// Whether the item can be transferred or not.
pub is_frozen: bool,
/// The amount held in the pallet's default account for this item. Free-hold items will have
/// this as zero.
pub deposit: DepositBalance,
}
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(StringLimit))]
#[codec(mel_bound(DepositBalance: MaxEncodedLen))]
pub struct CollectionMetadata<DepositBalance, StringLimit: Get<u32>> {
/// The balance deposited for this metadata.
///
/// This pays for the data stored in this struct.
pub deposit: DepositBalance,
/// General information concerning this collection. Limited in length by `StringLimit`. This
/// will generally be either a JSON dump or the hash of some JSON which can be found on a
/// hash-addressable global publication system such as IPFS.
pub data: BoundedVec<u8, StringLimit>,
/// Whether the collection's metadata may be changed by a non Force origin.
pub is_frozen: bool,
}
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(StringLimit))]
#[codec(mel_bound(DepositBalance: MaxEncodedLen))]
pub struct ItemMetadata<DepositBalance, StringLimit: Get<u32>> {
/// The balance deposited for this metadata.
///
/// This pays for the data stored in this struct.
pub deposit: DepositBalance,
/// General information concerning this item. Limited in length by `StringLimit`. This will
/// generally be either a JSON dump or the hash of some JSON which can be found on a
/// hash-addressable global publication system such as IPFS.
pub data: BoundedVec<u8, StringLimit>,
/// Whether the item metadata may be changed by a non Force origin.
pub is_frozen: bool,
}
pub mod asset_strategies {
use super::*;
use pezframe_support::traits::tokens::asset_ops::common_strategies::{
Admin, ConfigValue, Owner, PredefinedId, WithConfig,
};
pub struct Attribute<'a>(pub &'a [u8]);
pub type CollectionManagers<AccountId> =
(ConfigValue<Owner<AccountId>>, ConfigValue<Admin<AccountId>>);
pub type WithCollectionConfig<T, I = ()> = WithConfig<
CollectionManagers<<T as pezframe_system::Config>::AccountId>,
PredefinedId<<T as Config<I>>::CollectionId>,
>;
pub type WithItemConfig<T, I = ()> = WithConfig<
ConfigValue<Owner<<T as pezframe_system::Config>::AccountId>>,
PredefinedId<(<T as Config<I>>::CollectionId, <T as Config<I>>::ItemId)>,
>;
}
+890
View File
@@ -0,0 +1,890 @@
// This file is part of Bizinikiwi.
// Copyright (C) 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 is part of Bizinikiwi.
// Copyright (C) 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 `pezpallet_uniques`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-02-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `4563561839a5`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024`
// Executed Command:
// frame-omni-bencher
// v1
// benchmark
// pallet
// --extrinsic=*
// --runtime=target/production/wbuild/kitchensink-runtime/kitchensink_runtime.wasm
// --pallet=pezpallet_uniques
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/uniques/src/weights.rs
// --wasm-execution=compiled
// --steps=50
// --repeat=20
// --heap-pages=4096
// --template=bizinikiwi/.maintain/frame-weight-template.hbs
// --no-storage-info
// --no-min-squares
// --no-median-slopes
// --genesis-builder-policy=none
// --exclude-pallets=pezpallet_xcm,pezpallet_xcm_benchmarks::fungible,pezpallet_xcm_benchmarks::generic,pezpallet_nomination_pools,pezpallet_remark,pezpallet_transaction_storage,pezpallet_election_provider_multi_block,pezpallet_election_provider_multi_block::signed,pezpallet_election_provider_multi_block::unsigned,pezpallet_election_provider_multi_block::verifier
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
#![allow(dead_code)]
use pezframe_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use core::marker::PhantomData;
/// Weight functions needed for `pezpallet_uniques`.
pub trait WeightInfo {
fn create() -> Weight;
fn force_create() -> Weight;
fn destroy(n: u32, m: u32, a: u32, ) -> Weight;
fn mint() -> Weight;
fn burn() -> Weight;
fn transfer() -> Weight;
fn redeposit(i: u32, ) -> Weight;
fn freeze() -> Weight;
fn thaw() -> Weight;
fn freeze_collection() -> Weight;
fn thaw_collection() -> Weight;
fn transfer_ownership() -> Weight;
fn set_team() -> Weight;
fn force_item_status() -> Weight;
fn set_attribute() -> Weight;
fn clear_attribute() -> Weight;
fn set_metadata() -> Weight;
fn clear_metadata() -> Weight;
fn set_collection_metadata() -> Weight;
fn clear_collection_metadata() -> Weight;
fn approve_transfer() -> Weight;
fn cancel_approval() -> Weight;
fn set_accept_ownership() -> Weight;
fn set_collection_max_supply() -> Weight;
fn set_price() -> Weight;
fn buy_item() -> Weight;
}
/// Weights for `pezpallet_uniques` using the Bizinikiwi node and recommended hardware.
pub struct BizinikiwiWeight<T>(PhantomData<T>);
impl<T: pezframe_system::Config> WeightInfo for BizinikiwiWeight<T> {
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn create() -> Weight {
// Proof Size summary in bytes:
// Measured: `52`
// Estimated: `3643`
// Minimum execution time: 23_579_000 picoseconds.
Weight::from_parts(23_892_000, 3643)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn force_create() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3643`
// Minimum execution time: 8_824_000 picoseconds.
Weight::from_parts(9_273_000, 3643)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1001 w:1000)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1000 w:1000)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1000 w:1000)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:0 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1000)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::CollectionMaxSupply` (r:0 w:1)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 1000]`.
/// The range of component `m` is `[0, 1000]`.
/// The range of component `a` is `[0, 1000]`.
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + a * (107 ±0) + m * (56 ±0) + n * (76 ±0)`
// Estimated: `3643 + a * (2647 ±0) + m * (2662 ±0) + n * (2597 ±0)`
// Minimum execution time: 3_216_909_000 picoseconds.
Weight::from_parts(3_239_261_000, 3643)
// Standard Error: 36_234
.saturating_add(Weight::from_parts(7_818_751, 0).saturating_mul(n.into()))
// Standard Error: 36_234
.saturating_add(Weight::from_parts(406_951, 0).saturating_mul(m.into()))
// Standard Error: 36_234
.saturating_add(Weight::from_parts(454_646, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into())))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into())))
.saturating_add(T::DbWeight::get().writes(4_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into())))
.saturating_add(Weight::from_parts(0, 2647).saturating_mul(a.into()))
.saturating_add(Weight::from_parts(0, 2662).saturating_mul(m.into()))
.saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into()))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::CollectionMaxSupply` (r:1 w:0)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
fn mint() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 33_268_000 picoseconds.
Weight::from_parts(33_717_000, 3643)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn burn() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 33_685_000 picoseconds.
Weight::from_parts(34_446_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:2)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 24_208_000 picoseconds.
Weight::from_parts(24_695_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:5000 w:5000)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// The range of component `i` is `[0, 5000]`.
fn redeposit(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `680 + i * (76 ±0)`
// Estimated: `3643 + i * (2597 ±0)`
// Minimum execution time: 11_501_000 picoseconds.
Weight::from_parts(11_717_000, 3643)
// Standard Error: 23_188
.saturating_add(Weight::from_parts(18_283_630, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 2597).saturating_mul(i.into()))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn freeze() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 16_069_000 picoseconds.
Weight::from_parts(16_631_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn thaw() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 15_884_000 picoseconds.
Weight::from_parts(16_431_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn freeze_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 10_389_000 picoseconds.
Weight::from_parts(10_623_000, 3643)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn thaw_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 10_392_000 picoseconds.
Weight::from_parts(10_673_000, 3643)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::OwnershipAcceptance` (r:1 w:1)
/// Proof: `Uniques::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:2)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn transfer_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `400`
// Estimated: `3643`
// Minimum execution time: 23_165_000 picoseconds.
Weight::from_parts(24_074_000, 3643)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn set_team() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 10_564_000 picoseconds.
Weight::from_parts(10_800_000, 3643)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn force_item_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 14_180_000 picoseconds.
Weight::from_parts(14_571_000, 3643)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:0)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1 w:1)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
fn set_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `501`
// Estimated: `3652`
// Minimum execution time: 36_623_000 picoseconds.
Weight::from_parts(37_377_000, 3652)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:0)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1 w:1)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
fn clear_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `698`
// Estimated: `3652`
// Minimum execution time: 35_248_000 picoseconds.
Weight::from_parts(36_162_000, 3652)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:1)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
fn set_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `290`
// Estimated: `3652`
// Minimum execution time: 26_740_000 picoseconds.
Weight::from_parts(27_339_000, 3652)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:1)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `501`
// Estimated: `3652`
// Minimum execution time: 28_165_000 picoseconds.
Weight::from_parts(28_960_000, 3652)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:1 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
fn set_collection_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 27_430_000 picoseconds.
Weight::from_parts(27_965_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:1 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
fn clear_collection_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `414`
// Estimated: `3643`
// Minimum execution time: 26_863_000 picoseconds.
Weight::from_parts(27_498_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
fn approve_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 16_303_000 picoseconds.
Weight::from_parts(16_577_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
fn cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `403`
// Estimated: `3643`
// Minimum execution time: 15_982_000 picoseconds.
Weight::from_parts(16_566_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::OwnershipAcceptance` (r:1 w:1)
/// Proof: `Uniques::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
fn set_accept_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3517`
// Minimum execution time: 9_885_000 picoseconds.
Weight::from_parts(10_204_000, 3517)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::CollectionMaxSupply` (r:1 w:1)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn set_collection_max_supply() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 13_280_000 picoseconds.
Weight::from_parts(13_587_000, 3643)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Asset` (r:1 w:0)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn set_price() -> Weight {
// Proof Size summary in bytes:
// Measured: `201`
// Estimated: `3587`
// Minimum execution time: 12_823_000 picoseconds.
Weight::from_parts(13_131_000, 3587)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:1 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:2)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
fn buy_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `482`
// Estimated: `3643`
// Minimum execution time: 32_336_000 picoseconds.
Weight::from_parts(32_973_000, 3643)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
}
// For backwards compatibility and tests.
impl WeightInfo for () {
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn create() -> Weight {
// Proof Size summary in bytes:
// Measured: `52`
// Estimated: `3643`
// Minimum execution time: 23_579_000 picoseconds.
Weight::from_parts(23_892_000, 3643)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn force_create() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3643`
// Minimum execution time: 8_824_000 picoseconds.
Weight::from_parts(9_273_000, 3643)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1001 w:1000)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1000 w:1000)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1000 w:1000)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:0 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1000)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::CollectionMaxSupply` (r:0 w:1)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 1000]`.
/// The range of component `m` is `[0, 1000]`.
/// The range of component `a` is `[0, 1000]`.
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + a * (107 ±0) + m * (56 ±0) + n * (76 ±0)`
// Estimated: `3643 + a * (2647 ±0) + m * (2662 ±0) + n * (2597 ±0)`
// Minimum execution time: 3_216_909_000 picoseconds.
Weight::from_parts(3_239_261_000, 3643)
// Standard Error: 36_234
.saturating_add(Weight::from_parts(7_818_751, 0).saturating_mul(n.into()))
// Standard Error: 36_234
.saturating_add(Weight::from_parts(406_951, 0).saturating_mul(m.into()))
// Standard Error: 36_234
.saturating_add(Weight::from_parts(454_646, 0).saturating_mul(a.into()))
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(m.into())))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(a.into())))
.saturating_add(RocksDbWeight::get().writes(4_u64))
.saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(m.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(a.into())))
.saturating_add(Weight::from_parts(0, 2647).saturating_mul(a.into()))
.saturating_add(Weight::from_parts(0, 2662).saturating_mul(m.into()))
.saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into()))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::CollectionMaxSupply` (r:1 w:0)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
fn mint() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 33_268_000 picoseconds.
Weight::from_parts(33_717_000, 3643)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn burn() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 33_685_000 picoseconds.
Weight::from_parts(34_446_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:2)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 24_208_000 picoseconds.
Weight::from_parts(24_695_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:5000 w:5000)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// The range of component `i` is `[0, 5000]`.
fn redeposit(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `680 + i * (76 ±0)`
// Estimated: `3643 + i * (2597 ±0)`
// Minimum execution time: 11_501_000 picoseconds.
Weight::from_parts(11_717_000, 3643)
// Standard Error: 23_188
.saturating_add(Weight::from_parts(18_283_630, 0).saturating_mul(i.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 2597).saturating_mul(i.into()))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn freeze() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 16_069_000 picoseconds.
Weight::from_parts(16_631_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn thaw() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 15_884_000 picoseconds.
Weight::from_parts(16_431_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn freeze_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 10_389_000 picoseconds.
Weight::from_parts(10_623_000, 3643)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn thaw_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 10_392_000 picoseconds.
Weight::from_parts(10_673_000, 3643)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::OwnershipAcceptance` (r:1 w:1)
/// Proof: `Uniques::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:2)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn transfer_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `400`
// Estimated: `3643`
// Minimum execution time: 23_165_000 picoseconds.
Weight::from_parts(24_074_000, 3643)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn set_team() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 10_564_000 picoseconds.
Weight::from_parts(10_800_000, 3643)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn force_item_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 14_180_000 picoseconds.
Weight::from_parts(14_571_000, 3643)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:0)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1 w:1)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
fn set_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `501`
// Estimated: `3652`
// Minimum execution time: 36_623_000 picoseconds.
Weight::from_parts(37_377_000, 3652)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:0)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1 w:1)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
fn clear_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `698`
// Estimated: `3652`
// Minimum execution time: 35_248_000 picoseconds.
Weight::from_parts(36_162_000, 3652)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:1)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
fn set_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `290`
// Estimated: `3652`
// Minimum execution time: 26_740_000 picoseconds.
Weight::from_parts(27_339_000, 3652)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:1)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `501`
// Estimated: `3652`
// Minimum execution time: 28_165_000 picoseconds.
Weight::from_parts(28_960_000, 3652)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:1 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
fn set_collection_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 27_430_000 picoseconds.
Weight::from_parts(27_965_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:1 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
fn clear_collection_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `414`
// Estimated: `3643`
// Minimum execution time: 26_863_000 picoseconds.
Weight::from_parts(27_498_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
fn approve_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `370`
// Estimated: `3643`
// Minimum execution time: 16_303_000 picoseconds.
Weight::from_parts(16_577_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
fn cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `403`
// Estimated: `3643`
// Minimum execution time: 15_982_000 picoseconds.
Weight::from_parts(16_566_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::OwnershipAcceptance` (r:1 w:1)
/// Proof: `Uniques::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
fn set_accept_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3517`
// Minimum execution time: 9_885_000 picoseconds.
Weight::from_parts(10_204_000, 3517)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::CollectionMaxSupply` (r:1 w:1)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn set_collection_max_supply() -> Weight {
// Proof Size summary in bytes:
// Measured: `223`
// Estimated: `3643`
// Minimum execution time: 13_280_000 picoseconds.
Weight::from_parts(13_587_000, 3643)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Asset` (r:1 w:0)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn set_price() -> Weight {
// Proof Size summary in bytes:
// Measured: `201`
// Estimated: `3587`
// Minimum execution time: 12_823_000 picoseconds.
Weight::from_parts(13_131_000, 3587)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:1 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:2)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
fn buy_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `482`
// Estimated: `3643`
// Minimum execution time: 32_336_000 picoseconds.
Weight::from_parts(32_973_000, 3643)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
}