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
before · pallets/proxy-rmrk-equip/src/lib.rs
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//! # RMRK Core Proxy Pallet18//!19//! A pallet used as proxy for RMRK Core (<https://rmrk-team.github.io/rmrk-substrate/#/pallets/rmrk-core>).20//!21//! - [`Config`]22//! - [`Call`]23//! - [`Pallet`]24//!25//! ## Overview26//!27//! The RMRK Equip Proxy pallet mirrors the functionality of RMRK Equip,28//! binding its externalities to Unique's own underlying structure.29//! It is purposed to mimic RMRK Equip exactly, allowing seamless integrations30//! of solutions based on RMRK.31//!32//! RMRK Equip itself contains functionality to equip NFTs, and work with Bases,33//! Parts, and Themes. See [Proxy Implementation](#proxy-implementation) for details.34//!35//! Equip Proxy is responsible for a more specific area of RMRK, and heavily relies on the Core.36//! For a more foundational description of proxy implementation, please refer to [`pallet_rmrk_core`].37//!38//! *Note*, that while RMRK itself is subject to active development and restructuring,39//! the proxy may be caught temporarily out of date.40//!41//! ### What is RMRK?42//!43//! RMRK is a set of NFT standards which compose several "NFT 2.0 lego" primitives.44//! Putting these legos together allows a user to create NFT systems of arbitrary complexity.45//!46//! Meaning, RMRK NFTs are dynamic, able to nest into each other and form a hierarchy,47//! make use of specific changeable and partially shared metadata in the form of resources,48//! and more.49//!50//! Visit RMRK documentation and repositories to learn more:51//! - Docs: <https://docs.rmrk.app/getting-started/>52//! - FAQ: <https://coda.io/@rmrk/faq>53//! - Substrate code repository: <https://github.com/rmrk-team/rmrk-substrate>54//! - RMRK spec repository: <https://github.com/rmrk-team/rmrk-spec>55//!56//! ## Terminology57//!58//! For more information on RMRK, see RMRK's own documentation.59//!60//! ### Intro to RMRK61//!62//! - **Resource:** Additional piece of metadata of an NFT usually serving to add63//! a piece of media on top of the root metadata (NFT's own), be it a different wing64//! on the root template bird or something entirely unrelated.65//!66//! - **Base:** A list of possible "components" - Parts, a combination of which can67//! be appended/equipped to/on an NFT.68//!69//! - **Part:** Something that, together with other Parts, can constitute an NFT.70//! Parts are defined in the Base to which they belong. Parts can be either71//! of the `slot` type or `fixed` type. Slots are intended for equippables.72//! Note that "part of something" and "Part of a Base" can be easily confused,73//! and so in this documentation these words are distinguished by the capital letter.74//!75//! - **Theme:** Named objects of variable => value pairs which get interpolated into76//! the Base's `themable` Parts. Themes can hold any value, but are often represented77//! in RMRK's examples as colors applied to visible Parts.78//!79//! ### Peculiarities in Unique80//!81//! - **Scoped properties:** Properties that are normally obscured from users.82//! Their purpose is to contain structured metadata that was not included in the Unique standard83//! for collections and tokens, meant to be operated on by proxies and other outliers.84//! Scoped property keys are prefixed with `some-scope:`, where `some-scope` is85//! an arbitrary keyword, like "rmrk". `:` is considered an unacceptable symbol in user-defined86//! properties, which, along with other safeguards, makes scoped ones impossible to tamper with.87//!88//! - **Auxiliary properties:** A slightly different structure of properties,89//! trading universality of use for more convenient storage, writes and access.90//! Meant to be inaccessible to end users.91//!92//! ## Proxy Implementation93//!94//! An external user is supposed to be able to utilize this proxy as they would95//! utilize RMRK, and get exactly the same results. Normally, Unique transactions96//! are off-limits to RMRK collections and tokens, and vice versa. However,97//! the information stored on chain can be freely interpreted by storage reads and Unique RPCs.98//!99//! ### ID Mapping100//!101//! RMRK's collections' IDs are counted independently of Unique's and start at 0.102//! Note that tokens' IDs still start at 1.103//! The collections themselves, as well as tokens, are stored as Unique collections,104//! and thus RMRK IDs are mapped to Unique IDs (but not vice versa).105//!106//! ### External/Internal Collection Insulation107//!108//! A Unique transaction cannot target collections purposed for RMRK,109//! and they are flagged as `external` to specify that. On the other hand,110//! due to the mapping, RMRK transactions and RPCs simply cannot reach Unique collections.111//!112//! ### Native Properties113//!114//! Many of RMRK's native parameters are stored as scoped properties of a collection115//! or an NFT on the chain. Scoped properties are prefixed with `rmrk:`, where `:`116//! is an unacceptable symbol in user-defined properties, which, along with other safeguards,117//! makes them impossible to tamper with.118//!119//! ### Collection and NFT Types, or Base, Parts and Themes Handling120//!121//! RMRK introduces the concept of a Base, which is a catalogue of Parts,122//! possible components of an NFT. Due to its similarity with the functionality123//! of a token collection, a Base is stored and handled as one, and the Base's Parts and Themes124//! are this collection's NFTs. See [`CollectionType`] and [`NftType`].125//!126//! ## Interface127//!128//! ### Dispatchables129//!130//! - `create_base` - Create a new Base.131//! - `theme_add` - Add a Theme to a Base.132//! - `equippable` - Update the array of Collections allowed to be equipped to a Base's specified Slot Part.133134#![cfg_attr(not(feature = "std"), no_std)]135136use frame_support::{pallet_prelude::*, transactional, BoundedVec, dispatch::DispatchResult};137use frame_system::{pallet_prelude::*, ensure_signed};138use sp_runtime::DispatchError;139use up_data_structs::*;140use pallet_common::{Pallet as PalletCommon, Error as CommonError};141use pallet_rmrk_core::{142	Pallet as PalletCore, Error as CoreError,143	misc::{self, *},144	property::RmrkProperty::*,145};146use pallet_nonfungible::{Pallet as PalletNft, NonfungibleHandle};147use pallet_evm::account::CrossAccountId;148use weights::WeightInfo;149150pub use pallet::*;151152#[cfg(feature = "runtime-benchmarks")]153pub mod benchmarking;154pub mod rpc;155pub mod weights;156157pub type SelfWeightOf<T> = <T as Config>::WeightInfo;158159#[frame_support::pallet]160pub mod pallet {161	use super::*;162163	#[pallet::config]164	pub trait Config: frame_system::Config + pallet_rmrk_core::Config {165		/// Overarching event type.166		type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;167168		/// The weight information of this pallet.169		type WeightInfo: WeightInfo;170	}171172	/// Map of a Base ID and a Part ID to an NFT in the Base collection serving as the Part.173	#[pallet::storage]174	#[pallet::getter(fn internal_part_id)]175	pub type InernalPartId<T: Config> =176		StorageDoubleMap<_, Twox64Concat, CollectionId, Twox64Concat, RmrkPartId, TokenId>;177178	/// Checkmark that a Base has a Theme NFT named "default".179	#[pallet::storage]180	#[pallet::getter(fn base_has_default_theme)]181	pub type BaseHasDefaultTheme<T: Config> =182		StorageMap<_, Twox64Concat, CollectionId, bool, ValueQuery>;183184	#[pallet::pallet]185	#[pallet::generate_store(pub(super) trait Store)]186	pub struct Pallet<T>(_);187188	#[pallet::event]189	#[pallet::generate_deposit(pub(super) fn deposit_event)]190	pub enum Event<T: Config> {191		BaseCreated {192			issuer: T::AccountId,193			base_id: RmrkBaseId,194		},195		EquippablesUpdated {196			base_id: RmrkBaseId,197			slot_id: RmrkSlotId,198		},199	}200201	#[pallet::error]202	pub enum Error<T> {203		/// No permission to perform action.204		PermissionError,205		/// Could not find an ID for a Base collection. It is likely there were too many collections created on the chain, causing an overflow.206		NoAvailableBaseId,207		/// Could not find a suitable ID for a Part, likely too many Part tokens were created in the Base, causing an overflow208		NoAvailablePartId,209		/// Base collection linked to this ID does not exist.210		BaseDoesntExist,211		/// No Theme named "default" is associated with the Base.212		NeedsDefaultThemeFirst,213		/// Part linked to this ID does not exist.214		PartDoesntExist,215		/// Cannot assign equippables to a fixed Part.216		NoEquippableOnFixedPart,217	}218219	#[pallet::call]220	impl<T: Config> Pallet<T> {221		/// Create a new Base.222		///223		/// Modeled after the [Base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)224		///225		/// # Permissions226		/// - Anyone - will be assigned as the issuer of the Base.227		///228		/// # Arguments:229		/// - `base_type`: Arbitrary media type, e.g. "svg".230		/// - `symbol`: Arbitrary client-chosen symbol.231		/// - `parts`: Array of Fixed and Slot Parts composing the Base,232		/// confined in length by [`RmrkPartsLimit`](up_data_structs::RmrkPartsLimit).233		#[transactional]234		#[pallet::weight(<SelfWeightOf<T>>::create_base(parts.len() as u32))]235		pub fn create_base(236			origin: OriginFor<T>,237			base_type: RmrkString,238			symbol: RmrkBaseSymbol,239			parts: BoundedVec<RmrkPartType, RmrkPartsLimit>,240		) -> DispatchResult {241			let sender = ensure_signed(origin)?;242			let cross_sender = T::CrossAccountId::from_sub(sender.clone());243244			let data = CreateCollectionData {245				limits: None,246				token_prefix: symbol247					.into_inner()248					.try_into()249					.map_err(|_| <CommonError<T>>::CollectionTokenPrefixLimitExceeded)?,250				..Default::default()251			};252253			let collection_id_res =254				<PalletNft<T>>::init_collection(cross_sender.clone(), data, true);255256			if let Err(DispatchError::Arithmetic(_)) = &collection_id_res {257				return Err(<Error<T>>::NoAvailableBaseId.into());258			}259260			let collection_id = collection_id_res?;261262			<PalletCommon<T>>::set_scoped_collection_properties(263				collection_id,264				PropertyScope::Rmrk,265				[266					<PalletCore<T>>::encode_rmrk_property(267						CollectionType,268						&misc::CollectionType::Base,269					)?,270					<PalletCore<T>>::encode_rmrk_property(BaseType, &base_type)?,271				]272				.into_iter(),273			)?;274275			let collection = <PalletCore<T>>::get_nft_collection(collection_id)?;276277			for part in parts {278				Self::create_part(&cross_sender, &collection, part)?;279			}280281			Self::deposit_event(Event::BaseCreated {282				issuer: sender,283				base_id: collection_id.0,284			});285286			Ok(())287		}288289		/// Add a Theme to a Base.290		/// A Theme named "default" is required prior to adding other Themes.291		///292		/// Modeled after [Themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md).293		///294		/// # Permissions:295		/// - Base issuer296		///297		/// # Arguments:298		/// - `base_id`: Base ID containing the Theme to be updated.299		/// - `theme`: Theme to add to the Base.  A Theme has a name and properties, which are an300		///   array of [key, value, inherit].301		///   - `key`: Arbitrary BoundedString, defined by client.302		///   - `value`: Arbitrary BoundedString, defined by client.303		///   - `inherit`: Optional bool.304		#[transactional]305		#[pallet::weight(<SelfWeightOf<T>>::theme_add(theme.properties.len() as u32))]306		pub fn theme_add(307			origin: OriginFor<T>,308			base_id: RmrkBaseId,309			theme: RmrkBoundedTheme,310		) -> DispatchResult {311			let sender = ensure_signed(origin)?;312313			let sender = T::CrossAccountId::from_sub(sender);314			let owner = &sender;315316			let collection_id: CollectionId = base_id.into();317318			let collection = Self::get_base(collection_id)?;319320			if theme.name.as_slice() == b"default" {321				<BaseHasDefaultTheme<T>>::insert(collection_id, true);322			} else if !Self::base_has_default_theme(collection_id) {323				return Err(<Error<T>>::NeedsDefaultThemeFirst.into());324			}325326			let token_id = <PalletCore<T>>::create_nft(327				&sender,328				owner,329				&collection,330				[331					<PalletCore<T>>::encode_rmrk_property(TokenType, &NftType::Theme)?,332					<PalletCore<T>>::encode_rmrk_property(ThemeName, &theme.name)?,333					<PalletCore<T>>::encode_rmrk_property(ThemeInherit, &theme.inherit)?,334				]335				.into_iter(),336			)337			.map_err(|_| <Error<T>>::PermissionError)?;338339			for property in theme.properties {340				<PalletNft<T>>::set_scoped_token_property(341					collection_id,342					token_id,343					PropertyScope::Rmrk,344					<PalletCore<T>>::encode_rmrk_property(345						UserProperty(property.key.as_slice()),346						&property.value,347					)?,348				)?;349			}350351			Ok(())352		}353354		/// Update the array of Collections allowed to be equipped to a Base's specified Slot Part.355		///356		/// Modeled after [equippable interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/equippable.md).357		///358		/// # Permissions:359		/// - Base issuer360		///361		/// # Arguments:362		/// - `base_id`: Base containing the Slot Part to be updated.363		/// - `part_id`: Slot Part whose Equippable List is being updated.364		/// - `equippables`: List of equippables that will override the current Equippables list.365		#[transactional]366		#[pallet::weight(<SelfWeightOf<T>>::equippable())]367		pub fn equippable(368			origin: OriginFor<T>,369			base_id: RmrkBaseId,370			slot_id: RmrkSlotId,371			equippables: RmrkEquippableList,372		) -> DispatchResult {373			let sender = ensure_signed(origin)?;374375			let base_collection_id = base_id.into();376			let collection = Self::get_base(base_collection_id)?;377378			<PalletCore<T>>::check_collection_owner(379				&collection,380				&T::CrossAccountId::from_sub(sender),381			)382			.map_err(|err| {383				if err == <CoreError<T>>::NoPermission.into() {384					<Error<T>>::PermissionError.into()385				} else {386					err387				}388			})?;389390			let part_id = Self::internal_part_id(base_collection_id, slot_id)391				.ok_or(<Error<T>>::PartDoesntExist)?;392393			let nft_type = <PalletCore<T>>::get_nft_type(base_collection_id, part_id)394				.map_err(|_| <Error<T>>::PartDoesntExist)?;395396			match nft_type {397				NftType::Regular | NftType::Theme => return Err(<Error<T>>::PermissionError.into()),398				NftType::FixedPart => return Err(<Error<T>>::NoEquippableOnFixedPart.into()),399				NftType::SlotPart => {400					<PalletNft<T>>::set_scoped_token_property(401						base_collection_id,402						part_id,403						PropertyScope::Rmrk,404						<PalletCore<T>>::encode_rmrk_property(EquippableList, &equippables)?,405					)?;406				}407			}408409			Self::deposit_event(Event::EquippablesUpdated { base_id, slot_id });410411			Ok(())412		}413	}414}415416impl<T: Config> Pallet<T> {417	/// Create (or overwrite) a Part in a Base.418	/// The Part and the Base are represented as an NFT and a Collection.419	fn create_part(420		sender: &T::CrossAccountId,421		collection: &NonfungibleHandle<T>,422		part: RmrkPartType,423	) -> DispatchResult {424		let owner = sender;425426		let part_id = part.id();427		let src = part.src();428		let z_index = part.z_index();429430		let nft_type = match part {431			RmrkPartType::FixedPart(_) => NftType::FixedPart,432			RmrkPartType::SlotPart(_) => NftType::SlotPart,433		};434435		let token_id = match Self::internal_part_id(collection.id, part_id) {436			Some(token_id) => token_id,437			None => {438				let token_id =439					<PalletCore<T>>::create_nft(sender, owner, collection, [].into_iter())440						.map_err(|err| match err {441							DispatchError::Arithmetic(_) => <Error<T>>::NoAvailablePartId.into(),442							err => err,443						})?;444445				<InernalPartId<T>>::insert(collection.id, part_id, token_id);446447				<PalletNft<T>>::set_scoped_token_property(448					collection.id,449					token_id,450					PropertyScope::Rmrk,451					<PalletCore<T>>::encode_rmrk_property(ExternalPartId, &part_id)?,452				)?;453454				token_id455			}456		};457458		<PalletNft<T>>::set_scoped_token_properties(459			collection.id,460			token_id,461			PropertyScope::Rmrk,462			[463				<PalletCore<T>>::encode_rmrk_property(TokenType, &nft_type)?,464				<PalletCore<T>>::encode_rmrk_property(Src, &src)?,465				<PalletCore<T>>::encode_rmrk_property(ZIndex, &z_index)?,466			]467			.into_iter(),468		)?;469470		if let RmrkPartType::SlotPart(part) = part {471			<PalletNft<T>>::set_scoped_token_property(472				collection.id,473				token_id,474				PropertyScope::Rmrk,475				<PalletCore<T>>::encode_rmrk_property(EquippableList, &part.equippable)?,476			)?;477		}478479		Ok(())480	}481482	/// Ensure that the collection under the Base ID is a Base collection,483	/// and fetch it.484	fn get_base(base_id: CollectionId) -> Result<NonfungibleHandle<T>, DispatchError> {485		let collection =486			<PalletCore<T>>::get_typed_nft_collection(base_id, misc::CollectionType::Base)487				.map_err(|err| {488					if err == <CoreError<T>>::CollectionUnknown.into() {489						<Error<T>>::BaseDoesntExist.into()490					} else {491						err492					}493				})?;494		collection.check_is_external()?;495496		Ok(collection)497	}498}
after · pallets/proxy-rmrk-equip/src/lib.rs
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//! # RMRK Core Proxy Pallet18//!19//! A pallet used as proxy for RMRK Core (<https://rmrk-team.github.io/rmrk-substrate/#/pallets/rmrk-core>).20//!21//! - [`Config`]22//! - [`Call`]23//! - [`Pallet`]24//!25//! ## Overview26//!27//! The RMRK Equip Proxy pallet mirrors the functionality of RMRK Equip,28//! binding its externalities to Unique's own underlying structure.29//! It is purposed to mimic RMRK Equip exactly, allowing seamless integrations30//! of solutions based on RMRK.31//!32//! RMRK Equip itself contains functionality to equip NFTs, and work with Bases,33//! Parts, and Themes. See [Proxy Implementation](#proxy-implementation) for details.34//!35//! Equip Proxy is responsible for a more specific area of RMRK, and heavily relies on the Core.36//! For a more foundational description of proxy implementation, please refer to [`pallet_rmrk_core`].37//!38//! *Note*, that while RMRK itself is subject to active development and restructuring,39//! the proxy may be caught temporarily out of date.40//!41//! ### What is RMRK?42//!43//! RMRK is a set of NFT standards which compose several "NFT 2.0 lego" primitives.44//! Putting these legos together allows a user to create NFT systems of arbitrary complexity.45//!46//! Meaning, RMRK NFTs are dynamic, able to nest into each other and form a hierarchy,47//! make use of specific changeable and partially shared metadata in the form of resources,48//! and more.49//!50//! Visit RMRK documentation and repositories to learn more:51//! - Docs: <https://docs.rmrk.app/getting-started/>52//! - FAQ: <https://coda.io/@rmrk/faq>53//! - Substrate code repository: <https://github.com/rmrk-team/rmrk-substrate>54//! - RMRK spec repository: <https://github.com/rmrk-team/rmrk-spec>55//!56//! ## Terminology57//!58//! For more information on RMRK, see RMRK's own documentation.59//!60//! ### Intro to RMRK61//!62//! - **Resource:** Additional piece of metadata of an NFT usually serving to add63//! a piece of media on top of the root metadata (NFT's own), be it a different wing64//! on the root template bird or something entirely unrelated.65//!66//! - **Base:** A list of possible "components" - Parts, a combination of which can67//! be appended/equipped to/on an NFT.68//!69//! - **Part:** Something that, together with other Parts, can constitute an NFT.70//! Parts are defined in the Base to which they belong. Parts can be either71//! of the `slot` type or `fixed` type. Slots are intended for equippables.72//! Note that "part of something" and "Part of a Base" can be easily confused,73//! and so in this documentation these words are distinguished by the capital letter.74//!75//! - **Theme:** Named objects of variable => value pairs which get interpolated into76//! the Base's `themable` Parts. Themes can hold any value, but are often represented77//! in RMRK's examples as colors applied to visible Parts.78//!79//! ### Peculiarities in Unique80//!81//! - **Scoped properties:** Properties that are normally obscured from users.82//! Their purpose is to contain structured metadata that was not included in the Unique standard83//! for collections and tokens, meant to be operated on by proxies and other outliers.84//! Scoped property keys are prefixed with `some-scope:`, where `some-scope` is85//! an arbitrary keyword, like "rmrk". `:` is considered an unacceptable symbol in user-defined86//! properties, which, along with other safeguards, makes scoped ones impossible to tamper with.87//!88//! - **Auxiliary properties:** A slightly different structure of properties,89//! trading universality of use for more convenient storage, writes and access.90//! Meant to be inaccessible to end users.91//!92//! ## Proxy Implementation93//!94//! An external user is supposed to be able to utilize this proxy as they would95//! utilize RMRK, and get exactly the same results. Normally, Unique transactions96//! are off-limits to RMRK collections and tokens, and vice versa. However,97//! the information stored on chain can be freely interpreted by storage reads and Unique RPCs.98//!99//! ### ID Mapping100//!101//! RMRK's collections' IDs are counted independently of Unique's and start at 0.102//! Note that tokens' IDs still start at 1.103//! The collections themselves, as well as tokens, are stored as Unique collections,104//! and thus RMRK IDs are mapped to Unique IDs (but not vice versa).105//!106//! ### External/Internal Collection Insulation107//!108//! A Unique transaction cannot target collections purposed for RMRK,109//! and they are flagged as `external` to specify that. On the other hand,110//! due to the mapping, RMRK transactions and RPCs simply cannot reach Unique collections.111//!112//! ### Native Properties113//!114//! Many of RMRK's native parameters are stored as scoped properties of a collection115//! or an NFT on the chain. Scoped properties are prefixed with `rmrk:`, where `:`116//! is an unacceptable symbol in user-defined properties, which, along with other safeguards,117//! makes them impossible to tamper with.118//!119//! ### Collection and NFT Types, or Base, Parts and Themes Handling120//!121//! RMRK introduces the concept of a Base, which is a catalogue of Parts,122//! possible components of an NFT. Due to its similarity with the functionality123//! of a token collection, a Base is stored and handled as one, and the Base's Parts and Themes124//! are this collection's NFTs. See [`CollectionType`] and [`NftType`].125//!126//! ## Interface127//!128//! ### Dispatchables129//!130//! - `create_base` - Create a new Base.131//! - `theme_add` - Add a Theme to a Base.132//! - `equippable` - Update the array of Collections allowed to be equipped to a Base's specified Slot Part.133134#![cfg_attr(not(feature = "std"), no_std)]135136use frame_support::{pallet_prelude::*, BoundedVec, dispatch::DispatchResult};137use frame_system::{pallet_prelude::*, ensure_signed};138use sp_runtime::DispatchError;139use up_data_structs::*;140use pallet_common::{Pallet as PalletCommon, Error as CommonError};141use pallet_rmrk_core::{142	Pallet as PalletCore, Error as CoreError,143	misc::{self, *},144	property::RmrkProperty::*,145};146use pallet_nonfungible::{Pallet as PalletNft, NonfungibleHandle};147use pallet_evm::account::CrossAccountId;148use weights::WeightInfo;149150pub use pallet::*;151152#[cfg(feature = "runtime-benchmarks")]153pub mod benchmarking;154pub mod rpc;155pub mod weights;156157pub type SelfWeightOf<T> = <T as Config>::WeightInfo;158159#[frame_support::pallet]160pub mod pallet {161	use super::*;162163	#[pallet::config]164	pub trait Config: frame_system::Config + pallet_rmrk_core::Config {165		/// Overarching event type.166		type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;167168		/// The weight information of this pallet.169		type WeightInfo: WeightInfo;170	}171172	/// Map of a Base ID and a Part ID to an NFT in the Base collection serving as the Part.173	#[pallet::storage]174	#[pallet::getter(fn internal_part_id)]175	pub type InernalPartId<T: Config> =176		StorageDoubleMap<_, Twox64Concat, CollectionId, Twox64Concat, RmrkPartId, TokenId>;177178	/// Checkmark that a Base has a Theme NFT named "default".179	#[pallet::storage]180	#[pallet::getter(fn base_has_default_theme)]181	pub type BaseHasDefaultTheme<T: Config> =182		StorageMap<_, Twox64Concat, CollectionId, bool, ValueQuery>;183184	#[pallet::pallet]185	#[pallet::generate_store(pub(super) trait Store)]186	pub struct Pallet<T>(_);187188	#[pallet::event]189	#[pallet::generate_deposit(pub(super) fn deposit_event)]190	pub enum Event<T: Config> {191		BaseCreated {192			issuer: T::AccountId,193			base_id: RmrkBaseId,194		},195		EquippablesUpdated {196			base_id: RmrkBaseId,197			slot_id: RmrkSlotId,198		},199	}200201	#[pallet::error]202	pub enum Error<T> {203		/// No permission to perform action.204		PermissionError,205		/// Could not find an ID for a Base collection. It is likely there were too many collections created on the chain, causing an overflow.206		NoAvailableBaseId,207		/// Could not find a suitable ID for a Part, likely too many Part tokens were created in the Base, causing an overflow208		NoAvailablePartId,209		/// Base collection linked to this ID does not exist.210		BaseDoesntExist,211		/// No Theme named "default" is associated with the Base.212		NeedsDefaultThemeFirst,213		/// Part linked to this ID does not exist.214		PartDoesntExist,215		/// Cannot assign equippables to a fixed Part.216		NoEquippableOnFixedPart,217	}218219	#[pallet::call]220	impl<T: Config> Pallet<T> {221		/// Create a new Base.222		///223		/// Modeled after the [Base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)224		///225		/// # Permissions226		/// - Anyone - will be assigned as the issuer of the Base.227		///228		/// # Arguments:229		/// - `origin`: Caller, will be assigned as the issuer of the Base230		/// - `base_type`: Arbitrary media type, e.g. "svg".231		/// - `symbol`: Arbitrary client-chosen symbol.232		/// - `parts`: Array of Fixed and Slot Parts composing the Base,233		/// confined in length by [`RmrkPartsLimit`](up_data_structs::RmrkPartsLimit).234		#[pallet::weight(<SelfWeightOf<T>>::create_base(parts.len() as u32))]235		pub fn create_base(236			origin: OriginFor<T>,237			base_type: RmrkString,238			symbol: RmrkBaseSymbol,239			parts: BoundedVec<RmrkPartType, RmrkPartsLimit>,240		) -> DispatchResult {241			let sender = ensure_signed(origin)?;242			let cross_sender = T::CrossAccountId::from_sub(sender.clone());243244			let data = CreateCollectionData {245				limits: None,246				token_prefix: symbol247					.into_inner()248					.try_into()249					.map_err(|_| <CommonError<T>>::CollectionTokenPrefixLimitExceeded)?,250				..Default::default()251			};252253			let collection_id_res =254				<PalletNft<T>>::init_collection(cross_sender.clone(), data, true);255256			if let Err(DispatchError::Arithmetic(_)) = &collection_id_res {257				return Err(<Error<T>>::NoAvailableBaseId.into());258			}259260			let collection_id = collection_id_res?;261262			<PalletCommon<T>>::set_scoped_collection_properties(263				collection_id,264				PropertyScope::Rmrk,265				[266					<PalletCore<T>>::encode_rmrk_property(267						CollectionType,268						&misc::CollectionType::Base,269					)?,270					<PalletCore<T>>::encode_rmrk_property(BaseType, &base_type)?,271				]272				.into_iter(),273			)?;274275			let collection = <PalletCore<T>>::get_nft_collection(collection_id)?;276277			for part in parts {278				Self::create_part(&cross_sender, &collection, part)?;279			}280281			Self::deposit_event(Event::BaseCreated {282				issuer: sender,283				base_id: collection_id.0,284			});285286			Ok(())287		}288289		/// Add a Theme to a Base.290		/// A Theme named "default" is required prior to adding other Themes.291		///292		/// Modeled after [Themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md).293		///294		/// # Permissions:295		/// - Base issuer296		///297		/// # Arguments:298		/// - `origin`: sender of the transaction299		/// - `base_id`: Base ID containing the Theme to be updated.300		/// - `theme`: Theme to add to the Base.  A Theme has a name and properties, which are an301		///   array of [key, value, inherit].302		///   - `key`: Arbitrary BoundedString, defined by client.303		///   - `value`: Arbitrary BoundedString, defined by client.304		///   - `inherit`: Optional bool.305		#[pallet::weight(<SelfWeightOf<T>>::theme_add(theme.properties.len() as u32))]306		pub fn theme_add(307			origin: OriginFor<T>,308			base_id: RmrkBaseId,309			theme: RmrkBoundedTheme,310		) -> DispatchResult {311			let sender = ensure_signed(origin)?;312313			let sender = T::CrossAccountId::from_sub(sender);314			let owner = &sender;315316			let collection_id: CollectionId = base_id.into();317318			let collection = Self::get_base(collection_id)?;319320			if theme.name.as_slice() == b"default" {321				<BaseHasDefaultTheme<T>>::insert(collection_id, true);322			} else if !Self::base_has_default_theme(collection_id) {323				return Err(<Error<T>>::NeedsDefaultThemeFirst.into());324			}325326			let token_id = <PalletCore<T>>::create_nft(327				&sender,328				owner,329				&collection,330				[331					<PalletCore<T>>::encode_rmrk_property(TokenType, &NftType::Theme)?,332					<PalletCore<T>>::encode_rmrk_property(ThemeName, &theme.name)?,333					<PalletCore<T>>::encode_rmrk_property(ThemeInherit, &theme.inherit)?,334				]335				.into_iter(),336			)337			.map_err(|_| <Error<T>>::PermissionError)?;338339			for property in theme.properties {340				<PalletNft<T>>::set_scoped_token_property(341					collection_id,342					token_id,343					PropertyScope::Rmrk,344					<PalletCore<T>>::encode_rmrk_property(345						UserProperty(property.key.as_slice()),346						&property.value,347					)?,348				)?;349			}350351			Ok(())352		}353354		/// Update the array of Collections allowed to be equipped to a Base's specified Slot Part.355		///356		/// Modeled after [equippable interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/equippable.md).357		///358		/// # Permissions:359		/// - Base issuer360		///361		/// # Arguments:362		/// - `origin`: sender of the transaction363		/// - `base_id`: Base containing the Slot Part to be updated.364		/// - `slot_id`: Slot Part whose Equippable List is being updated .365		/// - `equippables`: List of equippables that will override the current Equippables list.366		#[pallet::weight(<SelfWeightOf<T>>::equippable())]367		pub fn equippable(368			origin: OriginFor<T>,369			base_id: RmrkBaseId,370			slot_id: RmrkSlotId,371			equippables: RmrkEquippableList,372		) -> DispatchResult {373			let sender = ensure_signed(origin)?;374375			let base_collection_id = base_id.into();376			let collection = Self::get_base(base_collection_id)?;377378			<PalletCore<T>>::check_collection_owner(379				&collection,380				&T::CrossAccountId::from_sub(sender),381			)382			.map_err(|err| {383				if err == <CoreError<T>>::NoPermission.into() {384					<Error<T>>::PermissionError.into()385				} else {386					err387				}388			})?;389390			let part_id = Self::internal_part_id(base_collection_id, slot_id)391				.ok_or(<Error<T>>::PartDoesntExist)?;392393			let nft_type = <PalletCore<T>>::get_nft_type(base_collection_id, part_id)394				.map_err(|_| <Error<T>>::PartDoesntExist)?;395396			match nft_type {397				NftType::Regular | NftType::Theme => return Err(<Error<T>>::PermissionError.into()),398				NftType::FixedPart => return Err(<Error<T>>::NoEquippableOnFixedPart.into()),399				NftType::SlotPart => {400					<PalletNft<T>>::set_scoped_token_property(401						base_collection_id,402						part_id,403						PropertyScope::Rmrk,404						<PalletCore<T>>::encode_rmrk_property(EquippableList, &equippables)?,405					)?;406				}407			}408409			Self::deposit_event(Event::EquippablesUpdated { base_id, slot_id });410411			Ok(())412		}413	}414}415416impl<T: Config> Pallet<T> {417	/// Create (or overwrite) a Part in a Base.418	/// The Part and the Base are represented as an NFT and a Collection.419	fn create_part(420		sender: &T::CrossAccountId,421		collection: &NonfungibleHandle<T>,422		part: RmrkPartType,423	) -> DispatchResult {424		let owner = sender;425426		let part_id = part.id();427		let src = part.src();428		let z_index = part.z_index();429430		let nft_type = match part {431			RmrkPartType::FixedPart(_) => NftType::FixedPart,432			RmrkPartType::SlotPart(_) => NftType::SlotPart,433		};434435		let token_id = match Self::internal_part_id(collection.id, part_id) {436			Some(token_id) => token_id,437			None => {438				let token_id =439					<PalletCore<T>>::create_nft(sender, owner, collection, [].into_iter())440						.map_err(|err| match err {441							DispatchError::Arithmetic(_) => <Error<T>>::NoAvailablePartId.into(),442							err => err,443						})?;444445				<InernalPartId<T>>::insert(collection.id, part_id, token_id);446447				<PalletNft<T>>::set_scoped_token_property(448					collection.id,449					token_id,450					PropertyScope::Rmrk,451					<PalletCore<T>>::encode_rmrk_property(ExternalPartId, &part_id)?,452				)?;453454				token_id455			}456		};457458		<PalletNft<T>>::set_scoped_token_properties(459			collection.id,460			token_id,461			PropertyScope::Rmrk,462			[463				<PalletCore<T>>::encode_rmrk_property(TokenType, &nft_type)?,464				<PalletCore<T>>::encode_rmrk_property(Src, &src)?,465				<PalletCore<T>>::encode_rmrk_property(ZIndex, &z_index)?,466			]467			.into_iter(),468		)?;469470		if let RmrkPartType::SlotPart(part) = part {471			<PalletNft<T>>::set_scoped_token_property(472				collection.id,473				token_id,474				PropertyScope::Rmrk,475				<PalletCore<T>>::encode_rmrk_property(EquippableList, &part.equippable)?,476			)?;477		}478479		Ok(())480	}481482	/// Ensure that the collection under the Base ID is a Base collection,483	/// and fetch it.484	fn get_base(base_id: CollectionId) -> Result<NonfungibleHandle<T>, DispatchError> {485		let collection =486			<PalletCore<T>>::get_typed_nft_collection(base_id, misc::CollectionType::Base)487				.map_err(|err| {488					if err == <CoreError<T>>::CollectionUnknown.into() {489						<Error<T>>::BaseDoesntExist.into()490					} else {491						err492					}493				})?;494		collection.check_is_external()?;495496		Ok(collection)497	}498}
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -78,7 +78,6 @@
 	dispatch::DispatchResult,
 	ensure, fail,
 	weights::{Weight},
