git.delta.rocks / unique-network / refs/commits / 717e109aae0c

difftreelog

doc(rmrk): requested clarifications

Farhad Hakimov2022-07-22parent: #27c50a6.patch.diff
in: master

3 files changed

modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
113//! is an unacceptable symbol in user-defined properties, which, along with other safeguards,113//! is an unacceptable symbol in user-defined properties, which, along with other safeguards,
114//! makes them impossible to tamper with.114//! makes them impossible to tamper with.
115//!115//!
116//! ### Collection and NFT Types, and Base, Parts and Themes Handling116//! ### Collection and NFT Types, or Base, Parts and Themes Handling
117//!117//!
118//! RMRK introduces the concept of a Base, which is a catalogue of Parts,118//! RMRK introduces the concept of a Base, which is a catalogue of Parts,
119//! possible components of an NFT. Due to its similarity with the functionality119//! possible components of an NFT. Due to its similarity with the functionality
modifiedpallets/proxy-rmrk-core/src/misc.rsdiffbeforeafterboth
20use codec::{Encode, Decode, Error};20use codec::{Encode, Decode, Error};
2121
22/// Match errors from one type to another and return an error22/// Match errors from one type to another and return an error
23/// if a match is successful.23/// if a match is successful. This macro expects a pattern matcher
24#[macro_export]24#[macro_export]
25macro_rules! map_unique_err_to_proxy {25macro_rules! map_unique_err_to_proxy {
26 (match $err:ident { $($unique_err_ty:ident :: $unique_err:ident => $proxy_err:ident),+ $(,)? }) => {26 (match $err:ident { $($unique_err_ty:ident :: $unique_err:ident => $proxy_err:ident),+ $(,)? }) => {
34 };34 };
35}35}
3636
37/// Interface to decode bytes from a bounded vector into an arbitrary type.37/// Interface to decode some serialized bytes into an arbitrary type `T`,
38/// preferably if these bytes were originally encoded from `T`.
38pub trait RmrkDecode<T: Decode, S> {39pub trait RmrkDecode<T: Decode, S> {
39 /// Try to decode bytes from a bounded vector into an arbitrary type.40 /// Try to decode self into an arbitrary type `T`.
40 fn decode(&self) -> Result<T, Error>;41 fn decode(&self) -> Result<T, Error>;
41}42}
4243
48 }49 }
49}50}
5051
51/// Interface to "rebind", change the limit of a bounded byte vector.52/// Interface to "rebind" - change the limit of a bounded byte vector.
52pub trait RmrkRebind<T, S> {53pub trait RmrkRebind<T, S> {
53 /// Try to change the limit of a bounded byte vector.54 /// Try to change the limit of a bounded byte vector.
54 fn rebind(&self) -> Result<BoundedVec<u8, S>, Error>;55 fn rebind(&self) -> Result<BoundedVec<u8, S>, Error>;
modifiedpallets/proxy-rmrk-equip/src/lib.rsdiffbeforeafterboth
116//! is an unacceptable symbol in user-defined properties, which, along with other safeguards,116//! is an unacceptable symbol in user-defined properties, which, along with other safeguards,
117//! makes them impossible to tamper with.117//! makes them impossible to tamper with.
118//!118//!
119//! ### Collection and NFT Types, and Base, Parts and Themes Handling119//! ### Collection and NFT Types, or Base, Parts and Themes Handling
120//!120//!
121//! RMRK introduces the concept of a Base, which is a catalogue of Parts,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 functionality122//! possible components of an NFT. Due to its similarity with the functionality
414}414}
415415
416impl<T: Config> Pallet<T> {416impl<T: Config> Pallet<T> {
417 /// Create or renew an NFT serving as a Part inside a collection serving as a Base.417 /// Create (or overwrite) a Part in a Base.
418 /// The Part and the Base are represented as an NFT and a Collection.
418 fn create_part(419 fn create_part(
419 sender: &T::CrossAccountId,420 sender: &T::CrossAccountId,
420 collection: &NonfungibleHandle<T>,421 collection: &NonfungibleHandle<T>,