git.delta.rocks / unique-network / refs/commits / 73992bf599ce

difftreelog

doc: rmrk proxies

Farhad Hakimov2022-07-15parent: #12c8c8f.patch.diff
in: master

8 files changed

modifiedpallets/proxy-rmrk-core/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/benchmarking.rs
+++ b/pallets/proxy-rmrk-core/src/benchmarking.rs
@@ -1,3 +1,19 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
 use sp_std::vec;
 
 use frame_benchmarking::{benchmarks, account};
modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -14,6 +14,100 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+//! # RMRK Core Proxy Pallet
+//! 
+//! A pallet used as proxy for RMRK Core (<https://rmrk-team.github.io/rmrk-substrate/#/pallets/rmrk-core>).
+//! 
+//! - [`Config`]
+//! - [`Call`]
+//! - [`Pallet`]
+//! 
+//! ## Overview
+//! 
+//! The RMRK Core Proxy pallet mirrors the functionality of RMRK Core, 
+//! binding its externalities to Unique's own underlying structure.
+//! It is purposed to mimic RMRK Core exactly, allowing seamless integrations
+//! of solutions based on RMRK.
+//! 
+//! RMRK Core itself contains essential functionality for RMRK's nested and
+//! multi-resourced NFTs.
+//! 
+//! *Note*, that while RMRK itself is subject to active development and restructuring,
+//! the proxy may be caught temporarily out of date.
+//! 
+//! ### What is RMRK?
+//! 
+//! RMRK is a set of NFT standards which compose several "NFT 2.0 lego" primitives. 
+//! Putting these legos together allows a user to create NFT systems of arbitrary complexity.
+//! 
+//! Meaning, RMRK NFTs are dynamic, able to nest into each other and form a hierarchy,
+//! make use of specific changeable and partially shared metadata in the form of resources, 
+//! and more.
+//! 
+//! Visit RMRK documentation and repositories to learn more:
+//! - Docs: <https://docs.rmrk.app/getting-started/>
+//! - FAQ: <https://coda.io/@rmrk/faq>
+//! - Substrate code repository: <https://github.com/rmrk-team/rmrk-substrate>
+//! - RMRK spec repository: <https://github.com/rmrk-team/rmrk-spec>
+//! 
+//! ## Proxy Implementation
+//! 
+//! An external user is supposed to be able to utilize this proxy as they would
+//! utilize RMRK, and get exactly the same results. Normally, Unique transactions
+//! are off-limits to RMRK collections and tokens, and vice versa. However,
+//! the information stored on chain can be freely interpreted by storage reads and RPCs.
+//! 
+//! ### ID Mapping
+//! 
+//! RMRK's collections' IDs are counted independently of Unique's and start at 0.
+//! Note that tokens' IDs still start at 1.
+//! The collections themselves, as well as tokens, are stored as Unique collections,
+//! and thus RMRK IDs are mapped to Unique IDs (but not vice versa).
+//! 
+//! ### External/Internal Collection Insulation
+//! 
+//! A Unique transaction cannot target collections purposed for RMRK,
+//! and they are flagged as `external` to specify that. On the other hand, 
+//! due to the mapping, RMRK transactions and RPCs simply cannot reach Unique collections.
+//! 
+//! ### Native Properties
+//! 
+//! Many of RMRK's native parameters are stored as scoped properties of a collection 
+//! or an NFT on the chain. Scoped properties are prefixed with `rmrk:`, where `:`
+//! is an unacceptable symbol in user-defined proeprties, which, along with other safeguards,
+//! makes them impossible to tamper with.
+//! 
+//! ### Collection and NFT Types
+//! 
+//! RMRK introduces the concept of a Base, which is a catalgoue of Parts, 
+//! possible components of an NFT. Due to its similarity with the functionality
+//! of a token collection, a Base is stored and handled as one, and the Base's Parts and Themes
+//! are the collection's NFTs. See [`CollectionType`](pallet_rmrk_core::misc::CollectionType) and 
+//! [`NftType`](pallet_rmrk_core::misc::NftType).
+//! 
+//! ## Interface
+//! 
+//! ### Dispatchables
+//! 
+//! - `create_collection` - Create a new collection of NFTs.
+//! - `destroy_collection` - Destroy a collection.
+//! - `change_collection_issuer` - Change the issuer of a collection. 
+//! Analogous to Unique's collection's [`owner`](up_data_structs::Collection).
+//! - `lock_collection` - "Lock" the collection and prevent new token creation. **Cannot be undone.**
+//! - `mint_nft` - Mint an NFT in a specified collection.
+//! - `burn_nft` - Burn an NFT, destroying it and its nested tokens.
+//! - `send` - Transfer an NFT from an account/NFT A to another account/NFT B.
+//! - `accept_nft` - Accept an NFT sent from another account to self or an owned NFT.
+//! - `reject_nft` - Reject an NFT sent from another account to self or owned NFT and **burn it**.
+//! - `accept_resource` - Accept the addition of a newly created pending resource to an existing NFT.
+//! - `accept_resource_removal` - Accept the removal of a removal-pending resource from an NFT.
+//! - `set_property` - Add or edit a custom user property of a token or a collection.
+//! - `set_priority` - Set a different order of resource priorities for an NFT.
+//! - `add_basic_resource` - Create and set/propose a basic resource for an NFT.
+//! - `add_composable_resource` - Create and set/propose a composable resource for an NFT.
+//! - `add_slot_resource` - Create and set/propose a slot resource for an NFT.
+//! - `remove_resource` - Remove and erase a resource from an NFT.
+
 #![cfg_attr(not(feature = "std"), no_std)]
 
 use frame_support::{pallet_prelude::*, transactional, BoundedVec, dispatch::DispatchResult};
@@ -49,6 +143,7 @@
 
 use RmrkProperty::*;
 
+/// Maximum number of levels of depth in the token nesting tree.
 pub const NESTING_BUDGET: u32 = 5;
 
 type PendingTarget = (CollectionId, TokenId);
@@ -66,14 +161,19 @@
 	pub trait Config:
 		frame_system::Config + pallet_common::Config + pallet_nonfungible::Config + account::Config
 	{
+		/// Overarching event type.
 		type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
+		
+		/// The weight information of this pallet.
 		type WeightInfo: WeightInfo;
 	}
 
+	/// Latest yet-unused collection ID.
 	#[pallet::storage]
 	#[pallet::getter(fn collection_index)]
 	pub type CollectionIndex<T: Config> = StorageValue<_, RmrkCollectionId, ValueQuery>;
 
+	/// Mapping from RMRK collection ID to Unique's.
 	#[pallet::storage]
 	pub type UniqueCollectionId<T: Config> =
 		StorageMap<_, Twox64Concat, RmrkCollectionId, CollectionId, ValueQuery>;
