git.delta.rocks / unique-network / refs/commits / d94f2dfdf0cf

difftreelog

source

pallets/unique/src/lib.rs44.2 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617//! # Unique Pallet18//!19//! A pallet governing Unique transactions.20//!21//! - [`Config`]22//! - [`Call`]23//! - [`Pallet`]24//!25//! ## Overview26//!27//! The Unique pallet's purpose is to be the primary interface between28//! external users and the inner structure of the Unique chains.29//!30//! It also contains an implementation of [`CollectionHelpers`][`eth`],31//! an Ethereum contract dealing with collection operations.32//!33//! ## Interface34//!35//! ### Dispatchables36//!37//! - `create_collection` - Create a collection of tokens. **Deprecated**, use `create_collection_ex`.38//! - `create_collection_ex` - Create a collection of tokens with explicit parameters.39//! - `destroy_collection` - Destroy a collection if no tokens exist within.40//! - `add_to_allow_list` - Add an address to allow list.41//! - `remove_from_allow_list` - Remove an address from allow list.42//! - `change_collection_owner` - Change the owner of the collection.43//! - `add_collection_admin` - Add an admin to a collection.44//! - `remove_collection_admin` - Remove admin of a collection.45//! - `set_collection_sponsor` - Invite a new collection sponsor.46//! - `confirm_sponsorship` - Confirm own sponsorship of a collection, becoming the sponsor.47//! - `remove_collection_sponsor` - Remove a sponsor from a collection.48//! - `create_item` - Create an item within a collection.49//! - `create_multiple_items` - Create multiple items within a collection.50//! - `set_collection_properties` - Add or change collection properties.51//! - `delete_collection_properties` - Delete specified collection properties.52//! - `set_token_properties` - Add or change token properties.53//! - `delete_token_properties` - Delete token properties.54//! - `set_token_property_permissions` - Add or change token property permissions of a collection.55//! - `create_multiple_items_ex` - Create multiple items within a collection with explicitly specified initial parameters.56//! - `set_transfers_enabled_flag` - Completely allow or disallow transfers for a particular collection.57//! - `burn_item` - Destroy an item.58//! - `burn_from` - Destroy an item on behalf of the owner as a non-owner account.59//! - `transfer` - Change ownership of the token.60//! - `transfer_from` - Change ownership of the token on behalf of the owner as a non-owner account.61//! - `approve` - Allow a non-permissioned address to transfer or burn an item.62//! - `set_collection_limits` - Set specific limits of a collection.63//! - `set_collection_permissions` - Set specific permissions of a collection.64//! - `repartition` - Re-partition a refungible token, while owning all of its parts.6566#![recursion_limit = "1024"]67#![cfg_attr(not(feature = "std"), no_std)]68#![allow(69	clippy::too_many_arguments,70	clippy::unnecessary_mut_passed,71	clippy::unused_unit72)]7374extern crate alloc;7576pub use pallet::*;77use frame_support::pallet_prelude::*;78use frame_system::pallet_prelude::*;79pub mod eth;8081#[cfg(feature = "runtime-benchmarks")]82pub mod benchmarking;83pub mod weights;8485#[frame_support::pallet]86pub mod pallet {87	use super::*;8889	use frame_support::{90		dispatch::DispatchResult,91		ensure, fail,92		weights::{Weight},93		pallet_prelude::{*},94		BoundedVec,95		storage::Key,96	};97	use frame_system::pallet_prelude::*;98	use scale_info::TypeInfo;99	use frame_system::{self as system, ensure_signed, ensure_root};100	use sp_std::{vec, vec::Vec};101	use up_data_structs::{102		MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,103		MAX_PROPERTIES_PER_ITEM, MAX_PROPERTY_KEY_LENGTH, MAX_PROPERTY_VALUE_LENGTH,104		MAX_COLLECTION_PROPERTIES_SIZE, COLLECTION_ADMINS_LIMIT, MAX_TOKEN_PROPERTIES_SIZE,105		CreateItemData, CollectionLimits, CollectionPermissions, CollectionId, CollectionMode,106		TokenId, CreateCollectionData, CreateItemExData, budget, Property, PropertyKey,107		PropertyKeyPermission,108	};109	use pallet_evm::account::CrossAccountId;110	use pallet_common::{111		CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,112		dispatch::CollectionDispatch, RefungibleExtensionsWeightInfo,113	};114	use weights::WeightInfo;115116	/// A maximum number of levels of depth in the token nesting tree.117	pub const NESTING_BUDGET: u32 = 5;118119	/// Errors for the common Unique transactions.120	#[pallet::error]121	pub enum Error<T> {122		/// Decimal_points parameter must be lower than [`up_data_structs::MAX_DECIMAL_POINTS`].123		CollectionDecimalPointLimitExceeded,124		/// Length of items properties must be greater than 0.125		EmptyArgument,126		/// Repertition is only supported by refungible collection.127		RepartitionCalledOnNonRefungibleCollection,128	}129130	/// Configuration trait of this pallet.131	#[pallet::config]132	pub trait Config: frame_system::Config + pallet_common::Config + Sized + TypeInfo {133		/// Weight information for extrinsics in this pallet.134		type WeightInfo: WeightInfo;135136		/// Weight information for common pallet operations.137		type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;138139		/// Weight info information for extra refungible pallet operations.140		type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;141	}142143	#[pallet::pallet]144	pub struct Pallet<T>(_);145146	pub type SelfWeightOf<T> = <T as Config>::WeightInfo;147148	// # Used definitions149	//150	// ## User control levels151	//152	// chain-controlled - key is uncontrolled by user153	//                    i.e autoincrementing index154	//                    can use non-cryptographic hash155	// real - key is controlled by user156	//        but it is hard to generate enough colliding values, i.e owner of signed txs157	//        can use non-cryptographic hash158	// controlled - key is completly controlled by users159	//              i.e maps with mutable keys160	//              should use cryptographic hash161	//162	// ## User control level downgrade reasons163	//164	// ?1 - chain-controlled -> controlled165	//      collections/tokens can be destroyed, resulting in massive holes166	// ?2 - chain-controlled -> controlled167	//      same as ?1, but can be only added, resulting in easier exploitation168	// ?3 - real -> controlled169	//      no confirmation required, so addresses can be easily generated170171	//#region Private members172	/// Used for migrations173	#[pallet::storage]174	pub type ChainVersion<T> = StorageValue<_, u64, ValueQuery>;175	//#endregion176177	//#region Tokens transfer sponosoring rate limit baskets178	/// (Collection id (controlled?2), who created (real))179	/// TODO: Off chain worker should remove from this map when collection gets removed180	#[pallet::storage]181	#[pallet::getter(fn create_item_busket)]182	pub type CreateItemBasket<T: Config> = StorageMap<183		Hasher = Blake2_128Concat,184		Key = (CollectionId, T::AccountId),185		Value = T::BlockNumber,186		QueryKind = OptionQuery,187	>;188	/// Collection id (controlled?2), token id (controlled?2)189	#[pallet::storage]190	#[pallet::getter(fn nft_transfer_basket)]191	pub type NftTransferBasket<T: Config> = StorageDoubleMap<192		Hasher1 = Blake2_128Concat,193		Key1 = CollectionId,194		Hasher2 = Blake2_128Concat,195		Key2 = TokenId,196		Value = T::BlockNumber,197		QueryKind = OptionQuery,198	>;199	/// Collection id (controlled?2), owning user (real)200	#[pallet::storage]201	#[pallet::getter(fn fungible_transfer_basket)]202	pub type FungibleTransferBasket<T: Config> = StorageDoubleMap<203		Hasher1 = Blake2_128Concat,204		Key1 = CollectionId,205		Hasher2 = Twox64Concat,206		Key2 = T::AccountId,207		Value = T::BlockNumber,208		QueryKind = OptionQuery,209	>;210	/// Collection id (controlled?2), token id (controlled?2)211	#[pallet::storage]212	#[pallet::getter(fn refungible_transfer_basket)]213	pub type ReFungibleTransferBasket<T: Config> = StorageNMap<214		Key = (215			Key<Blake2_128Concat, CollectionId>,216			Key<Blake2_128Concat, TokenId>,217			Key<Twox64Concat, T::AccountId>,218		),219		Value = T::BlockNumber,220		QueryKind = OptionQuery,221	>;222	//#endregion223224	/// Last sponsoring of token property setting // todo:doc rephrase this and the following225	#[pallet::storage]226	#[pallet::getter(fn token_property_basket)]227	pub type TokenPropertyBasket<T: Config> = StorageDoubleMap<228		Hasher1 = Blake2_128Concat,229		Key1 = CollectionId,230		Hasher2 = Blake2_128Concat,231		Key2 = TokenId,232		Value = T::BlockNumber,233		QueryKind = OptionQuery,234	>;235236	/// Last sponsoring of NFT approval in a collection237	#[pallet::storage]238	#[pallet::getter(fn nft_approve_basket)]239	pub type NftApproveBasket<T: Config> = StorageDoubleMap<240		Hasher1 = Blake2_128Concat,241		Key1 = CollectionId,242		Hasher2 = Blake2_128Concat,243		Key2 = TokenId,244		Value = T::BlockNumber,245		QueryKind = OptionQuery,246	>;247	/// Last sponsoring of fungible tokens approval in a collection248	#[pallet::storage]249	#[pallet::getter(fn fungible_approve_basket)]250	pub type FungibleApproveBasket<T: Config> = StorageDoubleMap<251		Hasher1 = Blake2_128Concat,252		Key1 = CollectionId,253		Hasher2 = Twox64Concat,254		Key2 = T::AccountId,255		Value = T::BlockNumber,256		QueryKind = OptionQuery,257	>;258	/// Last sponsoring of RFT approval in a collection259	#[pallet::storage]260	#[pallet::getter(fn refungible_approve_basket)]261	pub type RefungibleApproveBasket<T: Config> = StorageNMap<262		Key = (263			Key<Blake2_128Concat, CollectionId>,264			Key<Blake2_128Concat, TokenId>,265			Key<Twox64Concat, T::AccountId>,266		),267		Value = T::BlockNumber,268		QueryKind = OptionQuery,269	>;270271	#[pallet::extra_constants]272	impl<T: Config> Pallet<T> {273		/// A maximum number of levels of depth in the token nesting tree.274		fn nesting_budget() -> u32 {275			NESTING_BUDGET276		}277278		/// Maximal length of a collection name.279		fn max_collection_name_length() -> u32 {280			MAX_COLLECTION_NAME_LENGTH281		}282283		/// Maximal length of a collection description.284		fn max_collection_description_length() -> u32 {285			MAX_COLLECTION_DESCRIPTION_LENGTH286		}287288		/// Maximal length of a token prefix.289		fn max_token_prefix_length() -> u32 {290			MAX_TOKEN_PREFIX_LENGTH291		}292293		/// Maximum admins per collection.294		fn collection_admins_limit() -> u32 {295			COLLECTION_ADMINS_LIMIT296		}297298		/// Maximal length of a property key.299		fn max_property_key_length() -> u32 {300			MAX_PROPERTY_KEY_LENGTH301		}302303		/// Maximal length of a property value.304		fn max_property_value_length() -> u32 {305			MAX_PROPERTY_VALUE_LENGTH306		}307308		/// A maximum number of token properties.309		fn max_properties_per_item() -> u32 {310			MAX_PROPERTIES_PER_ITEM311		}312313		/// Maximum size for all collection properties.314		fn max_collection_properties_size() -> u32 {315			MAX_COLLECTION_PROPERTIES_SIZE316		}317318		/// Maximum size of all token properties.319		fn max_token_properties_size() -> u32 {320			MAX_TOKEN_PROPERTIES_SIZE321		}322323		/// Default NFT collection limit.324		fn nft_default_collection_limits() -> CollectionLimits {325			CollectionLimits::with_default_limits(CollectionMode::NFT)326		}327328		/// Default RFT collection limit.329		fn rft_default_collection_limits() -> CollectionLimits {330			CollectionLimits::with_default_limits(CollectionMode::ReFungible)331		}332333		/// Default FT collection limit.334		fn ft_default_collection_limits() -> CollectionLimits {335			CollectionLimits::with_default_limits(CollectionMode::Fungible(0))336		}337	}338339	/// Type alias to Pallet, to be used by construct_runtime.340	#[pallet::call]341	impl<T: Config> Pallet<T> {342		/// Create a collection of tokens.343		///344		/// Each Token may have multiple properties encoded as an array of bytes345		/// of certain length. The initial owner of the collection is set346		/// to the address that signed the transaction and can be changed later.347		///348		/// Prefer the more advanced [`create_collection_ex`][`Pallet::create_collection_ex`] instead.349		///350		/// # Permissions351		///352		/// * Anyone - becomes the owner of the new collection.353		///354		/// # Arguments355		///356		/// * `collection_name`: Wide-character string with collection name357		/// (limit [`MAX_COLLECTION_NAME_LENGTH`]).358		/// * `collection_description`: Wide-character string with collection description359		/// (limit [`MAX_COLLECTION_DESCRIPTION_LENGTH`]).360		/// * `token_prefix`: Byte string containing the token prefix to mark a collection361		/// to which a token belongs (limit [`MAX_TOKEN_PREFIX_LENGTH`]).362		/// * `mode`: Type of items stored in the collection and type dependent data.363		///364		/// returns collection ID365		///366		/// Deprecated: `create_collection_ex` is more up-to-date and advanced, prefer it instead.367		#[pallet::call_index(0)]368		#[pallet::weight(<SelfWeightOf<T>>::create_collection())]369		pub fn create_collection(370			origin: OriginFor<T>,371			collection_name: BoundedVec<u16, ConstU32<MAX_COLLECTION_NAME_LENGTH>>,372			collection_description: BoundedVec<u16, ConstU32<MAX_COLLECTION_DESCRIPTION_LENGTH>>,373			token_prefix: BoundedVec<u8, ConstU32<MAX_TOKEN_PREFIX_LENGTH>>,374			mode: CollectionMode,375		) -> DispatchResult {376			let data: CreateCollectionData<T::AccountId> = CreateCollectionData {377				name: collection_name,378				description: collection_description,379				token_prefix,380				mode,381				..Default::default()382			};383			Self::create_collection_ex(origin, data)384		}385386		/// Create a collection with explicit parameters.387		///388		/// Prefer it to the deprecated [`create_collection`][`Pallet::create_collection`] method.389		///390		/// # Permissions391		///392		/// * Anyone - becomes the owner of the new collection.393		///394		/// # Arguments395		///396		/// * `data`: Explicit data of a collection used for its creation.397		#[pallet::call_index(1)]398		#[pallet::weight(<SelfWeightOf<T>>::create_collection())]399		pub fn create_collection_ex(400			origin: OriginFor<T>,401			data: CreateCollectionData<T::AccountId>,402		) -> DispatchResult {403			let sender = ensure_signed(origin)?;404405			// =========406			let sender = T::CrossAccountId::from_sub(sender);407			let _id =408				T::CollectionDispatch::create(sender.clone(), sender, data, Default::default())?;409410			Ok(())411		}412413		/// Destroy a collection if no tokens exist within.414		///415		/// # Permissions416		///417		/// * Collection owner418		///419		/// # Arguments420		///421		/// * `collection_id`: Collection to destroy.422		#[pallet::call_index(2)]423		#[pallet::weight(<SelfWeightOf<T>>::destroy_collection())]424		pub fn destroy_collection(425			origin: OriginFor<T>,426			collection_id: CollectionId,427		) -> DispatchResult {428			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);429430			Self::destroy_collection_internal(sender, collection_id)431		}432433		/// Add an address to allow list.434		///435		/// # Permissions436		///437		/// * Collection owner438		/// * Collection admin439		///440		/// # Arguments441		///442		/// * `collection_id`: ID of the modified collection.443		/// * `address`: ID of the address to be added to the allowlist.444		#[pallet::call_index(3)]445		#[pallet::weight(<SelfWeightOf<T>>::add_to_allow_list())]446		pub fn add_to_allow_list(447			origin: OriginFor<T>,448			collection_id: CollectionId,449			address: T::CrossAccountId,450		) -> DispatchResult {451			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);452			let collection = <CollectionHandle<T>>::try_get(collection_id)?;453			collection.check_is_internal()?;454455			<PalletCommon<T>>::toggle_allowlist(&collection, &sender, &address, true)?;456457			Ok(())458		}459460		/// Remove an address from allow list.461		///462		/// # Permissions463		///464		/// * Collection owner465		/// * Collection admin466		///467		/// # Arguments468		///469		/// * `collection_id`: ID of the modified collection.470		/// * `address`: ID of the address to be removed from the allowlist.471		#[pallet::call_index(4)]472		#[pallet::weight(<SelfWeightOf<T>>::remove_from_allow_list())]473		pub fn remove_from_allow_list(474			origin: OriginFor<T>,475			collection_id: CollectionId,476			address: T::CrossAccountId,477		) -> DispatchResult {478			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);479			let collection = <CollectionHandle<T>>::try_get(collection_id)?;480			collection.check_is_internal()?;481482			<PalletCommon<T>>::toggle_allowlist(&collection, &sender, &address, false)?;483484			Ok(())485		}486487		/// Change the owner of the collection.488		///489		/// # Permissions490		///491		/// * Collection owner492		///493		/// # Arguments494		///495		/// * `collection_id`: ID of the modified collection.496		/// * `new_owner`: ID of the account that will become the owner.497		#[pallet::call_index(5)]498		#[pallet::weight(<SelfWeightOf<T>>::change_collection_owner())]499		pub fn change_collection_owner(500			origin: OriginFor<T>,501			collection_id: CollectionId,502			new_owner: T::AccountId,503		) -> DispatchResult {504			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);505			let new_owner = T::CrossAccountId::from_sub(new_owner);506			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;507			target_collection.change_owner(sender, new_owner.clone())508		}509510		/// Add an admin to a collection.511		///512		/// NFT Collection can be controlled by multiple admin addresses513		/// (some which can also be servers, for example). Admins can issue514		/// and burn NFTs, as well as add and remove other admins,515		/// but cannot change NFT or Collection ownership.516		///517		/// # Permissions518		///519		/// * Collection owner520		/// * Collection admin521		///522		/// # Arguments523		///524		/// * `collection_id`: ID of the Collection to add an admin for.525		/// * `new_admin`: Address of new admin to add.526		#[pallet::call_index(6)]527		#[pallet::weight(<SelfWeightOf<T>>::add_collection_admin())]528		pub fn add_collection_admin(529			origin: OriginFor<T>,530			collection_id: CollectionId,531			new_admin_id: T::CrossAccountId,532		) -> DispatchResult {533			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);534			let collection = <CollectionHandle<T>>::try_get(collection_id)?;535			<PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)536		}537538		/// Remove admin of a collection.539		///540		/// An admin address can remove itself. List of admins may become empty,541		/// in which case only Collection Owner will be able to add an Admin.542		///543		/// # Permissions544		///545		/// * Collection owner546		/// * Collection admin547		///548		/// # Arguments549		///550		/// * `collection_id`: ID of the collection to remove the admin for.551		/// * `account_id`: Address of the admin to remove.552		#[pallet::call_index(7)]553		#[pallet::weight(<SelfWeightOf<T>>::remove_collection_admin())]554		pub fn remove_collection_admin(555			origin: OriginFor<T>,556			collection_id: CollectionId,557			account_id: T::CrossAccountId,558		) -> DispatchResult {559			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);560			let collection = <CollectionHandle<T>>::try_get(collection_id)?;561			<PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)562		}563564		/// Set (invite) a new collection sponsor.565		///566		/// If successful, confirmation from the sponsor-to-be will be pending.567		///568		/// # Permissions569		///570		/// * Collection owner571		/// * Collection admin572		///573		/// # Arguments574		///575		/// * `collection_id`: ID of the modified collection.576		/// * `new_sponsor`: ID of the account of the sponsor-to-be.577		#[pallet::call_index(8)]578		#[pallet::weight(<SelfWeightOf<T>>::set_collection_sponsor())]579		pub fn set_collection_sponsor(580			origin: OriginFor<T>,581			collection_id: CollectionId,582			new_sponsor: T::AccountId,583		) -> DispatchResult {584			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);585			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;586			target_collection.set_sponsor(&sender, new_sponsor.clone())587		}588589		/// Confirm own sponsorship of a collection, becoming the sponsor.590		///591		/// An invitation must be pending, see [`set_collection_sponsor`][`Pallet::set_collection_sponsor`].592		/// Sponsor can pay the fees of a transaction instead of the sender,593		/// but only within specified limits.594		///595		/// # Permissions596		///597		/// * Sponsor-to-be598		///599		/// # Arguments600		///601		/// * `collection_id`: ID of the collection with the pending sponsor.602		#[pallet::call_index(9)]603		#[pallet::weight(<SelfWeightOf<T>>::confirm_sponsorship())]604		pub fn confirm_sponsorship(605			origin: OriginFor<T>,606			collection_id: CollectionId,607		) -> DispatchResult {608			let sender = ensure_signed(origin)?;609			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;610			target_collection.confirm_sponsorship(&sender)611		}612613		/// Remove a collection's a sponsor, making everyone pay for their own transactions.614		///615		/// # Permissions616		///617		/// * Collection owner618		///619		/// # Arguments620		///621		/// * `collection_id`: ID of the collection with the sponsor to remove.622		#[pallet::call_index(10)]623		#[pallet::weight(<SelfWeightOf<T>>::remove_collection_sponsor())]624		pub fn remove_collection_sponsor(625			origin: OriginFor<T>,626			collection_id: CollectionId,627		) -> DispatchResult {628			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);629			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;630			target_collection.remove_sponsor(&sender)631		}632633		/// Mint an item within a collection.634		///635		/// A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].636		///637		/// # Permissions638		///639		/// * Collection owner640		/// * Collection admin641		/// * Anyone if642		///     * Allow List is enabled, and643		///     * Address is added to allow list, and644		///     * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])645		///646		/// # Arguments647		///648		/// * `collection_id`: ID of the collection to which an item would belong.649		/// * `owner`: Address of the initial owner of the item.650		/// * `data`: Token data describing the item to store on chain.651		#[pallet::call_index(11)]652		#[pallet::weight(T::CommonWeightInfo::create_item(&data))]653		pub fn create_item(654			origin: OriginFor<T>,655			collection_id: CollectionId,656			owner: T::CrossAccountId,657			data: CreateItemData,658		) -> DispatchResultWithPostInfo {659			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);660			let budget = budget::Value::new(NESTING_BUDGET);661662			dispatch_tx::<T, _>(collection_id, |d| {663				d.create_item(sender, owner, data, &budget)664			})665		}666667		/// Create multiple items within a collection.668		///669		/// A collection must exist first, see [`create_collection_ex`][`Pallet::create_collection_ex`].670		///671		/// # Permissions672		///673		/// * Collection owner674		/// * Collection admin675		/// * Anyone if676		///     * Allow List is enabled, and677		///     * Address is added to the allow list, and678		///     * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])679		///680		/// # Arguments681		///682		/// * `collection_id`: ID of the collection to which the tokens would belong.683		/// * `owner`: Address of the initial owner of the tokens.684		/// * `items_data`: Vector of data describing each item to be created.685		#[pallet::call_index(12)]686		#[pallet::weight(T::CommonWeightInfo::create_multiple_items(&items_data))]687		pub fn create_multiple_items(688			origin: OriginFor<T>,689			collection_id: CollectionId,690			owner: T::CrossAccountId,691			items_data: Vec<CreateItemData>,692		) -> DispatchResultWithPostInfo {693			ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);694			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);695			let budget = budget::Value::new(NESTING_BUDGET);696697			dispatch_tx::<T, _>(collection_id, |d| {698				d.create_multiple_items(sender, owner, items_data, &budget)699			})700		}701702		/// Add or change collection properties.703		///704		/// # Permissions705		///706		/// * Collection owner707		/// * Collection admin708		///709		/// # Arguments710		///711		/// * `collection_id`: ID of the modified collection.712		/// * `properties`: Vector of key-value pairs stored as the collection's metadata.713		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.714		#[pallet::call_index(13)]715		#[pallet::weight(T::CommonWeightInfo::set_collection_properties(properties.len() as u32))]716		pub fn set_collection_properties(717			origin: OriginFor<T>,718			collection_id: CollectionId,719			properties: Vec<Property>,720		) -> DispatchResultWithPostInfo {721			ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);722723			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);724725			dispatch_tx::<T, _>(collection_id, |d| {726				d.set_collection_properties(sender, properties)727			})728		}729730		/// Delete specified collection properties.731		///732		/// # Permissions733		///734		/// * Collection Owner735		/// * Collection Admin736		///737		/// # Arguments738		///739		/// * `collection_id`: ID of the modified collection.740		/// * `property_keys`: Vector of keys of the properties to be deleted.741		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.742		#[pallet::call_index(14)]743		#[pallet::weight(T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32))]744		pub fn delete_collection_properties(745			origin: OriginFor<T>,746			collection_id: CollectionId,747			property_keys: Vec<PropertyKey>,748		) -> DispatchResultWithPostInfo {749			ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);750751			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);752753			dispatch_tx::<T, _>(collection_id, |d| {754				d.delete_collection_properties(&sender, property_keys)755			})756		}757758		/// Add or change token properties according to collection's permissions.759		/// Currently properties only work with NFTs.760		///761		/// # Permissions762		///763		/// * Depends on collection's token property permissions and specified property mutability:764		/// 	* Collection owner765		/// 	* Collection admin766		/// 	* Token owner767		///768		/// See [`set_token_property_permissions`][`Pallet::set_token_property_permissions`].769		///770		/// # Arguments771		///772		/// * `collection_id: ID of the collection to which the token belongs.773		/// * `token_id`: ID of the modified token.774		/// * `properties`: Vector of key-value pairs stored as the token's metadata.775		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.776		#[pallet::call_index(15)]777		#[pallet::weight(T::CommonWeightInfo::set_token_properties(properties.len() as u32))]778		pub fn set_token_properties(779			origin: OriginFor<T>,780			collection_id: CollectionId,781			token_id: TokenId,782			properties: Vec<Property>,783		) -> DispatchResultWithPostInfo {784			ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);785786			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);787			let budget = budget::Value::new(NESTING_BUDGET);788789			dispatch_tx::<T, _>(collection_id, |d| {790				d.set_token_properties(sender, token_id, properties, &budget)791			})792		}793794		/// Delete specified token properties. Currently properties only work with NFTs.795		///796		/// # Permissions797		///798		/// * Depends on collection's token property permissions and specified property mutability:799		/// 	* Collection owner800		/// 	* Collection admin801		/// 	* Token owner802		///803		/// # Arguments804		///805		/// * `collection_id`: ID of the collection to which the token belongs.806		/// * `token_id`: ID of the modified token.807		/// * `property_keys`: Vector of keys of the properties to be deleted.808		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.809		#[pallet::call_index(16)]810		#[pallet::weight(T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32))]811		pub fn delete_token_properties(812			origin: OriginFor<T>,813			collection_id: CollectionId,814			token_id: TokenId,815			property_keys: Vec<PropertyKey>,816		) -> DispatchResultWithPostInfo {817			ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);818819			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);820			let budget = budget::Value::new(NESTING_BUDGET);821822			dispatch_tx::<T, _>(collection_id, |d| {823				d.delete_token_properties(sender, token_id, property_keys, &budget)824			})825		}826827		/// Add or change token property permissions of a collection.828		///829		/// Without a permission for a particular key, a property with that key830		/// cannot be created in a token.831		///832		/// # Permissions833		///834		/// * Collection owner835		/// * Collection admin836		///837		/// # Arguments838		///839		/// * `collection_id`: ID of the modified collection.840		/// * `property_permissions`: Vector of permissions for property keys.841		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.842		#[pallet::call_index(17)]843		#[pallet::weight(T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32))]844		pub fn set_token_property_permissions(845			origin: OriginFor<T>,846			collection_id: CollectionId,847			property_permissions: Vec<PropertyKeyPermission>,848		) -> DispatchResultWithPostInfo {849			ensure!(!property_permissions.is_empty(), Error::<T>::EmptyArgument);850851			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);852853			dispatch_tx::<T, _>(collection_id, |d| {854				d.set_token_property_permissions(&sender, property_permissions)855			})856		}857858		/// Create multiple items within a collection with explicitly specified initial parameters.859		///860		/// # Permissions861		///862		/// * Collection owner863		/// * Collection admin864		/// * Anyone if865		///     * Allow List is enabled, and866		///     * Address is added to allow list, and867		///     * MintPermission is enabled (see [`set_collection_permissions`][`Pallet::set_collection_permissions`])868		///869		/// # Arguments870		///871		/// * `collection_id`: ID of the collection to which the tokens would belong.872		/// * `data`: Explicit item creation data.873		#[pallet::call_index(18)]874		#[pallet::weight(T::CommonWeightInfo::create_multiple_items_ex(&data))]875		pub fn create_multiple_items_ex(876			origin: OriginFor<T>,877			collection_id: CollectionId,878			data: CreateItemExData<T::CrossAccountId>,879		) -> DispatchResultWithPostInfo {880			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);881			let budget = budget::Value::new(NESTING_BUDGET);882883			dispatch_tx::<T, _>(collection_id, |d| {884				d.create_multiple_items_ex(sender, data, &budget)885			})886		}887888		/// Completely allow or disallow transfers for a particular collection.889		///890		/// # Permissions891		///892		/// * Collection owner893		///894		/// # Arguments895		///896		/// * `collection_id`: ID of the collection.897		/// * `value`: New value of the flag, are transfers allowed?898		#[pallet::call_index(19)]899		#[pallet::weight(<SelfWeightOf<T>>::set_transfers_enabled_flag())]900		pub fn set_transfers_enabled_flag(901			origin: OriginFor<T>,902			collection_id: CollectionId,903			value: bool,904		) -> DispatchResult {905			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);906			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;907			target_collection.check_is_internal()?;908			target_collection.check_is_owner(&sender)?;909910			// =========911912			target_collection.limits.transfers_enabled = Some(value);913			target_collection.save()914		}915916		/// Destroy an item.917		///918		/// # Permissions919		///920		/// * Collection owner921		/// * Collection admin922		/// * Current item owner923		///924		/// # Arguments925		///926		/// * `collection_id`: ID of the collection to which the item belongs.927		/// * `item_id`: ID of item to burn.928		/// * `value`: Number of pieces of the item to destroy.929		/// 	* Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.930		///     * Fungible Mode: The desired number of pieces to burn.931		///     * Re-Fungible Mode: The desired number of pieces to burn.932		#[pallet::call_index(20)]933		#[pallet::weight(T::CommonWeightInfo::burn_item())]934		pub fn burn_item(935			origin: OriginFor<T>,936			collection_id: CollectionId,937			item_id: TokenId,938			value: u128,939		) -> DispatchResultWithPostInfo {940			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);941942			let post_info =943				dispatch_tx::<T, _>(collection_id, |d| d.burn_item(sender, item_id, value))?;944			if value == 1 {945				<NftTransferBasket<T>>::remove(collection_id, item_id);946				<NftApproveBasket<T>>::remove(collection_id, item_id);947			}948			// Those maps should be cleared only if token disappears completly, need to move this part of logic to pallets?949			// <FungibleApproveBasket<T>>::remove(collection_id, sender.as_sub());950			// <RefungibleApproveBasket<T>>::remove((collection_id, item_id, sender.as_sub()));951			Ok(post_info)952		}953954		/// Destroy a token on behalf of the owner as a non-owner account.955		///956		/// See also: [`approve`][`Pallet::approve`].957		///958		/// After this method executes, one approval is removed from the total so that959		/// the approved address will not be able to transfer this item again from this owner.960		///961		/// # Permissions962		///963		/// * Collection owner964		/// * Collection admin965		/// * Current token owner966		/// * Address approved by current item owner967		///968		/// # Arguments969		///970		/// * `from`: The owner of the burning item.971		/// * `collection_id`: ID of the collection to which the item belongs.972		/// * `item_id`: ID of item to burn.973		/// * `value`: Number of pieces to burn.974		/// 	* Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.975		///     * Fungible Mode: The desired number of pieces to burn.976		///     * Re-Fungible Mode: The desired number of pieces to burn.977		#[pallet::call_index(21)]978		#[pallet::weight(T::CommonWeightInfo::burn_from())]979		pub fn burn_from(980			origin: OriginFor<T>,981			collection_id: CollectionId,982			from: T::CrossAccountId,983			item_id: TokenId,984			value: u128,985		) -> DispatchResultWithPostInfo {986			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);987			let budget = budget::Value::new(NESTING_BUDGET);988989			dispatch_tx::<T, _>(collection_id, |d| {990				d.burn_from(sender, from, item_id, value, &budget)991			})992		}993994		/// Change ownership of the token.995		///996		/// # Permissions997		///998		/// * Collection owner999		/// * Collection admin1000		/// * Current token owner1001		///1002		/// # Arguments1003		///1004		/// * `recipient`: Address of token recipient.1005		/// * `collection_id`: ID of the collection the item belongs to.1006		/// * `item_id`: ID of the item.1007		///     * Non-Fungible Mode: Required.1008		///     * Fungible Mode: Ignored.1009		///     * Re-Fungible Mode: Required.1010		///1011		/// * `value`: Amount to transfer.1012		/// 	* Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.1013		///     * Fungible Mode: The desired number of pieces to transfer.1014		///     * Re-Fungible Mode: The desired number of pieces to transfer.1015		#[pallet::call_index(22)]1016		#[pallet::weight(T::CommonWeightInfo::transfer())]1017		pub fn transfer(1018			origin: OriginFor<T>,1019			recipient: T::CrossAccountId,1020			collection_id: CollectionId,1021			item_id: TokenId,1022			value: u128,1023		) -> DispatchResultWithPostInfo {1024			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1025			let budget = budget::Value::new(NESTING_BUDGET);10261027			dispatch_tx::<T, _>(collection_id, |d| {1028				d.transfer(sender, recipient, item_id, value, &budget)1029			})1030		}10311032		/// Allow a non-permissioned address to transfer or burn an item.1033		///1034		/// # Permissions1035		///1036		/// * Collection owner1037		/// * Collection admin1038		/// * Current item owner1039		///1040		/// # Arguments1041		///1042		/// * `spender`: Account to be approved to make specific transactions on non-owned tokens.1043		/// * `collection_id`: ID of the collection the item belongs to.1044		/// * `item_id`: ID of the item transactions on which are now approved.1045		/// * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).1046		/// Set to 0 to revoke the approval.1047		#[pallet::call_index(23)]1048		#[pallet::weight(T::CommonWeightInfo::approve())]1049		pub fn approve(1050			origin: OriginFor<T>,1051			spender: T::CrossAccountId,1052			collection_id: CollectionId,1053			item_id: TokenId,1054			amount: u128,1055		) -> DispatchResultWithPostInfo {1056			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);10571058			dispatch_tx::<T, _>(collection_id, |d| {1059				d.approve(sender, spender, item_id, amount)1060			})1061		}10621063		/// Allow a non-permissioned address to transfer or burn an item from owner's eth mirror.1064		///1065		/// # Permissions1066		///1067		/// * Collection owner1068		/// * Collection admin1069		/// * Current item owner1070		///1071		/// # Arguments1072		///1073		/// * `from`: Owner's account eth mirror1074		/// * `to`: Account to be approved to make specific transactions on non-owned tokens.1075		/// * `collection_id`: ID of the collection the item belongs to.1076		/// * `item_id`: ID of the item transactions on which are now approved.1077		/// * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).1078		/// Set to 0 to revoke the approval.1079		#[pallet::call_index(24)]1080		#[pallet::weight(T::CommonWeightInfo::approve_from())]1081		pub fn approve_from(1082			origin: OriginFor<T>,1083			from: T::CrossAccountId,1084			to: T::CrossAccountId,1085			collection_id: CollectionId,1086			item_id: TokenId,1087			amount: u128,1088		) -> DispatchResultWithPostInfo {1089			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);10901091			dispatch_tx::<T, _>(collection_id, |d| {1092				d.approve_from(sender, from, to, item_id, amount)1093			})1094		}10951096		/// Change ownership of an item on behalf of the owner as a non-owner account.1097		///1098		/// See the [`approve`][`Pallet::approve`] method for additional information.1099		///1100		/// After this method executes, one approval is removed from the total so that1101		/// the approved address will not be able to transfer this item again from this owner.1102		///1103		/// # Permissions1104		///1105		/// * Collection owner1106		/// * Collection admin1107		/// * Current item owner1108		/// * Address approved by current item owner1109		///1110		/// # Arguments1111		///1112		/// * `from`: Address that currently owns the token.1113		/// * `recipient`: Address of the new token-owner-to-be.1114		/// * `collection_id`: ID of the collection the item.1115		/// * `item_id`: ID of the item to be transferred.1116		/// * `value`: Amount to transfer.1117		/// 	* Non-Fungible Mode: An NFT is indivisible, there is always 1 corresponding to an ID.1118		///     * Fungible Mode: The desired number of pieces to transfer.1119		///     * Re-Fungible Mode: The desired number of pieces to transfer.1120		#[pallet::call_index(25)]1121		#[pallet::weight(T::CommonWeightInfo::transfer_from())]1122		pub fn transfer_from(1123			origin: OriginFor<T>,1124			from: T::CrossAccountId,1125			recipient: T::CrossAccountId,1126			collection_id: CollectionId,1127			item_id: TokenId,1128			value: u128,1129		) -> DispatchResultWithPostInfo {1130			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1131			let budget = budget::Value::new(NESTING_BUDGET);11321133			dispatch_tx::<T, _>(collection_id, |d| {1134				d.transfer_from(sender, from, recipient, item_id, value, &budget)1135			})1136		}11371138		/// Set specific limits of a collection. Empty, or None fields mean chain default.1139		///1140		/// # Permissions1141		///1142		/// * Collection owner1143		/// * Collection admin1144		///1145		/// # Arguments1146		///1147		/// * `collection_id`: ID of the modified collection.1148		/// * `new_limit`: New limits of the collection. Fields that are not set (None)1149		/// will not overwrite the old ones.1150		#[pallet::call_index(26)]1151		#[pallet::weight(<SelfWeightOf<T>>::set_collection_limits())]1152		pub fn set_collection_limits(1153			origin: OriginFor<T>,1154			collection_id: CollectionId,1155			new_limit: CollectionLimits,1156		) -> DispatchResult {1157			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1158			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1159			<PalletCommon<T>>::update_limits(&sender, &mut target_collection, new_limit)1160		}11611162		/// Set specific permissions of a collection. Empty, or None fields mean chain default.1163		///1164		/// # Permissions1165		///1166		/// * Collection owner1167		/// * Collection admin1168		///1169		/// # Arguments1170		///1171		/// * `collection_id`: ID of the modified collection.1172		/// * `new_permission`: New permissions of the collection. Fields that are not set (None)1173		/// will not overwrite the old ones.1174		#[pallet::call_index(27)]1175		#[pallet::weight(<SelfWeightOf<T>>::set_collection_limits())]1176		pub fn set_collection_permissions(1177			origin: OriginFor<T>,1178			collection_id: CollectionId,1179			new_permission: CollectionPermissions,1180		) -> DispatchResult {1181			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1182			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1183			<PalletCommon<T>>::update_permissions(&sender, &mut target_collection, new_permission)1184		}11851186		/// Re-partition a refungible token, while owning all of its parts/pieces.1187		///1188		/// # Permissions1189		///1190		/// * Token owner (must own every part)1191		///1192		/// # Arguments1193		///1194		/// * `collection_id`: ID of the collection the RFT belongs to.1195		/// * `token_id`: ID of the RFT.1196		/// * `amount`: New number of parts/pieces into which the token shall be partitioned.1197		#[pallet::call_index(28)]1198		#[pallet::weight(T::RefungibleExtensionsWeightInfo::repartition())]1199		pub fn repartition(1200			origin: OriginFor<T>,1201			collection_id: CollectionId,1202			token_id: TokenId,1203			amount: u128,1204		) -> DispatchResultWithPostInfo {1205			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1206			dispatch_tx::<T, _>(collection_id, |d| {1207				if let Some(refungible_extensions) = d.refungible_extensions() {1208					refungible_extensions.repartition(&sender, token_id, amount)1209				} else {1210					fail!(<Error<T>>::RepartitionCalledOnNonRefungibleCollection)1211				}1212			})1213		}12141215		/// Sets or unsets the approval of a given operator.1216		///1217		/// The `operator` is allowed to transfer all tokens of the `owner` on their behalf.1218		///1219		/// # Arguments1220		///1221		/// * `owner`: Token owner1222		/// * `operator`: Operator1223		/// * `approve`: Should operator status be granted or revoked?1224		#[pallet::call_index(29)]1225		#[pallet::weight(T::CommonWeightInfo::set_allowance_for_all())]1226		pub fn set_allowance_for_all(1227			origin: OriginFor<T>,1228			collection_id: CollectionId,1229			operator: T::CrossAccountId,1230			approve: bool,1231		) -> DispatchResultWithPostInfo {1232			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1233			dispatch_tx::<T, _>(collection_id, |d| {1234				d.set_allowance_for_all(sender, operator, approve)1235			})1236		}12371238		/// Repairs a collection if the data was somehow corrupted.1239		///1240		/// # Arguments1241		///1242		/// * `collection_id`: ID of the collection to repair.1243		#[pallet::call_index(30)]1244		#[pallet::weight(<SelfWeightOf<T>>::force_repair_collection())]1245		pub fn force_repair_collection(1246			origin: OriginFor<T>,1247			collection_id: CollectionId,1248		) -> DispatchResult {1249			ensure_root(origin)?;1250			<PalletCommon<T>>::repair_collection(collection_id)1251		}12521253		/// Repairs a token if the data was somehow corrupted.1254		///1255		/// # Arguments1256		///1257		/// * `collection_id`: ID of the collection the item belongs to.1258		/// * `item_id`: ID of the item.1259		#[pallet::call_index(31)]1260		#[pallet::weight(T::CommonWeightInfo::force_repair_item())]1261		pub fn force_repair_item(1262			origin: OriginFor<T>,1263			collection_id: CollectionId,1264			item_id: TokenId,1265		) -> DispatchResultWithPostInfo {1266			ensure_root(origin)?;1267			dispatch_tx::<T, _>(collection_id, |d| d.repair_item(item_id))1268		}1269	}12701271	impl<T: Config> Pallet<T> {1272		/// Force set `sponsor` for `collection`.1273		///1274		/// Differs from [`set_collection_sponsor`][`Pallet::set_collection_sponsor`] in that confirmation1275		/// from the `sponsor` is not required.1276		///1277		/// # Arguments1278		///1279		/// * `sponsor`: ID of the account of the sponsor-to-be.1280		/// * `collection_id`: ID of the modified collection.1281		pub fn force_set_sponsor(1282			sponsor: T::AccountId,1283			collection_id: CollectionId,1284		) -> DispatchResult {1285			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1286			target_collection.force_set_sponsor(sponsor.clone())1287		}12881289		/// Force remove `sponsor` for `collection`.1290		///1291		/// Differs from `remove_sponsor` in that1292		/// it doesn't require consent from the `owner` of the collection.1293		///1294		/// # Arguments1295		///1296		/// * `collection_id`: ID of the modified collection.1297		pub fn force_remove_collection_sponsor(collection_id: CollectionId) -> DispatchResult {1298			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;1299			target_collection.force_remove_sponsor()1300		}13011302		#[inline(always)]1303		pub(crate) fn destroy_collection_internal(1304			sender: T::CrossAccountId,1305			collection_id: CollectionId,1306		) -> DispatchResult {1307			let collection = <CollectionHandle<T>>::try_get(collection_id)?;1308			collection.check_is_internal()?;13091310			T::CollectionDispatch::destroy(sender, collection)?;13111312			// TODO: basket cleanup should be moved elsewhere1313			// Maybe runtime dispatch.rs should perform it?13141315			let _ = <NftTransferBasket<T>>::clear_prefix(collection_id, u32::MAX, None);1316			let _ = <FungibleTransferBasket<T>>::clear_prefix(collection_id, u32::MAX, None);1317			let _ = <ReFungibleTransferBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);13181319			let _ = <NftApproveBasket<T>>::clear_prefix(collection_id, u32::MAX, None);1320			let _ = <FungibleApproveBasket<T>>::clear_prefix(collection_id, u32::MAX, None);1321			let _ = <RefungibleApproveBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);13221323			Ok(())1324		}1325	}1326}