git.delta.rocks / unique-network / refs/commits / 80bfde33245f

difftreelog

feat add rmrk proxt extrinsics comments

Daniel Shiposha2022-06-09parent: #95a6d97.patch.diff
in: master

2 files changed

modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -176,8 +176,9 @@
 
 	#[pallet::call]
 	impl<T: Config> Pallet<T> {
+		/// Create a collection
+		#[transactional]
 		#[pallet::weight(<SelfWeightOf<T>>::create_collection())]
-		#[transactional]
 		pub fn create_collection(
 			origin: OriginFor<T>,
 			metadata: RmrkString,
@@ -229,6 +230,7 @@
 			Ok(())
 		}
 
+		/// destroy collection
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn destroy_collection(
@@ -255,6 +257,12 @@
 			Ok(())
 		}
 
+		/// Change the issuer of a collection
+		///
+		/// Parameters:
+		/// - `origin`: sender of the transaction
+		/// - `collection_id`: collection id of the nft to change issuer of
+		/// - `new_issuer`: Collection's new issuer
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn change_collection_issuer(
@@ -285,6 +293,7 @@
 			Ok(())
 		}
 
+		/// lock collection
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn lock_collection(
@@ -316,6 +325,16 @@
 			Ok(())
 		}
 
+		/// Mints an NFT in the specified collection
+		/// Sets metadata and the royalty attribute
+		///
+		/// 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
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn mint_nft(
@@ -385,6 +404,7 @@
 			Ok(())
 		}
 
+		/// burn nft
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn burn_nft(
@@ -416,6 +436,13 @@
 			Ok(())
 		}
 
+		/// Transfers a NFT from an Account or NFT A to another Account or NFT B
+		///
+		/// 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
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn send(
@@ -520,6 +547,14 @@
 			Ok(())
 		}
 
+		/// Accepts 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
+		/// - `new_owner`: either origin's account ID or origin-owned NFT, whichever the NFT was
+		///   sent to
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn accept_nft(
@@ -589,6 +624,12 @@
 			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
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn reject_nft(
@@ -625,6 +666,7 @@
 			Ok(())
 		}
 
+		/// accept the addition of a new resource to an existing NFT
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn accept_resource(
@@ -681,6 +723,7 @@
 			Ok(())
 		}
 
+		/// accept the removal of a resource of an existing NFT
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn accept_resource_removal(
@@ -738,6 +781,7 @@
 			Ok(())
 		}
 
+		/// set a custom value on an NFT
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn set_property(
@@ -797,6 +841,7 @@
 			Ok(())
 		}
 
+		/// set a different order of resource priority
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn set_priority(
@@ -835,6 +880,7 @@
 			Ok(())
 		}
 
+		/// Create basic resource
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn add_basic_resource(
@@ -872,6 +918,7 @@
 			Ok(())
 		}
 
+		/// Create composable resource
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn add_composable_resource(
@@ -912,6 +959,7 @@
 			Ok(())
 		}
 
+		/// Create slot resource
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn add_slot_resource(
@@ -951,6 +999,7 @@
 			Ok(())
 		}
 
+		/// remove resource
 		#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
 		#[transactional]
 		pub fn remove_resource(
modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
75 #[pallet::call]75 #[pallet::call]
76 impl<T: Config> Pallet<T> {76 impl<T: Config> Pallet<T> {
77
78 /// Creates a new Base.
79 /// Modeled after [base interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/base.md)
80 ///
81 /// Parameters:
82 /// - origin: Caller, will be assigned as the issuer of the Base
83 /// - base_type: media type, e.g. "svg"
84 /// - symbol: arbitrary client-chosen symbol
85 /// - parts: array of Fixed and Slot parts composing the base, confined in length by
86 /// RmrkPartsLimit
77 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]87 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
78 #[transactional]88 #[transactional]
79 pub fn create_base(89 pub fn create_base(
137 Ok(())147 Ok(())
138 }148 }
139149
150 /// Adds a Theme to a Base.
151 /// Modeled after [themeadd interaction](https://github.com/rmrk-team/rmrk-spec/blob/master/standards/rmrk2.0.0/interactions/themeadd.md)
152 /// Themes are stored in the Themes storage
153 /// A Theme named "default" is required prior to adding other Themes.
154 ///
155 /// Parameters:
156 /// - origin: The caller of the function, must be issuer of the base
157 /// - base_id: The Base containing the Theme to be updated
158 /// - theme: The Theme to add to the Base. A Theme has a name and properties, which are an
159 /// array of [key, value, inherit].
160 /// - key: arbitrary BoundedString, defined by client
161 /// - value: arbitrary BoundedString, defined by client
162 /// - inherit: optional bool
140 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]163 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
141 #[transactional]164 #[transactional]
142 pub fn theme_add(165 pub fn theme_add(