@@ -159,34 +259,66 @@
 
 	#[pallet::error]
 	pub enum Error<T> {
-		/* Unique-specific events */
+		/* Unique proxy-specific events */
+		/// Property of the type of RMRK collection could not be read successfully.
 		CorruptedCollectionType,
-		NftTypeEncodeError,
+		// NftTypeEncodeError,
+		/// Too many symbols supplied as the property key. The maximum is [256](up_data_structs::MAX_PROPERTY_KEY_LENGTH).
 		RmrkPropertyKeyIsTooLong,
+		/// Too many bytes supplied as the property value. The maximum is [32768](up_data_structs::MAX_PROPERTY_VALUE_LENGTH).
 		RmrkPropertyValueIsTooLong,
+		/// Could not find a property by the supplied key.
 		RmrkPropertyIsNotFound,
+		/// Something went wrong when decoding encoded data from the storage. 
+		/// Perhaps, there was a wrong key supplied for the type, or the data was improperly stored.
 		UnableToDecodeRmrkData,
 
 		/* RMRK compatible events */
+		/// Only destroying collections without tokens is allowed.
 		CollectionNotEmpty,
+		/// Could not find an ID for a collection. It is likely there were too many collections created on the chain.
 		NoAvailableCollectionId,
+		/// Token does not exist, or there is no suitable ID for it, likely too many tokens were created in a collection.
 		NoAvailableNftId,
+		/// Collection does not exist, has a wrong type, or does not map to a Unique ID.
 		CollectionUnknown,
+		/// No permission to perform action.
 		NoPermission,
+		/// Token is marked as non-transferable, and thus cannot be transferred.
 		NonTransferable,
+		/// Too many tokens created in the collection, no new ones are allowed.
 		CollectionFullOrLocked,
+		/// No such resource found.
 		ResourceDoesntExist,
+		/// If an NFT is sent to a descendant, that would form a nesting loop, an ouroboros. 
+		/// Sending to self is redundant.
 		CannotSendToDescendentOrSelf,
+		/// Not the target owner of the sent NFT.
 		CannotAcceptNonOwnedNft,
+		/// Not the target owner of the sent NFT.
 		CannotRejectNonOwnedNft,
+		/// NFT was not sent and is not pending.
 		CannotRejectNonPendingNft,
+		/// Resource is not pending for the operation.
 		ResourceNotPending,
+		/// Could not find an ID for the resource. Is is likely there were too many resources created on an NFT.
 		NoAvailableResourceId,
 	}
 
 	#[pallet::call]
 	impl<T: Config> Pallet<T> {
-		/// Create a collection
+		// todo :refactor replace every collection_id with rmrk_collection_id (and nft_id) in arguments for uniformity?
+
+		/// Create a new collection of NFTs.
+		///
+		/// # Permissions:
+		/// * Anyone - will be assigned as the issuer of the collection.
+		///
+		/// # Arguments:
+		/// - `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(
@@ -226,8 +358,8 @@
 				T::CrossAccountId::from_sub(sender.clone()),
 				data,
 				[
-					Self::rmrk_property(Metadata, &metadata)?,
-					Self::rmrk_property(CollectionType, &misc::CollectionType::Regular)?,
+					Self::encode_rmrk_property(Metadata, &metadata)?,
+					Self::encode_rmrk_property(CollectionType, &misc::CollectionType::Regular)?,
 				]
 				.into_iter(),
 			)?;
@@ -237,8 +369,8 @@
 
 			<PalletCommon<T>>::set_scoped_collection_property(
 				unique_collection_id,
-				PropertyScope::Rmrk,
-				Self::rmrk_property(RmrkInternalCollectionId, &rmrk_collection_id)?,
+				RMRK_SCOPE,
+				Self::encode_rmrk_property(RmrkInternalCollectionId, &rmrk_collection_id)?,
 			)?;
 
 			<CollectionIndex<T>>::mutate(|n| *n += 1);
@@ -251,7 +383,15 @@
 			Ok(())
 		}
 
-		/// destroy collection
+		/// Destroy a collection. 
+		/// 
+		/// Only empty collections can be destroyed. If it has any tokens, they must be burned first.
+		///
+		/// # Permissions:
+		/// * Collection issuer
+		///
+		/// # Arguments:
+		/// - `collection_id`: RMRK ID of the collection to destroy.
 		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::destroy_collection())]
 		pub fn destroy_collection(
@@ -278,12 +418,14 @@
 			Ok(())
 		}
 
-		/// Change the issuer of a collection
+		/// Change the issuer of a collection. Analogous to Unique's collection's [`owner`](up_data_structs::Collection).
+		/// 
+		/// # Permissions:
+		/// * Collection issuer
 		///
-		/// Parameters:
-		/// - `origin`: sender of the transaction
-		/// - `collection_id`: collection id of the nft to change issuer of
-		/// - `new_issuer`: Collection's new issuer
+		/// # Arguments:
+		/// - `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(
@@ -314,7 +456,13 @@
 			Ok(())
 		}
 
-		/// lock collection
+		/// "Lock" the collection and prevent new token creation. Cannot be undone.
+		/// 
+		/// # Permissions:
+		/// * Collection issuer
+		///
+		/// # Arguments:
+		/// - `collection_id`: RMRK ID of the collection to lock.
 		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::lock_collection())]
 		pub fn lock_collection(
@@ -346,16 +494,19 @@
 			Ok(())
 		}
 
-		/// Mints an NFT in the specified collection
-		/// Sets metadata and the royalty attribute
+		/// Mint an NFT in a specified collection.
 		///
-		/// Parameters:
-		/// - `collection_id`: The class of the asset to be minted.
-		/// - `nft_id`: The nft value of the asset to be minted.
-		/// - `recipient`: Receiver of the royalty
-		/// - `royalty`: Permillage reward from each trade for the Recipient
-		/// - `metadata`: Arbitrary data about an nft, e.g. IPFS hash
-		/// - `transferable`: Ability to transfer this NFT
+		/// # Permissions:
+		/// * Collection issuer
+		/// 
+		/// # Arguments:
+		/// - `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.
+		/// - `royalty_amount`: Optional permillage reward from each trade for the `recipient`. Cannot be changed.
+		/// - `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(
@@ -390,16 +541,16 @@
 				&cross_owner,
 				&collection,
 				[
-					Self::rmrk_property(TokenType, &NftType::Regular)?,
-					Self::rmrk_property(Transferable, &transferable)?,
-					Self::rmrk_property(PendingNftAccept, &None::<PendingTarget>)?,
-					Self::rmrk_property(RoyaltyInfo, &royalty_info)?,
-					Self::rmrk_property(Metadata, &metadata)?,
-					Self::rmrk_property(Equipped, &false)?,
-					Self::rmrk_property(ResourcePriorities, &<Vec<u8>>::new())?,
-					Self::rmrk_property(NextResourceId, &(0 as RmrkResourceId))?,
-					Self::rmrk_property(PendingChildren, &PendingChildrenSet::new())?,
-					Self::rmrk_property(AssociatedBases, &BasesMap::new())?,
+					Self::encode_rmrk_property(TokenType, &NftType::Regular)?,
+					Self::encode_rmrk_property(Transferable, &transferable)?,
+					Self::encode_rmrk_property(PendingNftAccept, &None::<PendingTarget>)?,
+					Self::encode_rmrk_property(RoyaltyInfo, &royalty_info)?,
+					Self::encode_rmrk_property(Metadata, &metadata)?,
+					Self::encode_rmrk_property(Equipped, &false)?,
+					Self::encode_rmrk_property(ResourcePriorities, &<Vec<u8>>::new())?,
+					Self::encode_rmrk_property(NextResourceId, &(0 as RmrkResourceId))?,
+					Self::encode_rmrk_property(PendingChildren, &PendingChildrenSet::new())?,
+					Self::encode_rmrk_property(AssociatedBases, &BasesMap::new())?,
 				]
 				.into_iter(),
 			)
@@ -423,7 +574,21 @@
 			Ok(())
 		}
 
-		/// burn nft
+		/// Burn an NFT, destroying it and its nested tokens up to the specified limit. 
+		/// If the burning budget is exceeded, the transaction is reverted.
+		/// 
+		/// This is the way to burn a nested token as well.
+		/// 
+		/// For more information, see [`burn_recursively`](pallet_nonfungible::pallet::Pallet::burn_recursively).
+		/// 
+		/// # Permissions:
+		/// * Token owner
+		/// 
+		/// # Arguments:
+		/// - `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, used for nesting. The transaction 
+		/// is reverted if there are more tokens to burn in the nesting tree than this number.
 		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::burn_nft(*max_burns))]
 		pub fn burn_nft(
@@ -458,13 +623,19 @@
 			Ok(())
 		}
 
-		/// Transfers a NFT from an Account or NFT A to another Account or NFT B
+		/// Transfer an NFT from an account/NFT A to another account/NFT B.
+		/// The token must be transferable. Nesting cannot occur deeper than the [`NESTING_BUDGET`].
+		/// 
+		/// If the target owner is an NFT owned by another account, then the NFT will enter
+		/// the pending state and will have to be accepted by the other account.
 		///
