git.delta.rocks / unique-network / refs/commits / 7fd36cea2f6e

difftreelog

refactor remove `#[transactional]` from extrinsics

Yaroslav Bolyukin2022-07-21parent: #e198017.patch.diff
in: master
Every extrinsic now runs in transaction implicitly, and
`#[transactional]` on pallet dispatchable is now meaningless

4 files changed

modifiedpallets/evm-migration/src/lib.rsdiffbeforeafterboth
--- a/pallets/evm-migration/src/lib.rs
+++ b/pallets/evm-migration/src/lib.rs
@@ -23,7 +23,7 @@
 
 #[frame_support::pallet]
 pub mod pallet {
-	use frame_support::{pallet_prelude::*, transactional};
+	use frame_support::pallet_prelude::*;
 	use frame_system::pallet_prelude::*;
 	use sp_core::{H160, H256};
 	use sp_std::vec::Vec;
@@ -84,7 +84,6 @@
 		}
 
 		#[pallet::weight(<SelfWeightOf<T>>::finish(code.len() as u32))]
-		#[transactional]
 		pub fn finish(origin: OriginFor<T>, address: H160, code: Vec<u8>) -> DispatchResult {
 			ensure_root(origin)?;
 			ensure!(
modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -145,7 +145,7 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-use frame_support::{pallet_prelude::*, transactional, BoundedVec, dispatch::DispatchResult};
+use frame_support::{pallet_prelude::*, BoundedVec, dispatch::DispatchResult};
 use frame_system::{pallet_prelude::*, ensure_signed};
 use sp_runtime::{DispatchError, Permill, traits::StaticLookup};
 use sp_std::{
@@ -350,11 +350,11 @@
 		/// * Anyone - will be assigned as the issuer of the collection.
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `metadata`: Metadata describing the collection, e.g. IPFS hash. Cannot be changed.
 		/// - `max`: Optional maximum number of tokens.
 		/// - `symbol`: UTF-8 string with token prefix, by which to represent the token in wallets and UIs.
 		/// Analogous to Unique's [`token_prefix`](up_data_structs::Collection). Cannot be changed.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::create_collection())]
 		pub fn create_collection(
 			origin: OriginFor<T>,
@@ -426,8 +426,8 @@
 		/// * Collection issuer
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `collection_id`: RMRK ID of the collection to destroy.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::destroy_collection())]
 		pub fn destroy_collection(
 			origin: OriginFor<T>,
@@ -459,9 +459,9 @@
 		/// * Collection issuer
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `collection_id`: RMRK collection ID to change the issuer of.
 		/// - `new_issuer`: Collection's new issuer.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::change_collection_issuer())]
 		pub fn change_collection_issuer(
 			origin: OriginFor<T>,
@@ -497,8 +497,8 @@
 		/// * Collection issuer
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `collection_id`: RMRK ID of the collection to lock.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::lock_collection())]
 		pub fn lock_collection(
 			origin: OriginFor<T>,
@@ -535,6 +535,7 @@
 		/// * Collection issuer
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `owner`: Owner account of the NFT. If set to None, defaults to the sender (collection issuer).
 		/// - `collection_id`: RMRK collection ID for the NFT to be minted within. Cannot be changed.
 		/// - `recipient`: Receiver account of the royalty. Has no effect if the `royalty_amount` is not set. Cannot be changed.
@@ -542,7 +543,6 @@
 		/// - `metadata`: Arbitrary data about an NFT, e.g. IPFS hash. Cannot be changed.
 		/// - `transferable`: Can this NFT be transferred? Cannot be changed.
 		/// - `resources`: Resource data to be added to the NFT immediately after minting.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::mint_nft(resources.as_ref().map(|r| r.len() as u32).unwrap_or(0)))]
 		pub fn mint_nft(
 			origin: OriginFor<T>,
@@ -620,12 +620,12 @@
 		/// * Token owner
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `collection_id`: RMRK ID of the collection in which the NFT to burn belongs to.
 		/// - `nft_id`: ID of the NFT to be destroyed.
 		/// - `max_burns`: Maximum number of tokens to burn, assuming nesting. The transaction
 		/// is reverted if there are more tokens to burn in the nesting tree than this number.
 		/// This is primarily a mechanism of transaction weight control.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::burn_nft(*max_burns))]
 		pub fn burn_nft(
 			origin: OriginFor<T>,
@@ -669,10 +669,10 @@
 		/// - Token owner
 		///
 		/// # Arguments:
-		/// - `collection_id`: RMRK ID of the collection of the NFT to be transferred.
-		/// - `nft_id`: ID of the NFT to be transferred.
+		/// - `origin`: sender of the transaction
+		/// - `rmrk_collection_id`: RMRK ID of the collection of the NFT to be transferred.
+		/// - `rmrk_nft_id`: ID of the NFT to be transferred.
 		/// - `new_owner`: New owner of the nft which can be either an account or a NFT.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::send())]
 		pub fn send(
 			origin: OriginFor<T>,
@@ -793,11 +793,11 @@
 		/// - Token-owner-to-be
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT to be accepted.
 		/// - `rmrk_nft_id`: ID of the NFT to be accepted.
 		/// - `new_owner`: Either the sender's account ID or a sender-owned NFT,
 		/// whichever the accepted NFT was sent to.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::accept_nft())]
 		pub fn accept_nft(
 			origin: OriginFor<T>,
@@ -885,9 +885,9 @@
 		/// - Token-owner-to-be-not
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK ID of the NFT to be rejected.
 		/// - `rmrk_nft_id`: ID of the NFT to be rejected.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::reject_nft())]
 		pub fn reject_nft(
 			origin: OriginFor<T>,
@@ -950,10 +950,11 @@
 		/// - Token owner
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
 		/// - `rmrk_nft_id`: ID of the NFT with a pending resource to be accepted.
 		/// - `resource_id`: ID of the newly created pending resource.
-		#[transactional]
+		/// accept the addition of a new resource to an existing NFT
 		#[pallet::weight(<SelfWeightOf<T>>::accept_resource())]
 		pub fn accept_resource(
 			origin: OriginFor<T>,
@@ -1004,10 +1005,10 @@
 		/// - Token owner
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
 		/// - `rmrk_nft_id`: ID of the NFT with a resource to be removed.
 		/// - `resource_id`: ID of the removal-pending resource.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::accept_resource_removal())]
 		pub fn accept_resource_removal(
 			origin: OriginFor<T>,
@@ -1084,11 +1085,11 @@
 		/// - Token owner - in case of NFT property
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK collection ID.
 		/// - `maybe_nft_id`: Optional ID of the NFT. If left empty, then the property is set for the collection.
 		/// - `key`: Key of the custom property to be referenced by.
 		/// - `value`: Value of the custom property to be stored.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::set_property())]
 		pub fn set_property(
 			origin: OriginFor<T>,
@@ -1158,10 +1159,10 @@
 		/// - Token owner
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
 		/// - `rmrk_nft_id`: ID of the NFT to rearrange resource priorities for.
 		/// - `priorities`: Ordered vector of resource IDs.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::set_priority())]
 		pub fn set_priority(
 			origin: OriginFor<T>,
@@ -1209,10 +1210,10 @@
 		/// the owner's [acceptance](Pallet::accept_resource).
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
 		/// - `nft_id`: ID of the NFT to assign a resource to.
 		/// - `resource`: Data of the resource to be created.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::add_basic_resource())]
 		pub fn add_basic_resource(
 			origin: OriginFor<T>,
@@ -1251,10 +1252,10 @@
 		/// the owner's [acceptance](Pallet::accept_resource).
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
 		/// - `nft_id`: ID of the NFT to assign a resource to.
 		/// - `resource`: Data of the resource to be created.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::add_composable_resource())]
 		pub fn add_composable_resource(
 			origin: OriginFor<T>,
@@ -1313,10 +1314,10 @@
 		/// the owner's [acceptance](Pallet::accept_resource).
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `rmrk_collection_id`: RMRK collection ID of the NFT.
 		/// - `nft_id`: ID of the NFT to assign a resource to.
 		/// - `resource`: Data of the resource to be created.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::add_slot_resource())]
 		pub fn add_slot_resource(
 			origin: OriginFor<T>,
@@ -1354,10 +1355,10 @@
 		/// - Collection issuer
 		///
 		/// # Arguments
-		/// - `collection_id`: RMRK ID of a collection to which the NFT making use of the resource belongs to.
+		/// - `origin`: sender of the transaction
+		/// - `rmrk_collection_id`: RMRK ID of a collection to which the NFT making use of the resource belongs to.
 		/// - `nft_id`: ID of the NFT with a resource to be removed.
 		/// - `resource_id`: ID of the resource to be removed.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::remove_resource())]
 		pub fn remove_resource(
 			origin: OriginFor<T>,
modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-equip/src/lib.rs
+++ b/pallets/proxy-rmrk-equip/src/lib.rs
@@ -133,7 +133,7 @@
 
 #![cfg_attr(not(feature = "std"), no_std)]
 
-use frame_support::{pallet_prelude::*, transactional, BoundedVec, dispatch::DispatchResult};
+use frame_support::{pallet_prelude::*, BoundedVec, dispatch::DispatchResult};
 use frame_system::{pallet_prelude::*, ensure_signed};
 use sp_runtime::DispatchError;
 use up_data_structs::*;
@@ -226,11 +226,11 @@
 		/// - Anyone - will be assigned as the issuer of the Base.
 		///
 		/// # Arguments:
+		/// - `origin`: Caller, will be assigned as the issuer of the Base
 		/// - `base_type`: Arbitrary media type, e.g. "svg".
 		/// - `symbol`: Arbitrary client-chosen symbol.
 		/// - `parts`: Array of Fixed and Slot Parts composing the Base,
 		/// confined in length by [`RmrkPartsLimit`](up_data_structs::RmrkPartsLimit).
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::create_base(parts.len() as u32))]
 		pub fn create_base(
 			origin: OriginFor<T>,
@@ -295,13 +295,13 @@
 		/// - Base issuer
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `base_id`: Base ID containing the Theme to be updated.
 		/// - `theme`: Theme to add to the Base.  A Theme has a name and properties, which are an
 		///   array of [key, value, inherit].
 		///   - `key`: Arbitrary BoundedString, defined by client.
 		///   - `value`: Arbitrary BoundedString, defined by client.
 		///   - `inherit`: Optional bool.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::theme_add(theme.properties.len() as u32))]
 		pub fn theme_add(
 			origin: OriginFor<T>,
@@ -359,10 +359,10 @@
 		/// - Base issuer
 		///
 		/// # Arguments:
+		/// - `origin`: sender of the transaction
 		/// - `base_id`: Base containing the Slot Part to be updated.
-		/// - `part_id`: Slot Part whose Equippable List is being updated.
+		/// - `slot_id`: Slot Part whose Equippable List is being updated .
 		/// - `equippables`: List of equippables that will override the current Equippables list.
-		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::equippable())]
 		pub fn equippable(
 			origin: OriginFor<T>,
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
78 dispatch::DispatchResult,78 dispatch::DispatchResult,
79 ensure, fail,79 ensure, fail,
80 weights::{Weight},80 weights::{Weight},
81 transactional,
82 pallet_prelude::{DispatchResultWithPostInfo, ConstU32},81 pallet_prelude::{DispatchResultWithPostInfo, ConstU32},
83 BoundedVec,82 BoundedVec,
84};83};
311 /// * `mode`: Type of items stored in the collection and type dependent data.310 /// * `mode`: Type of items stored in the collection and type dependent data.
312 // returns collection ID311 // returns collection ID
313 #[weight = <SelfWeightOf<T>>::create_collection()]312 #[weight = <SelfWeightOf<T>>::create_collection()]
314 #[transactional]
315 #[deprecated(note = "`create_collection_ex` is more up-to-date and advanced, prefer it instead")]313 #[deprecated(note = "`create_collection_ex` is more up-to-date and advanced, prefer it instead")]
316 pub fn create_collection(314 pub fn create_collection(
317 origin,315 origin,
342 ///340 ///
343 /// * `data`: Explicit data of a collection used for its creation.341 /// * `data`: Explicit data of a collection used for its creation.
344 #[weight = <SelfWeightOf<T>>::create_collection()]342 #[weight = <SelfWeightOf<T>>::create_collection()]
345 #[transactional]
346 pub fn create_collection_ex(origin, data: CreateCollectionData<T::AccountId>) -> DispatchResult {343 pub fn create_collection_ex(origin, data: CreateCollectionData<T::AccountId>) -> DispatchResult {
347 let sender = ensure_signed(origin)?;344 let sender = ensure_signed(origin)?;
348345
363 ///360 ///
364 /// * `collection_id`: Collection to destroy.361 /// * `collection_id`: Collection to destroy.
365 #[weight = <SelfWeightOf<T>>::destroy_collection()]362 #[weight = <SelfWeightOf<T>>::destroy_collection()]
366 #[transactional]
367 pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {363 pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
368 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);364 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
369 let collection = <CollectionHandle<T>>::try_get(collection_id)?;365 let collection = <CollectionHandle<T>>::try_get(collection_id)?;
399 /// * `collection_id`: ID of the modified collection.395 /// * `collection_id`: ID of the modified collection.
400 /// * `address`: ID of the address to be added to the allowlist.396 /// * `address`: ID of the address to be added to the allowlist.
401 #[weight = <SelfWeightOf<T>>::add_to_allow_list()]397 #[weight = <SelfWeightOf<T>>::add_to_allow_list()]
402 #[transactional]
403 pub fn add_to_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{398 pub fn add_to_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
404399
405 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);400 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
433 /// * `collection_id`: ID of the modified collection.428 /// * `collection_id`: ID of the modified collection.
434 /// * `address`: ID of the address to be removed from the allowlist.429 /// * `address`: ID of the address to be removed from the allowlist.
435 #[weight = <SelfWeightOf<T>>::remove_from_allow_list()]430 #[weight = <SelfWeightOf<T>>::remove_from_allow_list()]
436 #[transactional]
437 pub fn remove_from_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{431 pub fn remove_from_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
438432
439 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);433 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
466 /// * `collection_id`: ID of the modified collection.460 /// * `collection_id`: ID of the modified collection.
467 /// * `new_owner`: ID of the account that will become the owner.461 /// * `new_owner`: ID of the account that will become the owner.
468 #[weight = <SelfWeightOf<T>>::change_collection_owner()]462 #[weight = <SelfWeightOf<T>>::change_collection_owner()]
469 #[transactional]
470 pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {463 pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {
471464
472 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);465 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
501 /// * `collection_id`: ID of the Collection to add an admin for.494 /// * `collection_id`: ID of the Collection to add an admin for.
502 /// * `new_admin`: Address of new admin to add.495 /// * `new_admin`: Address of new admin to add.
503 #[weight = <SelfWeightOf<T>>::add_collection_admin()]496 #[weight = <SelfWeightOf<T>>::add_collection_admin()]
504 #[transactional]
505 pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin: T::CrossAccountId) -> DispatchResult {497 pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin_id: T::CrossAccountId) -> DispatchResult {
506 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);498 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
507 let collection = <CollectionHandle<T>>::try_get(collection_id)?;499 let collection = <CollectionHandle<T>>::try_get(collection_id)?;
508 collection.check_is_internal()?;500 collection.check_is_internal()?;
530 /// * `collection_id`: ID of the collection to remove the admin for.522 /// * `collection_id`: ID of the collection to remove the admin for.
531 /// * `account_id`: Address of the admin to remove.523 /// * `account_id`: Address of the admin to remove.
532 #[weight = <SelfWeightOf<T>>::remove_collection_admin()]524 #[weight = <SelfWeightOf<T>>::remove_collection_admin()]
533 #[transactional]
534 pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {525 pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {
535 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);526 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
536 let collection = <CollectionHandle<T>>::try_get(collection_id)?;527 let collection = <CollectionHandle<T>>::try_get(collection_id)?;
558 /// * `collection_id`: ID of the modified collection.549 /// * `collection_id`: ID of the modified collection.
559 /// * `new_sponsor`: ID of the account of the sponsor-to-be.550 /// * `new_sponsor`: ID of the account of the sponsor-to-be.
560 #[weight = <SelfWeightOf<T>>::set_collection_sponsor()]551 #[weight = <SelfWeightOf<T>>::set_collection_sponsor()]
561 #[transactional]
562 pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {552 pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {
563 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);553 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
564554
590 ///580 ///
591 /// * `collection_id`: ID of the collection with the pending sponsor.581 /// * `collection_id`: ID of the collection with the pending sponsor.
592 #[weight = <SelfWeightOf<T>>::confirm_sponsorship()]582 #[weight = <SelfWeightOf<T>>::confirm_sponsorship()]
593 #[transactional]
594 pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {583 pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {
595 let sender = ensure_signed(origin)?;584 let sender = ensure_signed(origin)?;
596585
619 ///608 ///
620 /// * `collection_id`: ID of the collection with the sponsor to remove.609 /// * `collection_id`: ID of the collection with the sponsor to remove.
621 #[weight = <SelfWeightOf<T>>::remove_collection_sponsor()]610 #[weight = <SelfWeightOf<T>>::remove_collection_sponsor()]
622 #[transactional]
623 pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {611 pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {
624 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);612 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
625613
654 /// * `owner`: Address of the initial owner of the item.642 /// * `owner`: Address of the initial owner of the item.
655 /// * `data`: Token data describing the item to store on chain.643 /// * `data`: Token data describing the item to store on chain.
656 #[weight = T::CommonWeightInfo::create_item()]644 #[weight = T::CommonWeightInfo::create_item()]
657 #[transactional]
658 pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResultWithPostInfo {645 pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResultWithPostInfo {
659 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);646 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
660 let budget = budget::Value::new(NESTING_BUDGET);647 let budget = budget::Value::new(NESTING_BUDGET);
681 /// * `owner`: Address of the initial owner of the tokens.668 /// * `owner`: Address of the initial owner of the tokens.
682 /// * `items_data`: Vector of data describing each item to be created.669 /// * `items_data`: Vector of data describing each item to be created.
683 #[weight = T::CommonWeightInfo::create_multiple_items(&items_data)]670 #[weight = T::CommonWeightInfo::create_multiple_items(&items_data)]
684 #[transactional]
685 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {671 pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {
686 ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);672 ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
687 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);673 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
703 /// * `properties`: Vector of key-value pairs stored as the collection's metadata.689 /// * `properties`: Vector of key-value pairs stored as the collection's metadata.
704 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.690 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.
705 #[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]691 #[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]
706 #[transactional]
707 pub fn set_collection_properties(692 pub fn set_collection_properties(
708 origin,693 origin,
709 collection_id: CollectionId,694 collection_id: CollectionId,
729 /// * `property_keys`: Vector of keys of the properties to be deleted.714 /// * `property_keys`: Vector of keys of the properties to be deleted.
730 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.715 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.
731 #[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]716 #[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]
732 #[transactional]
733 pub fn delete_collection_properties(717 pub fn delete_collection_properties(
734 origin,718 origin,
735 collection_id: CollectionId,719 collection_id: CollectionId,
761 /// * `properties`: Vector of key-value pairs stored as the token's metadata.745 /// * `properties`: Vector of key-value pairs stored as the token's metadata.
762 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.746 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.
763 #[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]747 #[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]
764 #[transactional]
765 pub fn set_token_properties(748 pub fn set_token_properties(
766 origin,749 origin,
767 collection_id: CollectionId,750 collection_id: CollectionId,
792 /// * `property_keys`: Vector of keys of the properties to be deleted.775 /// * `property_keys`: Vector of keys of the properties to be deleted.
793 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.776 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.
794 #[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]777 #[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]
795 #[transactional]
796 pub fn delete_token_properties(778 pub fn delete_token_properties(
797 origin,779 origin,
798 collection_id: CollectionId,780 collection_id: CollectionId,
823 /// * `property_permissions`: Vector of permissions for property keys.805 /// * `property_permissions`: Vector of permissions for property keys.
824 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.806 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.
825 #[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]807 #[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]
826 #[transactional]
827 pub fn set_token_property_permissions(808 pub fn set_token_property_permissions(
828 origin,809 origin,
829 collection_id: CollectionId,810 collection_id: CollectionId,
852 /// * `collection_id`: ID of the collection to which the tokens would belong.833 /// * `collection_id`: ID of the collection to which the tokens would belong.
853 /// * `data`: Explicit item creation data.834 /// * `data`: Explicit item creation data.
854 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]835 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
855 #[transactional]
856 pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {836 pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {
857 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);837 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
858 let budget = budget::Value::new(NESTING_BUDGET);838 let budget = budget::Value::new(NESTING_BUDGET);
871 /// * `collection_id`: ID of the collection.851 /// * `collection_id`: ID of the collection.
872 /// * `value`: New value of the flag, are transfers allowed?852 /// * `value`: New value of the flag, are transfers allowed?
873 #[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]853 #[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]
874 #[transactional]
875 pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {854 pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {
876 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);855 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
877 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;856 let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
901 /// * Fungible Mode: The desired number of pieces to burn.880 /// * Fungible Mode: The desired number of pieces to burn.
902 /// * Re-Fungible Mode: The desired number of pieces to burn.881 /// * Re-Fungible Mode: The desired number of pieces to burn.
903 #[weight = T::CommonWeightInfo::burn_item()]882 #[weight = T::CommonWeightInfo::burn_item()]
904 #[transactional]
905 pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {883 pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
906 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);884 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
907885
940 /// * Fungible Mode: The desired number of pieces to burn.918 /// * Fungible Mode: The desired number of pieces to burn.
941 /// * Re-Fungible Mode: The desired number of pieces to burn.919 /// * Re-Fungible Mode: The desired number of pieces to burn.
942 #[weight = T::CommonWeightInfo::burn_from()]920 #[weight = T::CommonWeightInfo::burn_from()]
943 #[transactional]
944 pub fn burn_from(origin, collection_id: CollectionId, from: T::CrossAccountId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {921 pub fn burn_from(origin, collection_id: CollectionId, from: T::CrossAccountId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
945 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);922 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
946 let budget = budget::Value::new(NESTING_BUDGET);923 let budget = budget::Value::new(NESTING_BUDGET);
970 /// * Fungible Mode: The desired number of pieces to transfer.947 /// * Fungible Mode: The desired number of pieces to transfer.
971 /// * Re-Fungible Mode: The desired number of pieces to transfer.948 /// * Re-Fungible Mode: The desired number of pieces to transfer.
972 #[weight = T::CommonWeightInfo::transfer()]949 #[weight = T::CommonWeightInfo::transfer()]
973 #[transactional]
974 pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {950 pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
975 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);951 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
976 let budget = budget::Value::new(NESTING_BUDGET);952 let budget = budget::Value::new(NESTING_BUDGET);
994 /// * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).970 /// * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).
995 /// Set to 0 to revoke the approval.971 /// Set to 0 to revoke the approval.
996 #[weight = T::CommonWeightInfo::approve()]972 #[weight = T::CommonWeightInfo::approve()]
997 #[transactional]
998 pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {973 pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {
999 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);974 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
1000975
1026 /// * Fungible Mode: The desired number of pieces to transfer.1001 /// * Fungible Mode: The desired number of pieces to transfer.
1027 /// * Re-Fungible Mode: The desired number of pieces to transfer.1002 /// * Re-Fungible Mode: The desired number of pieces to transfer.
1028 #[weight = T::CommonWeightInfo::transfer_from()]1003 #[weight = T::CommonWeightInfo::transfer_from()]
1029 #[transactional]
1030 pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResultWithPostInfo {1004 pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResultWithPostInfo {
1031 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1005 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
1032 let budget = budget::Value::new(NESTING_BUDGET);1006 let budget = budget::Value::new(NESTING_BUDGET);
1047 /// * `new_limit`: New limits of the collection. Fields that are not set (None)1021 /// * `new_limit`: New limits of the collection. Fields that are not set (None)
1048 /// will not overwrite the old ones.1022 /// will not overwrite the old ones.
1049 #[weight = <SelfWeightOf<T>>::set_collection_limits()]1023 #[weight = <SelfWeightOf<T>>::set_collection_limits()]
1050 #[transactional]
1051 pub fn set_collection_limits(1024 pub fn set_collection_limits(
1052 origin,1025 origin,
1053 collection_id: CollectionId,1026 collection_id: CollectionId,
1081 /// * `new_permission`: New permissions of the collection. Fields that are not set (None)1054 /// * `new_permission`: New permissions of the collection. Fields that are not set (None)
1082 /// will not overwrite the old ones.1055 /// will not overwrite the old ones.
1083 #[weight = <SelfWeightOf<T>>::set_collection_limits()]1056 #[weight = <SelfWeightOf<T>>::set_collection_limits()]
1084 #[transactional]
1085 pub fn set_collection_permissions(1057 pub fn set_collection_permissions(
1086 origin,1058 origin,
1087 collection_id: CollectionId,1059 collection_id: CollectionId,
1114 /// * `token_id`: ID of the RFT.1086 /// * `token_id`: ID of the RFT.
1115 /// * `amount`: New number of parts/pieces into which the token shall be partitioned.1087 /// * `amount`: New number of parts/pieces into which the token shall be partitioned.
1116 #[weight = T::RefungibleExtensionsWeightInfo::repartition()]1088 #[weight = T::RefungibleExtensionsWeightInfo::repartition()]
1117 #[transactional]
1118 pub fn repartition(1089 pub fn repartition(
1119 origin,1090 origin,
1120 collection_id: CollectionId,1091 collection_id: CollectionId,