-	transactional,
 	pallet_prelude::{DispatchResultWithPostInfo, ConstU32},
 	BoundedVec,
 };
@@ -311,7 +310,6 @@
 		/// * `mode`: Type of items stored in the collection and type dependent data.
 		// returns collection ID
 		#[weight = <SelfWeightOf<T>>::create_collection()]
-		#[transactional]
 		#[deprecated(note = "`create_collection_ex` is more up-to-date and advanced, prefer it instead")]
 		pub fn create_collection(
 			origin,
@@ -342,7 +340,6 @@
 		///
 		/// * `data`: Explicit data of a collection used for its creation.
 		#[weight = <SelfWeightOf<T>>::create_collection()]
-		#[transactional]
 		pub fn create_collection_ex(origin, data: CreateCollectionData<T::AccountId>) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
 
@@ -363,7 +360,6 @@
 		///
 		/// * `collection_id`: Collection to destroy.
 		#[weight = <SelfWeightOf<T>>::destroy_collection()]
-		#[transactional]
 		pub fn destroy_collection(origin, collection_id: CollectionId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let collection = <CollectionHandle<T>>::try_get(collection_id)?;
@@ -399,7 +395,6 @@
 		/// * `collection_id`: ID of the modified collection.
 		/// * `address`: ID of the address to be added to the allowlist.
 		#[weight = <SelfWeightOf<T>>::add_to_allow_list()]
-		#[transactional]
 		pub fn add_to_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
 
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -433,7 +428,6 @@
 		/// * `collection_id`: ID of the modified collection.
 		/// * `address`: ID of the address to be removed from the allowlist.
 		#[weight = <SelfWeightOf<T>>::remove_from_allow_list()]
-		#[transactional]
 		pub fn remove_from_allow_list(origin, collection_id: CollectionId, address: T::CrossAccountId) -> DispatchResult{
 
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -466,7 +460,6 @@
 		/// * `collection_id`: ID of the modified collection.
 		/// * `new_owner`: ID of the account that will become the owner.
 		#[weight = <SelfWeightOf<T>>::change_collection_owner()]
-		#[transactional]
 		pub fn change_collection_owner(origin, collection_id: CollectionId, new_owner: T::AccountId) -> DispatchResult {
 
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -501,8 +494,7 @@
 		/// * `collection_id`: ID of the Collection to add an admin for.
 		/// * `new_admin`: Address of new admin to add.
 		#[weight = <SelfWeightOf<T>>::add_collection_admin()]
-		#[transactional]
-		pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin: T::CrossAccountId) -> DispatchResult {
+		pub fn add_collection_admin(origin, collection_id: CollectionId, new_admin_id: T::CrossAccountId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let collection = <CollectionHandle<T>>::try_get(collection_id)?;
 			collection.check_is_internal()?;
@@ -530,7 +522,6 @@
 		/// * `collection_id`: ID of the collection to remove the admin for.
 		/// * `account_id`: Address of the admin to remove.
 		#[weight = <SelfWeightOf<T>>::remove_collection_admin()]
-		#[transactional]
 		pub fn remove_collection_admin(origin, collection_id: CollectionId, account_id: T::CrossAccountId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let collection = <CollectionHandle<T>>::try_get(collection_id)?;
@@ -558,7 +549,6 @@
 		/// * `collection_id`: ID of the modified collection.
 		/// * `new_sponsor`: ID of the account of the sponsor-to-be.
 		#[weight = <SelfWeightOf<T>>::set_collection_sponsor()]
-		#[transactional]
 		pub fn set_collection_sponsor(origin, collection_id: CollectionId, new_sponsor: T::AccountId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 
@@ -590,7 +580,6 @@
 		///
 		/// * `collection_id`: ID of the collection with the pending sponsor.
 		#[weight = <SelfWeightOf<T>>::confirm_sponsorship()]
-		#[transactional]
 		pub fn confirm_sponsorship(origin, collection_id: CollectionId) -> DispatchResult {
 			let sender = ensure_signed(origin)?;
 
@@ -619,7 +608,6 @@
 		///
 		/// * `collection_id`: ID of the collection with the sponsor to remove.
 		#[weight = <SelfWeightOf<T>>::remove_collection_sponsor()]
-		#[transactional]
 		pub fn remove_collection_sponsor(origin, collection_id: CollectionId) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 
@@ -654,7 +642,6 @@
 		/// * `owner`: Address of the initial owner of the item.
 		/// * `data`: Token data describing the item to store on chain.
 		#[weight = T::CommonWeightInfo::create_item()]
-		#[transactional]
 		pub fn create_item(origin, collection_id: CollectionId, owner: T::CrossAccountId, data: CreateItemData) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let budget = budget::Value::new(NESTING_BUDGET);
@@ -681,7 +668,6 @@
 		/// * `owner`: Address of the initial owner of the tokens.
 		/// * `items_data`: Vector of data describing each item to be created.
 		#[weight = T::CommonWeightInfo::create_multiple_items(&items_data)]
-		#[transactional]
 		pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResultWithPostInfo {
 			ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
@@ -703,7 +689,6 @@
 		/// * `properties`: Vector of key-value pairs stored as the collection's metadata.
 		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::set_collection_properties(properties.len() as u32)]
-		#[transactional]
 		pub fn set_collection_properties(
 			origin,
 			collection_id: CollectionId,
@@ -729,7 +714,6 @@
 		/// * `property_keys`: Vector of keys of the properties to be deleted.
 		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::delete_collection_properties(property_keys.len() as u32)]
-		#[transactional]
 		pub fn delete_collection_properties(
 			origin,
 			collection_id: CollectionId,
@@ -761,7 +745,6 @@
 		/// * `properties`: Vector of key-value pairs stored as the token's metadata.
 		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::set_token_properties(properties.len() as u32)]
-		#[transactional]
 		pub fn set_token_properties(
 			origin,
 			collection_id: CollectionId,
@@ -792,7 +775,6 @@
 		/// * `property_keys`: Vector of keys of the properties to be deleted.
 		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32)]
-		#[transactional]
 		pub fn delete_token_properties(
 			origin,
 			collection_id: CollectionId,
@@ -823,7 +805,6 @@
 		/// * `property_permissions`: Vector of permissions for property keys.
 		/// Keys support Latin letters, `-`, `_`, and `.` as symbols.
 		#[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]
-		#[transactional]
 		pub fn set_token_property_permissions(
 			origin,
 			collection_id: CollectionId,
@@ -852,7 +833,6 @@
 		/// * `collection_id`: ID of the collection to which the tokens would belong.
 		/// * `data`: Explicit item creation data.
 		#[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
-		#[transactional]
 		pub fn create_multiple_items_ex(origin, collection_id: CollectionId, data: CreateItemExData<T::CrossAccountId>) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let budget = budget::Value::new(NESTING_BUDGET);
@@ -871,7 +851,6 @@
 		/// * `collection_id`: ID of the collection.
 		/// * `value`: New value of the flag, are transfers allowed?
 		#[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]
-		#[transactional]
 		pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
@@ -901,7 +880,6 @@
 		///     * Fungible Mode: The desired number of pieces to burn.
 		///     * Re-Fungible Mode: The desired number of pieces to burn.
 		#[weight = T::CommonWeightInfo::burn_item()]
-		#[transactional]
 		pub fn burn_item(origin, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 
@@ -940,7 +918,6 @@
 		///     * Fungible Mode: The desired number of pieces to burn.
 		///     * Re-Fungible Mode: The desired number of pieces to burn.
 		#[weight = T::CommonWeightInfo::burn_from()]
-		#[transactional]
 		pub fn burn_from(origin, collection_id: CollectionId, from: T::CrossAccountId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let budget = budget::Value::new(NESTING_BUDGET);
@@ -970,7 +947,6 @@
 		///     * Fungible Mode: The desired number of pieces to transfer.
 		///     * Re-Fungible Mode: The desired number of pieces to transfer.
 		#[weight = T::CommonWeightInfo::transfer()]
-		#[transactional]
 		pub fn transfer(origin, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let budget = budget::Value::new(NESTING_BUDGET);
@@ -994,7 +970,6 @@
 		/// * `amount`: Number of pieces of the item approved for a transaction (maximum of 1 for NFTs).
 		/// Set to 0 to revoke the approval.
 		#[weight = T::CommonWeightInfo::approve()]
-		#[transactional]
 		pub fn approve(origin, spender: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, amount: u128) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 
@@ -1026,7 +1001,6 @@
 		///     * Fungible Mode: The desired number of pieces to transfer.
 		///     * Re-Fungible Mode: The desired number of pieces to transfer.
 		#[weight = T::CommonWeightInfo::transfer_from()]
-		#[transactional]
 		pub fn transfer_from(origin, from: T::CrossAccountId, recipient: T::CrossAccountId, collection_id: CollectionId, item_id: TokenId, value: u128 ) -> DispatchResultWithPostInfo {
 			let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
 			let budget = budget::Value::new(NESTING_BUDGET);
@@ -1047,7 +1021,6 @@
 		/// * `new_limit`: New limits of the collection. Fields that are not set (None)
 		/// will not overwrite the old ones.
 		#[weight = <SelfWeightOf<T>>::set_collection_limits()]
-		#[transactional]
 		pub fn set_collection_limits(
 			origin,
 			collection_id: CollectionId,
@@ -1081,7 +1054,6 @@
 		/// * `new_permission`: New permissions of the collection. Fields that are not set (None)
 		/// will not overwrite the old ones.
 		#[weight = <SelfWeightOf<T>>::set_collection_limits()]
-		#[transactional]
 		pub fn set_collection_permissions(
 			origin,
 			collection_id: CollectionId,
@@ -1114,7 +1086,6 @@
 		/// * `token_id`: ID of the RFT.
 		/// * `amount`: New number of parts/pieces into which the token shall be partitioned.
 		#[weight = T::RefungibleExtensionsWeightInfo::repartition()]
-		#[transactional]
 		pub fn repartition(
 			origin,
 			collection_id: CollectionId,