-		/// Parameters:
-		/// - `origin`: sender of the transaction
-		/// - `rmrk_collection_id`: collection id of the nft to be transferred
-		/// - `rmrk_nft_id`: nft id of the nft to be transferred
-		/// - `new_owner`: new owner of the nft which can be either an account or a NFT
+		/// # Permissions:
+		/// - 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.
+		/// - `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(
@@ -535,8 +706,8 @@
 						<PalletNft<T>>::set_scoped_token_property(
 							collection.id,
 							nft_id,
-							PropertyScope::Rmrk,
-							Self::rmrk_property::<Option<PendingTarget>>(
+							RMRK_SCOPE,
+							Self::encode_rmrk_property::<Option<PendingTarget>>(
 								PendingNftAccept,
 								&Some((target_collection_id, target_nft_id.into())),
 							)?,
@@ -578,14 +749,18 @@
 			Ok(())
 		}
 
-		/// Accepts an NFT sent from another account to self or owned NFT
+		/// Accept an NFT sent from another account to self or an owned NFT.
+		/// 
+		/// The NFT in question must be pending, and, thus, be [sent](`crate::pallet::Call::send`) first.
+		/// 
+		/// # Permissions:
+		/// - Token-owner-to-be
 		///
-		/// Parameters:
-		/// - `origin`: sender of the transaction
-		/// - `rmrk_collection_id`: collection id of the nft to be accepted
-		/// - `rmrk_nft_id`: nft id of the nft to be accepted
-		/// - `new_owner`: either origin's account ID or origin-owned NFT, whichever the NFT was
-		///   sent to
+		/// # Arguments:
+		/// - `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(
@@ -650,8 +825,8 @@
 				<PalletNft<T>>::set_scoped_token_property(
 					collection.id,
 					nft_id,
-					PropertyScope::Rmrk,
-					Self::rmrk_property(PendingNftAccept, &None::<PendingTarget>)?,
+					RMRK_SCOPE,
+					Self::encode_rmrk_property(PendingNftAccept, &None::<PendingTarget>)?,
 				)?;
 			}
 
@@ -665,12 +840,17 @@
 			Ok(())
 		}
 
-		/// Rejects an NFT sent from another account to self or owned NFT
-		///
-		/// Parameters:
-		/// - `origin`: sender of the transaction
-		/// - `rmrk_collection_id`: collection id of the nft to be accepted
-		/// - `rmrk_nft_id`: nft id of the nft to be accepted
+		/// Reject an NFT sent from another account to self or owned NFT.
+		/// The NFT in question will not be sent back and burnt instead.
+		/// 
+		/// The NFT in question must be pending, and, thus, be [sent](`crate::pallet::Call::send`) first.
+		/// 
+		/// # Permissions:
+		/// - Token-owner-to-be-not
+		/// 
+		/// # Arguments:
+		/// - `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(
@@ -724,7 +904,19 @@
 			Ok(())
 		}
 
-		/// accept the addition of a new resource to an existing NFT
+		/// Accept the addition of a newly created pending resource to an existing NFT.
+		/// 
+		/// This transaction is needed when a resource is created and assigned to an NFT
+		/// by a non-owner, i.e. the collection issuer, with one of the 
+		/// [`add_...` transactions](crate::pallet::Call::add_basic_resource).
+		/// 
+		/// # Permissions:
+		/// - Token owner
+		///
+		/// # Arguments:
+		/// - `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]
 		#[pallet::weight(<SelfWeightOf<T>>::accept_resource())]
 		pub fn accept_resource(
@@ -767,7 +959,18 @@
 			Ok(())
 		}
 
-		/// accept the removal of a resource of an existing NFT
+		/// Accept the removal of a removal-pending resource from an NFT.
+		/// 
+		/// This transaction is needed when a non-owner, i.e. the collection issuer, 
+		/// requests a [removal](`crate::pallet::Call::remove_resource`) of a resource from an NFT.
+		/// 
+		/// # Permissions:
+		/// - Token owner
+		///
+		/// # Arguments:
+		/// - `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(
@@ -795,17 +998,17 @@
 
 			ensure!(cross_sender == nft_owner, <Error<T>>::NoPermission);
 
-			let resource_id_key = Self::rmrk_property_key(ResourceId(resource_id))?;
+			let resource_id_key = Self::get_scoped_property_key(ResourceId(resource_id))?;
 
 			let resource_info = <PalletNft<T>>::token_aux_property((
 				collection_id,
 				nft_id,
-				PropertyScope::Rmrk,
+				RMRK_SCOPE,
 				resource_id_key.clone(),
 			))
 			.ok_or(<Error<T>>::ResourceDoesntExist)?;
 
-			let resource_info: RmrkResourceInfo = Self::decode_property(&resource_info)?;
+			let resource_info: RmrkResourceInfo = Self::decode_property_value(&resource_info)?;
 
 			ensure!(
 				resource_info.pending_removal,
@@ -815,7 +1018,7 @@
 			<PalletNft<T>>::remove_token_aux_property(
 				collection_id,
 				nft_id,
-				PropertyScope::Rmrk,
+				RMRK_SCOPE,
 				resource_id_key,
 			);
 
@@ -833,7 +1036,22 @@
 			Ok(())
 		}
 
-		/// set a custom value on an NFT
+		/// Add or edit a custom user property, a key-value pair, describing the metadata 
+		/// of a token or a collection, on either one of these.
+		/// 
+		/// Note that in this proxy implementation many details regarding RMRK are stored 
+		/// as scoped properties prefixed with "rmrk:", normally inaccessible 
+		/// to external transactions and RPCs.
+		/// 
+		/// # Permissions:
+		/// - Collection issuer - in case of collection property
+		/// - Token owner - in case of NFT property
+		///
+		/// # Arguments:
+		/// - `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(
@@ -863,8 +1081,8 @@
 					<PalletNft<T>>::set_scoped_token_property(
 						collection_id,
 						token_id,
-						PropertyScope::Rmrk,
-						Self::rmrk_property(UserProperty(key.as_slice()), &value)?,
+						RMRK_SCOPE,
+						Self::encode_rmrk_property(UserProperty(key.as_slice()), &value)?,
 					)?;
 				}
 				None => {
@@ -877,8 +1095,8 @@
 
 					<PalletCommon<T>>::set_scoped_collection_property(
 						collection_id,
-						PropertyScope::Rmrk,
-						Self::rmrk_property(UserProperty(key.as_slice()), &value)?,
+						RMRK_SCOPE,
+						Self::encode_rmrk_property(UserProperty(key.as_slice()), &value)?,
 					)?;
 				}
 			}
@@ -893,7 +1111,20 @@
 			Ok(())
 		}
 
-		/// set a different order of resource priority
+		/// Set a different order of resource priorities for an NFT. Priorities can be used,
+		/// for example, for order of rendering.
+		/// 
+		/// Note that the priorities are not updated automatically, and are an empty vector
+		/// by default. There is no pre-set definition for the order to be particular,
+		/// it can be interpreted arbitrarily use-case by use-case.
+		/// 
+		/// # Permissions:
+		/// - Token owner
+		///
+		/// # Arguments:
+		/// - `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(
@@ -920,8 +1151,8 @@
 			<PalletNft<T>>::set_scoped_token_property(
 				collection_id,
 				nft_id,
-				PropertyScope::Rmrk,
-				Self::rmrk_property(ResourcePriorities, &priorities.into_inner())?,
+				RMRK_SCOPE,
+				Self::encode_rmrk_property(ResourcePriorities, &priorities.into_inner())?,
 			)?;
 
 			Self::deposit_event(Event::<T>::PrioritySet {
@@ -932,7 +1163,23 @@
 			Ok(())
 		}
 
-		/// Create basic resource
+		/// Create and set/propose a basic resource for an NFT.
+		/// 
+		/// A resource is considered a part of an NFT, an additional piece of metadata
+		/// usually serving to add a piece of media on top of the root metadata, be it
+		/// a different wing on the root template bird or something entirely unrelated.
+		/// A basic resource is the simplest, lacking a base or composables.
+		/// 
+		/// See RMRK docs for more information and examples.
+		/// 
+		/// # Permissions:
+		/// - Collection issuer - if not the token owner, adding the resource will warrant 
+		/// the owner's [acceptance](crate::pallet::Call::accept_resource).
+		///
+		/// # Arguments:
+		/// - `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(
@@ -962,7 +1209,23 @@
 			Ok(())
 		}
 
-		/// Create composable resource
+		/// Create and set/propose a composable resource for an NFT.
+		/// 
+		/// A resource is considered a part of an NFT, an additional piece of metadata
+		/// usually serving to add a piece of media on top of the root metadata, be it
+		/// a different wing on the root template bird or something entirely unrelated.
+		/// A composable resource links to a base and has a subset of its parts it is composed of.
+		/// 
+		/// See RMRK docs for more information and examples.
+		/// 
+		/// # Permissions:
+		/// - Collection issuer - if not the token owner, adding the resource will warrant 
+		/// the owner's [acceptance](crate::pallet::Call::accept_resource).
+		///
+		/// # Arguments:
+		/// - `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(
@@ -990,17 +1253,17 @@
 			<PalletNft<T>>::try_mutate_token_aux_property(
 				collection_id,
 				nft_id.into(),
-				PropertyScope::Rmrk,
-				Self::rmrk_property_key(AssociatedBases)?,
+				RMRK_SCOPE,
+				Self::get_scoped_property_key(AssociatedBases)?,
 				|value| -> DispatchResult {
 					let mut bases: BasesMap = match value {
-						Some(value) => Self::decode_property(value)?,
+						Some(value) => Self::decode_property_value(value)?,
 						None => BasesMap::new(),
 					};
 
 					*bases.entry(base_id).or_insert(0) += 1;
 
-					*value = Some(Self::encode_property(&bases)?);
+					*value = Some(Self::encode_property_value(&bases)?);
 					Ok(())
 				},
 			)?;
@@ -1012,7 +1275,23 @@
 			Ok(())
 		}
 
-		/// Create slot resource
+		/// Create and set/propose a slot resource for an NFT.
+		/// 
+		/// A resource is considered a part of an NFT, an additional piece of metadata
+		/// usually serving to add a piece of media on top of the root metadata, be it
+		/// a different wing on the root template bird or something entirely unrelated.
+		/// A slot resource links to a base and a slot in it which it now occupies.
+		/// 
+		/// See RMRK docs for more information and examples.
+		/// 
+		/// # Permissions:
+		/// - Collection issuer - if not the token owner, adding the resource will warrant 
+		/// the owner's [acceptance](crate::pallet::Call::accept_resource).
+		///
+		/// # Arguments:
+		/// - `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(
@@ -1042,7 +1321,18 @@
 			Ok(())
 		}
 
-		/// remove resource
+		/// Remove and erase a resource from an NFT.
+		/// 
+		/// If the sender does not own the NFT, then it will be pending confirmation,
+		/// and will have to be [accepted](crate::pallet::Call::accept_resource_removal) by the token owner.
+		/// 
+		/// # Permissions
+		/// - Collection issuer
+		/// 
+		/// # Arguments
+		/// - `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(
@@ -1070,31 +1360,34 @@
 }
 
 impl<T: Config> Pallet<T> {
-	pub fn rmrk_property_key(rmrk_key: RmrkProperty) -> Result<PropertyKey, DispatchError> {
+	/// Transform one of possible RMRK keys into a byte key with a RMRK scope.
+	pub fn get_scoped_property_key(rmrk_key: RmrkProperty) -> Result<PropertyKey, DispatchError> {
 		let key = rmrk_key.to_key::<T>()?;
 
-		let scoped_key = PropertyScope::Rmrk
+		let scoped_key = RMRK_SCOPE
 			.apply(key)
 			.map_err(|_| <Error<T>>::RmrkPropertyKeyIsTooLong)?;
 
 		Ok(scoped_key)
 	}
 
-	// todo think about renaming these
-	pub fn rmrk_property<E: Encode>(
+	/// Form a Unique property, transforming a RMRK key into bytes (without assigning the scope yet) 
+	/// and encoding the value from an arbitrary type into bytes.
+	pub fn encode_rmrk_property<E: Encode>(
 		rmrk_key: RmrkProperty,
 		value: &E,
 	) -> Result<Property, DispatchError> {
 		let key = rmrk_key.to_key::<T>()?;
 
-		let value = Self::encode_property(value)?;
+		let value = Self::encode_property_value(value)?;
 
 		let property = Property { key, value };
 
 		Ok(property)
 	}
 
-	pub fn encode_property<E: Encode, S: Get<u32>>(
+	/// Encode property value from an arbitrary type into bytes for storage.
+	pub fn encode_property_value<E: Encode, S: Get<u32>>(
 		value: &E,
 	) -> Result<BoundedBytes<S>, DispatchError> {
 		let value = value
@@ -1105,13 +1398,15 @@
 		Ok(value)
 	}
 
-	pub fn decode_property<D: Decode, S: Get<u32>>(
+	/// Decode property value from bytes into an arbitrary type.
+	pub fn decode_property_value<D: Decode, S: Get<u32>>(
 		vec: &BoundedBytes<S>,
 	) -> Result<D, DispatchError> {
 		vec.decode()
 			.map_err(|_| <Error<T>>::UnableToDecodeRmrkData.into())
 	}
 
+	/// Change the limit of a property value byte vector.
 	pub fn rebind<L, S>(vec: &BoundedVec<u8, L>) -> Result<BoundedVec<u8, S>, DispatchError>
 	where
 		BoundedVec<u8, S>: TryFrom<Vec<u8>>,
@@ -1120,6 +1415,9 @@
 			.map_err(|_| <Error<T>>::RmrkPropertyValueIsTooLong.into())
 	}
 
+	/// Initialize a new NFT collection with certain RMRK-scoped properties.
+	/// 
+	/// See [`init_collection`](pallet_nonfungible::pallet::Pallet::init_collection) for more details.
 	fn init_collection(
 		sender: T::CrossAccountId,
 		data: CreateCollectionData<T::AccountId>,
@@ -1133,13 +1431,16 @@
 
 		<PalletCommon<T>>::set_scoped_collection_properties(
 			collection_id?,
-			PropertyScope::Rmrk,
+			RMRK_SCOPE,
 			properties,
 		)?;
 
 		collection_id
 	}
 
+	/// Mint a new NFT with certain RMRK-scoped properties. Sender must be the collection owner.
+	/// 
+	/// See [`create_item`](pallet_nonfungible::pallet::Pallet::create_item) for more details.
 	pub fn create_nft(
 		sender: &T::CrossAccountId,
 		owner: &T::CrossAccountId,
@@ -1160,13 +1461,16 @@
 		<PalletNft<T>>::set_scoped_token_properties(
 			collection.id,
 			nft_id,
-			PropertyScope::Rmrk,
+			RMRK_SCOPE,
 			properties,
 		)?;
 
 		Ok(nft_id)
 	}
 
+	/// Burn an NFT, along with its nested children, limited by `max_burns`. The sender must be the token owner.
+	/// 
+	/// See [`burn_recursively`](pallet_nonfungible::pallet::Pallet::burn_recursively) for more details.
 	fn destroy_nft(
 		sender: T::CrossAccountId,
 		collection_id: CollectionId,
@@ -1207,48 +1511,54 @@
 		)
 	}
 
+	/// Add a sent token pending acceptance to the target owning token as a property.
 	fn insert_pending_child(
 		target: (CollectionId, TokenId),
 		child: (RmrkCollectionId, RmrkNftId),
 	) -> DispatchResult {
-		Self::mutate_pending_child(target, |pending_children| {
+		Self::mutate_pending_children(target, |pending_children| {
 			pending_children.insert(child);
 		})
 	}
 
+	/// Remove a sent token pending acceptance from the target token's properties.
 	fn remove_pending_child(
 		target: (CollectionId, TokenId),
 		child: (RmrkCollectionId, RmrkNftId),
 	) -> DispatchResult {
-		Self::mutate_pending_child(target, |pending_children| {
+		Self::mutate_pending_children(target, |pending_children| {
 			pending_children.remove(&child);
 		})
 	}
 
-	fn mutate_pending_child(
+	/// Apply a mutation to the property of a token containing sent tokens 
+	/// that are currently pending acceptance.
+	fn mutate_pending_children(
 		(target_collection_id, target_nft_id): (CollectionId, TokenId),
 		f: impl FnOnce(&mut PendingChildrenSet),
 	) -> DispatchResult {
 		<PalletNft<T>>::try_mutate_token_aux_property(
 			target_collection_id,
 			target_nft_id,
-			PropertyScope::Rmrk,
-			Self::rmrk_property_key(PendingChildren)?,
+			RMRK_SCOPE,
+			Self::get_scoped_property_key(PendingChildren)?,
 			|pending_children| -> DispatchResult {
 				let mut map = match pending_children {
-					Some(map) => Self::decode_property(map)?,
+					Some(map) => Self::decode_property_value(map)?,
 					None => PendingChildrenSet::new(),
 				};
 
 				f(&mut map);
 
-				*pending_children = Some(Self::encode_property(&map)?);
+				*pending_children = Some(Self::encode_property_value(&map)?);
 
 				Ok(())
 			},
 		)
 	}
 
+	/// Get an iterator from a token's property containing tokens sent to it 
+	/// that are currently pending acceptance.
 	fn iterate_pending_children(
 		collection_id: CollectionId,
 		nft_id: TokenId,
@@ -1256,18 +1566,20 @@
 		let property = <PalletNft<T>>::token_aux_property((
 			collection_id,
 			nft_id,
-			PropertyScope::Rmrk,
-			Self::rmrk_property_key(PendingChildren)?,
+			RMRK_SCOPE,
+			Self::get_scoped_property_key(PendingChildren)?,
 		));
 
 		let pending_children = match property {
-			Some(map) => Self::decode_property(&map)?,
+			Some(map) => Self::decode_property_value(&map)?,
 			None => PendingChildrenSet::new(),
 		};
 
 		Ok(pending_children.into_iter())
 	}
 
+	/// Get incremented resource ID from within an NFT's properties and store the new latest ID.
+	/// Thus, the returned resource ID should be used.
 	fn acquire_next_resource_id(
 		collection_id: CollectionId,
 		nft_id: TokenId,
@@ -1282,13 +1594,15 @@
 		<PalletNft<T>>::set_scoped_token_property(
 			collection_id,
 			nft_id,
-			PropertyScope::Rmrk,
-			Self::rmrk_property(NextResourceId, &next_id)?,
+			RMRK_SCOPE,
+			Self::encode_rmrk_property(NextResourceId, &next_id)?,
 		)?;
 
 		Ok(resource_id)
 	}
 
+	/// Create and add a resource for a regular NFT, mark it as pending if the sender 
+	/// is not the token owner. The sender must be the collection owner.
 	fn resource_add(
 		sender: T::AccountId,
 		collection_id: CollectionId,
@@ -1319,10 +1633,10 @@
 		<PalletNft<T>>::try_mutate_token_aux_property(
 			collection_id,
 			nft_id,
-			PropertyScope::Rmrk,
-			Self::rmrk_property_key(ResourceId(id))?,
+			RMRK_SCOPE,
+			Self::get_scoped_property_key(ResourceId(id))?,
 			|value| -> DispatchResult {
-				*value = Some(Self::encode_property(&resource_info)?);
+				*value = Some(Self::encode_property_value(&resource_info)?);
 
 				Ok(())
 			},
@@ -1331,6 +1645,8 @@
 		Ok(id)
 	}
 
+	/// Designate a resource for erasure from an NFT, and remove it if the sender is the token owner.
+	/// The sender must be the collection owner.
 	fn resource_remove(
 		sender: T::AccountId,
 		collection_id: CollectionId,
@@ -1341,18 +1657,17 @@
 			Self::get_typed_nft_collection(collection_id, misc::CollectionType::Regular)?;
 		ensure!(collection.owner == sender, Error::<T>::NoPermission);
 
-		let resource_id_key = Self::rmrk_property_key(ResourceId(resource_id))?;
-		let scope = PropertyScope::Rmrk;
+		let resource_id_key = Self::get_scoped_property_key(ResourceId(resource_id))?;
 
 		let resource = <PalletNft<T>>::token_aux_property((
 			collection_id,
 			nft_id,
-			scope,
+			RMRK_SCOPE,
 			resource_id_key.clone(),
 		))
 		.ok_or(<Error<T>>::ResourceDoesntExist)?;
 
-		let resource_info: RmrkResourceInfo = Self::decode_property(&resource)?;
+		let resource_info: RmrkResourceInfo = Self::decode_property_value(&resource)?;
 
 		let budget = up_data_structs::budget::Value::new(NESTING_BUDGET);
 		let topmost_owner =
@@ -1363,8 +1678,8 @@
 			<PalletNft<T>>::remove_token_aux_property(
 				collection_id,
 				nft_id,
-				PropertyScope::Rmrk,
-				Self::rmrk_property_key(ResourceId(resource_id))?,
+				RMRK_SCOPE,
+				Self::get_scoped_property_key(ResourceId(resource_id))?,
 			);
 
 			if let RmrkResourceTypes::Composable(resource) = resource_info.resource {
@@ -1383,6 +1698,8 @@
 		Ok(())
 	}
 
+	/// Remove one usage of a base from an NFT's property of associated bases. The base will stay, however, 
+	/// if the count of resources using the base is still non-zero.
 	fn remove_associated_base_id(
 		collection_id: CollectionId,
 		nft_id: TokenId,
@@ -1391,11 +1708,11 @@
 		<PalletNft<T>>::try_mutate_token_aux_property(
 			collection_id,
 			nft_id,
-			PropertyScope::Rmrk,
-			Self::rmrk_property_key(AssociatedBases)?,
+			RMRK_SCOPE,
+			Self::get_scoped_property_key(AssociatedBases)?,
 			|value| -> DispatchResult {
 				let mut bases: BasesMap = match value {
-					Some(value) => Self::decode_property(value)?,
+					Some(value) => Self::decode_property_value(value)?,
 					None => BasesMap::new(),
 				};
 
@@ -1407,12 +1724,13 @@
 					}
 				}
 
-				*value = Some(Self::encode_property(&bases)?);
+				*value = Some(Self::encode_property_value(&bases)?);
 				Ok(())
 			},
 		)
 	}
 
+	/// Apply a mutation to a resource stored in the token properties of an NFT.
 	fn try_mutate_resource_info(
 		collection_id: CollectionId,
 		nft_id: TokenId,
@@ -1422,15 +1740,15 @@
 		<PalletNft<T>>::try_mutate_token_aux_property(
 			collection_id,
 			nft_id,
-			PropertyScope::Rmrk,
-			Self::rmrk_property_key(ResourceId(resource_id))?,
+			RMRK_SCOPE,
+			Self::get_scoped_property_key(ResourceId(resource_id))?,
 			|value| match value {
 				Some(value) => {
-					let mut resource_info: RmrkResourceInfo = Self::decode_property(value)?;
+					let mut resource_info: RmrkResourceInfo = Self::decode_property_value(value)?;
 
 					f(&mut resource_info)?;
 
-					*value = Self::encode_property(&resource_info)?;
+					*value = Self::encode_property_value(&resource_info)?;
 
 					Ok(())
 				}
@@ -1439,6 +1757,7 @@
 		)
 	}
 
+	/// Change the owner of an NFT collection, ensuring that the sender is the current owner.
 	fn change_collection_owner(
 		collection_id: CollectionId,
 		collection_type: misc::CollectionType,
@@ -1454,6 +1773,7 @@
 		collection.save()
 	}
 
+	/// Ensure that an account is the collection owner/issuer, return an error if not.
 	pub fn check_collection_owner(
 		collection: &NonfungibleHandle<T>,
 		account: &T::CrossAccountId,
@@ -1463,10 +1783,12 @@
 			.map_err(Self::map_unique_err_to_proxy)
 	}
 
+	/// Get the latest yet-unused RMRK collection index from the storage.
 	pub fn last_collection_idx() -> RmrkCollectionId {
 		<CollectionIndex<T>>::get()
 	}
 
+	/// Get a mapping from a RMRK collection ID to its corresponding Unique collection ID.
 	pub fn unique_collection_id(
 		rmrk_collection_id: RmrkCollectionId,
 	) -> Result<CollectionId, DispatchError> {
@@ -1474,12 +1796,14 @@
 			.map_err(|_| <Error<T>>::CollectionUnknown.into())
 	}
 
+	/// Get a mapping from a Unique collection ID to its RMRK collection ID counterpart, if it exists.
 	pub fn rmrk_collection_id(
 		unique_collection_id: CollectionId,
 	) -> Result<RmrkCollectionId, DispatchError> {
 		Self::get_collection_property_decoded(unique_collection_id, RmrkInternalCollectionId)
 	}
 
+	/// Fetch a Unique NFT collection.
 	pub fn get_nft_collection(
 		collection_id: CollectionId,
 	) -> Result<NonfungibleHandle<T>, DispatchError> {
@@ -1492,29 +1816,35 @@
 		}
 	}
 
+	/// Check if an NFT collection with such an ID exists.
 	pub fn collection_exists(collection_id: CollectionId) -> bool {
 		<CollectionHandle<T>>::try_get(collection_id).is_ok()
 	}
 
+	/// Fetch and decode a RMRK-scoped collection property value in bytes.
 	pub fn get_collection_property(
 		collection_id: CollectionId,
 		key: RmrkProperty,
 	) -> Result<PropertyValue, DispatchError> {
 		let collection_property = <PalletCommon<T>>::collection_properties(collection_id)
-			.get(&Self::rmrk_property_key(key)?)
+			.get(&Self::get_scoped_property_key(key)?)
 			.ok_or(<Error<T>>::CollectionUnknown)?
 			.clone();
 
 		Ok(collection_property)
 	}
 
+	/// Fetch a RMRK-scoped collection property and decode it from bytes into an appropriate type.
 	pub fn get_collection_property_decoded<V: Decode>(
 		collection_id: CollectionId,
 		key: RmrkProperty,
 	) -> Result<V, DispatchError> {
-		Self::decode_property(&Self::get_collection_property(collection_id, key)?)
+		Self::decode_property_value(&Self::get_collection_property(collection_id, key)?)
 	}
 
+	/// Get the type of a collection stored in it as a scoped property.
+	/// 
+	/// RMRK Core proxy differentiates between regular collections as well as RMRK bases as collections.
 	pub fn get_collection_type(
 		collection_id: CollectionId,
 	) -> Result<misc::CollectionType, DispatchError> {
@@ -1527,6 +1857,8 @@
 		})
 	}
 
+	/// Ensure that the type of the collection equals the provided type,
+	/// otherwise return an error.
 	pub fn ensure_collection_type(
 		collection_id: CollectionId,
 		collection_type: misc::CollectionType,
@@ -1540,6 +1872,7 @@
 		Ok(())
 	}
 
+	/// Fetch an NFT collection, but make sure it has the appropriate type.
 	pub fn get_typed_nft_collection(
 		collection_id: CollectionId,
 		collection_type: misc::CollectionType,
@@ -1549,6 +1882,8 @@
 		Self::get_nft_collection(collection_id)
 	}
 
+	/// Same as [`get_typed_nft_collection`](crate::pallet::Pallet::get_typed_nft_collection), 
+	/// but also return the Unique collection ID.
 	pub fn get_typed_nft_collection_mapped(
 		rmrk_collection_id: RmrkCollectionId,
 		collection_type: misc::CollectionType,
@@ -1563,31 +1898,37 @@
 		Ok((collection, unique_collection_id))
 	}
 
+	/// Fetch and decode a RMRK-scoped NFT property value in bytes.
 	pub fn get_nft_property(
 		collection_id: CollectionId,
 		nft_id: TokenId,
 		key: RmrkProperty,
 	) -> Result<PropertyValue, DispatchError> {
 		let nft_property = <PalletNft<T>>::token_properties((collection_id, nft_id))
-			.get(&Self::rmrk_property_key(key)?)
+			.get(&Self::get_scoped_property_key(key)?)
 			.ok_or(<Error<T>>::RmrkPropertyIsNotFound)?
 			.clone();
 
 		Ok(nft_property)
 	}
 
+	/// Fetch a RMRK-scoped NFT property and decode it from bytes into an appropriate type.
 	pub fn get_nft_property_decoded<V: Decode>(
 		collection_id: CollectionId,
 		nft_id: TokenId,
 		key: RmrkProperty,
 	) -> Result<V, DispatchError> {
-		Self::decode_property(&Self::get_nft_property(collection_id, nft_id, key)?)
+		Self::decode_property_value(&Self::get_nft_property(collection_id, nft_id, key)?)
 	}
 
+	/// Check that an NFT exists.
 	pub fn nft_exists(collection_id: CollectionId, nft_id: TokenId) -> bool {
 		<TokenData<T>>::contains_key((collection_id, nft_id))
 	}
 
+	/// Get the type of an NFT stored in it as a scoped property.
+	/// 
+	/// RMRK Core proxy differentiates between regular NFTs, and RMRK parts and themes.
 	pub fn get_nft_type(
 		collection_id: CollectionId,
 		token_id: TokenId,
@@ -1596,6 +1937,7 @@
 			.map_err(|_| <Error<T>>::NoAvailableNftId.into())
 	}
 
+	/// Ensure that the type of the NFT equals the provided type, otherwise return an error.
 	pub fn ensure_nft_type(
 		collection_id: CollectionId,
 		token_id: TokenId,
@@ -1607,6 +1949,8 @@
 		Ok(())
 	}
 
+	/// Ensure that an account is the owner of the token, either directly 
+	/// or at the top of the nesting hierarchy; return an error if it is not.
 	pub fn ensure_nft_owner(
 		collection_id: CollectionId,
 		token_id: TokenId,
@@ -1627,6 +1971,8 @@
 		Ok(())
 	}
 
+	/// Fetch non-scoped properties of a collection or a token that match the filter keys supplied, 
+	/// or, if None are provided, return all non-scoped properties.
 	pub fn filter_user_properties<Key, Value, R, Mapper>(
 		collection_id: CollectionId,
 		token_id: Option<TokenId>,
@@ -1672,6 +2018,8 @@
 			})
 	}
 
+	/// Get all non-scoped properties from a collection or a token, and apply some transformation 
+	/// to each key-value pair.
 	pub fn iterate_user_properties<Key, Value, R, Mapper>(
 		collection_id: CollectionId,
 		token_id: Option<TokenId>,
@@ -1699,6 +2047,7 @@
 		Ok(properties)
 	}
 
+	/// Match Unique errors to RMRK's own and return the RMRK error if a match is successful.
 	fn map_unique_err_to_proxy(err: DispatchError) -> DispatchError {
 		map_unique_err_to_proxy! {
 			match err {
modifiedpallets/proxy-rmrk-core/src/misc.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/misc.rs
+++ b/pallets/proxy-rmrk-core/src/misc.rs
@@ -14,9 +14,13 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+//! Miscellaneous helpers and utilities used by the proxy pallet.
+
 use super::*;
 use codec::{Encode, Decode, Error};
 
+/// Match errors from one type to another and return an error 
+/// if a match is successful.
 #[macro_export]
 macro_rules! map_unique_err_to_proxy {
     (match $err:ident { $($unique_err_ty:ident :: $unique_err:ident => $proxy_err:ident),+ $(,)? }) => {
@@ -30,8 +34,9 @@
     };
 }
 
-// Utilize the RmrkCore pallet for access to Runtime errors.
+/// Interface to decode bytes from a bounded vector into an arbitrary type.
 pub trait RmrkDecode<T: Decode, S> {
+	/// Try to decode bytes from a bounded vector into an arbitrary type.
 	fn decode(&self) -> Result<T, Error>;
 }
 
@@ -43,8 +48,9 @@
 	}
 }
 
-// Utilize the RmrkCore pallet for access to Runtime errors.
+/// Interface to "rebind", change the limit of a bounded byte vector.
 pub trait RmrkRebind<T, S> {
+	/// Try to change the limit of a bounded byte vector.
 	fn rebind(&self) -> Result<BoundedVec<u8, S>, Error>;
 }
 
@@ -58,12 +64,16 @@
 	}
 }
 
+/// RMRK Base shares functionality with a regular collection, and is thus
+/// stored as one, but they are used for different purposes and need to be differentiated.
 #[derive(Encode, Decode, PartialEq, Eq)]
 pub enum CollectionType {
 	Regular,
 	Base,
 }
 
+/// RMRK Base, being stored as a collection, can have different kinds of tokens,
+/// all except the `Regular` type, which is attributed to `Regular` collection.
 #[derive(Encode, Decode, PartialEq, Eq)]
 pub enum NftType {
 	Regular,
modifiedpallets/proxy-rmrk-core/src/property.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/property.rs
+++ b/pallets/proxy-rmrk-core/src/property.rs
@@ -14,13 +14,21 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
+//! Details of storing and handling RMRK properties.
+
 use super::*;
 use up_data_structs::PropertyScope;
 use core::convert::AsRef;
 
+/// Property prefix for storing resources.
 pub const RESOURCE_ID_PREFIX: &str = "rsid-";
+/// Property prefix for storing custom user-defined properties.
 pub const USER_PROPERTY_PREFIX: &str = "userprop-";
+/// Property scope for RMRK, used to signify that this property 
+/// was created and is used by RMRK.
+pub const RMRK_SCOPE: PropertyScope = PropertyScope::Rmrk;
 
+/// Predefined RMRK property keys for storage of RMRK data format on the Unique chain.
 pub enum RmrkProperty<'r> {
 	Metadata,
 	CollectionType,
@@ -49,6 +57,7 @@
 }
 
 impl<'r> RmrkProperty<'r> {
+	/// Convert a predefined RMRK property key enum into string bytes.
 	pub fn to_key<T: Config>(self) -> Result<PropertyKey, Error<T>> {
 		fn get_bytes<T: AsRef<[u8]>>(container: &T) -> &[u8] {
 			container.as_ref()
@@ -94,9 +103,10 @@
 	}
 }
 
+/// Strip a property key of its prefix and RMRK scope.
 pub fn strip_key_prefix(key: &PropertyKey, prefix: &str) -> Option<PropertyKey> {
 	let key_prefix = PropertyKey::try_from(prefix.as_bytes().to_vec()).ok()?;
-	let key_prefix = PropertyScope::Rmrk.apply(key_prefix).ok()?;
+	let key_prefix = RMRK_SCOPE.apply(key_prefix).ok()?;
 
 	key.as_slice()
 		.strip_prefix(key_prefix.as_slice())?
@@ -105,6 +115,7 @@
 		.ok()
 }
 
+/// Check that the key has the prefix.
 pub fn is_valid_key_prefix(key: &PropertyKey, prefix: &str) -> bool {
 	strip_key_prefix(key, prefix).is_some()
 }
modifiedpallets/proxy-rmrk-core/src/rpc.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/rpc.rs
+++ b/pallets/proxy-rmrk-core/src/rpc.rs
@@ -1,9 +1,29 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+//! Realizations of RMRK RPCs (remote procedure calls) related to the Core pallet.
+
 use super::*;
 
+/// Get the latest created collection ID.
 pub fn last_collection_idx<T: Config>() -> Result<RmrkCollectionId, DispatchError> {
 	Ok(<Pallet<T>>::last_collection_idx())
 }
 
+/// Get collection info by ID.
 pub fn collection_by_id<T: Config>(
 	collection_id: RmrkCollectionId,
 ) -> Result<Option<RmrkCollectionInfo<T::AccountId>>, DispatchError> {
@@ -29,6 +49,7 @@
 	}))
 }
 
+/// Get NFT info by collection and NFT IDs.
 pub fn nft_by_id<T: Config>(
 	collection_id: RmrkCollectionId,
 	nft_by_id: RmrkNftId,
@@ -83,6 +104,8 @@
 	}))
 }
 
+
+/// Get tokens owned by an account in a collection.
 pub fn account_tokens<T: Config>(
 	account_id: T::AccountId,
 	collection_id: RmrkCollectionId,
@@ -116,6 +139,7 @@
 	Ok(tokens)
 }
 
+/// Get tokens nested in an NFT - its direct children (not the children's children).
 pub fn nft_children<T: Config>(
 	collection_id: RmrkCollectionId,
 	nft_id: RmrkNftId,
@@ -152,6 +176,7 @@
 	)
 }
 
+/// Get collection properties, created by the user - not the proxy-specific properties.
 pub fn collection_properties<T: Config>(
 	collection_id: RmrkCollectionId,
 	filter_keys: Option<Vec<RmrkPropertyKey>>,
@@ -174,6 +199,7 @@
 	Ok(properties)
 }
 
+/// Get NFT properties, created by the user - not the proxy-specific properties.
 pub fn nft_properties<T: Config>(
 	collection_id: RmrkCollectionId,
 	nft_id: RmrkNftId,
@@ -199,6 +225,7 @@
 	Ok(properties)
 }
 
+/// Get data of resources of an NFT.
 pub fn nft_resources<T: Config>(
 	collection_id: RmrkCollectionId,
 	nft_id: RmrkNftId,
@@ -226,7 +253,7 @@
 			return None;
 		}
 
-		let resource_info: RmrkResourceInfo = <Pallet<T>>::decode_property(&value).ok()?;
+		let resource_info: RmrkResourceInfo = <Pallet<T>>::decode_property_value(&value).ok()?;
 
 		Some(resource_info)
 	})
@@ -235,6 +262,7 @@
 	Ok(resources)
 }
 
+/// Get the priority of a resource in an NFT.
 pub fn nft_resource_priority<T: Config>(
 	collection_id: RmrkCollectionId,
 	nft_id: RmrkNftId,
modifiedpallets/proxy-rmrk-equip/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-equip/src/benchmarking.rs
+++ b/pallets/proxy-rmrk-equip/src/benchmarking.rs
@@ -1,3 +1,19 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
 use sp_std::vec;
 
 use frame_benchmarking::{benchmarks, account};
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#![cfg_attr(not(feature = "std"), no_std)]1819use frame_support::{pallet_prelude::*, transactional, BoundedVec, dispatch::DispatchResult};20use frame_system::{pallet_prelude::*, ensure_signed};21use sp_runtime::DispatchError;22use up_data_structs::*;23use pallet_common::{Pallet as PalletCommon, Error as CommonError};24use pallet_rmrk_core::{25	Pallet as PalletCore, Error as CoreError,26	misc::{self, *},27	property::RmrkProperty::*,28};29use pallet_nonfungible::{Pallet as PalletNft, NonfungibleHandle};30use pallet_evm::account::CrossAccountId;31use weights::WeightInfo;3233pub use pallet::*;3435#[cfg(feature = "runtime-benchmarks")]36pub mod benchmarking;37pub mod rpc;38pub mod weights;3940pub type SelfWeightOf<T> = <T as Config>::WeightInfo;4142#[frame_support::pallet]43pub mod pallet {44	use super::*;4546	#[pallet::config]47	pub trait Config: frame_system::Config + pallet_rmrk_core::Config {48		type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;49		type WeightInfo: WeightInfo;50	}5152	#[pallet::storage]53	#[pallet::getter(fn internal_part_id)]54	pub type InernalPartId<T: Config> =55		StorageDoubleMap<_, Twox64Concat, CollectionId, Twox64Concat, RmrkPartId, TokenId>;5657	#[pallet::storage]58	#[pallet::getter(fn base_has_default_theme)]59	pub type BaseHasDefaultTheme<T: Config> =60		StorageMap<_, Twox64Concat, CollectionId, bool, ValueQuery>;6162	#[pallet::pallet]63	#[pallet::generate_store(pub(super) trait Store)]64	pub struct Pallet<T>(_);6566	#[pallet::event]67	#[pallet::generate_deposit(pub(super) fn deposit_event)]68	pub enum Event<T: Config> {69		BaseCreated {70			issuer: T::AccountId,71			base_id: RmrkBaseId,72		},73		EquippablesUpdated {74			base_id: RmrkBaseId,75			slot_id: RmrkSlotId,76		},77	}7879	#[pallet::error]80	pub enum Error<T> {81		PermissionError,82		NoAvailableBaseId,83		NoAvailablePartId,84		BaseDoesntExist,85		NeedsDefaultThemeFirst,86		PartDoesntExist,87		NoEquippableOnFixedPart,88	}8990	#[pallet::call]91	impl<T: Config> Pallet<T> {92		/// Creates a new Base.93		/// Modeled after [base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)94		///95		/// Parameters:96		/// - origin: Caller, will be assigned as the issuer of the Base97		/// - base_type: media type, e.g. "svg"98		/// - symbol: arbitrary client-chosen symbol99		/// - parts: array of Fixed and Slot parts composing the base, confined in length by100		///   RmrkPartsLimit101		#[transactional]102		#[pallet::weight(<SelfWeightOf<T>>::create_base(parts.len() as u32))]103		pub fn create_base(104			origin: OriginFor<T>,105			base_type: RmrkString,106			symbol: RmrkBaseSymbol,107			parts: BoundedVec<RmrkPartType, RmrkPartsLimit>,108		) -> DispatchResult {109			let sender = ensure_signed(origin)?;110			let cross_sender = T::CrossAccountId::from_sub(sender.clone());111112			let data = CreateCollectionData {113				limits: None,114				token_prefix: symbol115					.into_inner()116					.try_into()117					.map_err(|_| <CommonError<T>>::CollectionTokenPrefixLimitExceeded)?,118				..Default::default()119			};120121			let collection_id_res =122				<PalletNft<T>>::init_collection(cross_sender.clone(), data, true);123124			if let Err(DispatchError::Arithmetic(_)) = &collection_id_res {125				return Err(<Error<T>>::NoAvailableBaseId.into());126			}127128			let collection_id = collection_id_res?;129130			<PalletCommon<T>>::set_scoped_collection_properties(131				collection_id,132				PropertyScope::Rmrk,133				[134					<PalletCore<T>>::rmrk_property(CollectionType, &misc::CollectionType::Base)?,135					<PalletCore<T>>::rmrk_property(BaseType, &base_type)?,136				]137				.into_iter(),138			)?;139140			let collection = <PalletCore<T>>::get_nft_collection(collection_id)?;141142			for part in parts {143				Self::create_part(&cross_sender, &collection, part)?;144			}145146			Self::deposit_event(Event::BaseCreated {147				issuer: sender,148				base_id: collection_id.0,149			});150151			Ok(())152		}153154		/// Adds a Theme to a Base.155		/// Modeled after [themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md)156		/// Themes are stored in the Themes storage157		/// A Theme named "default" is required prior to adding other Themes.158		///159		/// Parameters:160		/// - origin: The caller of the function, must be issuer of the base161		/// - base_id: The Base containing the Theme to be updated162		/// - theme: The Theme to add to the Base.  A Theme has a name and properties, which are an163		///   array of [key, value, inherit].164		///   - key: arbitrary BoundedString, defined by client165		///   - value: arbitrary BoundedString, defined by client166		///   - inherit: optional bool167		#[transactional]168		#[pallet::weight(<SelfWeightOf<T>>::theme_add(theme.properties.len() as u32))]169		pub fn theme_add(170			origin: OriginFor<T>,171			base_id: RmrkBaseId,172			theme: RmrkBoundedTheme,173		) -> DispatchResult {174			let sender = ensure_signed(origin)?;175176			let sender = T::CrossAccountId::from_sub(sender);177			let owner = &sender;178179			let collection_id: CollectionId = base_id.into();180181			let collection = Self::get_base(collection_id)?;182183			if theme.name.as_slice() == b"default" {184				<BaseHasDefaultTheme<T>>::insert(collection_id, true);185			} else if !Self::base_has_default_theme(collection_id) {186				return Err(<Error<T>>::NeedsDefaultThemeFirst.into());187			}188189			let token_id = <PalletCore<T>>::create_nft(190				&sender,191				owner,192				&collection,193				[194					<PalletCore<T>>::rmrk_property(TokenType, &NftType::Theme)?,195					<PalletCore<T>>::rmrk_property(ThemeName, &theme.name)?,196					<PalletCore<T>>::rmrk_property(ThemeInherit, &theme.inherit)?,197				]198				.into_iter(),199			)200			.map_err(|_| <Error<T>>::PermissionError)?;201202			for property in theme.properties {203				<PalletNft<T>>::set_scoped_token_property(204					collection_id,205					token_id,206					PropertyScope::Rmrk,207					<PalletCore<T>>::rmrk_property(208						UserProperty(property.key.as_slice()),209						&property.value,210					)?,211				)?;212			}213214			Ok(())215		}216217		#[transactional]218		#[pallet::weight(<SelfWeightOf<T>>::equippable())]219		pub fn equippable(220			origin: OriginFor<T>,221			base_id: RmrkBaseId,222			slot_id: RmrkSlotId,223			equippables: RmrkEquippableList,224		) -> DispatchResult {225			let sender = ensure_signed(origin)?;226227			let base_collection_id = base_id.into();228			let collection = Self::get_base(base_collection_id)?;229230			<PalletCore<T>>::check_collection_owner(231				&collection,232				&T::CrossAccountId::from_sub(sender),233			)234			.map_err(|err| {235				if err == <CoreError<T>>::NoPermission.into() {236					<Error<T>>::PermissionError.into()237				} else {238					err239				}240			})?;241242			let part_id = Self::internal_part_id(base_collection_id, slot_id)243				.ok_or(<Error<T>>::PartDoesntExist)?;244245			let nft_type = <PalletCore<T>>::get_nft_type(base_collection_id, part_id)246				.map_err(|_| <Error<T>>::PartDoesntExist)?;247248			match nft_type {249				NftType::Regular | NftType::Theme => return Err(<Error<T>>::PermissionError.into()),250				NftType::FixedPart => return Err(<Error<T>>::NoEquippableOnFixedPart.into()),251				NftType::SlotPart => {252					<PalletNft<T>>::set_scoped_token_property(253						base_collection_id,254						part_id,255						PropertyScope::Rmrk,256						<PalletCore<T>>::rmrk_property(EquippableList, &equippables)?,257					)?;258				}259			}260261			Self::deposit_event(Event::EquippablesUpdated { base_id, slot_id });262263			Ok(())264		}265	}266}267268impl<T: Config> Pallet<T> {269	fn create_part(270		sender: &T::CrossAccountId,271		collection: &NonfungibleHandle<T>,272		part: RmrkPartType,273	) -> DispatchResult {274		let owner = sender;275276		let part_id = part.id();277		let src = part.src();278		let z_index = part.z_index();279280		let nft_type = match part {281			RmrkPartType::FixedPart(_) => NftType::FixedPart,282			RmrkPartType::SlotPart(_) => NftType::SlotPart,283		};284285		let token_id = match Self::internal_part_id(collection.id, part_id) {286			Some(token_id) => token_id,287			None => {288				let token_id =289					<PalletCore<T>>::create_nft(sender, owner, collection, [].into_iter())290						.map_err(|err| match err {291							DispatchError::Arithmetic(_) => <Error<T>>::NoAvailablePartId.into(),292							err => err,293						})?;294295				<InernalPartId<T>>::insert(collection.id, part_id, token_id);296297				<PalletNft<T>>::set_scoped_token_property(298					collection.id,299					token_id,300					PropertyScope::Rmrk,301					<PalletCore<T>>::rmrk_property(ExternalPartId, &part_id)?,302				)?;303304				token_id305			}306		};307308		<PalletNft<T>>::set_scoped_token_properties(309			collection.id,310			token_id,311			PropertyScope::Rmrk,312			[313				<PalletCore<T>>::rmrk_property(TokenType, &nft_type)?,314				<PalletCore<T>>::rmrk_property(Src, &src)?,315				<PalletCore<T>>::rmrk_property(ZIndex, &z_index)?,316			]317			.into_iter(),318		)?;319320		if let RmrkPartType::SlotPart(part) = part {321			<PalletNft<T>>::set_scoped_token_property(322				collection.id,323				token_id,324				PropertyScope::Rmrk,325				<PalletCore<T>>::rmrk_property(EquippableList, &part.equippable)?,326			)?;327		}328329		Ok(())330	}331332	fn get_base(base_id: CollectionId) -> Result<NonfungibleHandle<T>, DispatchError> {333		let collection =334			<PalletCore<T>>::get_typed_nft_collection(base_id, misc::CollectionType::Base)335				.map_err(|err| {336					if err == <CoreError<T>>::CollectionUnknown.into() {337						<Error<T>>::BaseDoesntExist.into()338					} else {339						err340					}341				})?;342		collection.check_is_external()?;343344		Ok(collection)345	}346}
modifiedpallets/proxy-rmrk-equip/src/rpc.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-equip/src/rpc.rs
+++ b/pallets/proxy-rmrk-equip/src/rpc.rs
@@ -1,7 +1,26 @@
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+//! Realizations of RMRK RPCs (remote procedure calls) related to the Equip pallet.
+
 use super::*;
 use pallet_rmrk_core::{misc, property::*};
 use sp_std::vec::Vec;
 
+/// Get base info by its ID.
 pub fn base<T: Config>(
 	base_id: RmrkBaseId,
 ) -> Result<Option<RmrkBaseInfo<T::AccountId>>, DispatchError> {
@@ -22,6 +41,7 @@
 	}))
 }
 
+/// Get all parts of a base.
 pub fn base_parts<T: Config>(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {
 	use pallet_common::CommonCollectionOperations;
 
@@ -93,6 +113,7 @@
 	Ok(parts)
 }
 
+/// Get the theme names belonging to a base.
 pub fn theme_names<T: Config>(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {
 	use pallet_common::CommonCollectionOperations;
 
@@ -124,6 +145,7 @@
 	Ok(theme_names)
 }
 
+/// Get theme info, including properties, optionally limited to the provided keys.
 pub fn theme<T: Config>(
 	base_id: RmrkBaseId,
 	theme_name: RmrkThemeName,