difftreelog
feat(rmrk) move internal rmrk id to property
in: master
2 files changed
pallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-core/src/lib.rs
+++ b/pallets/proxy-rmrk-core/src/lib.rs
@@ -68,10 +68,6 @@
pub type UniqueCollectionId<T: Config> =
StorageMap<_, Twox64Concat, RmrkCollectionId, CollectionId, ValueQuery>;
- #[pallet::storage]
- pub type RmrkInernalCollectionId<T: Config> =
- StorageMap<_, Twox64Concat, CollectionId, RmrkCollectionId, ValueQuery>;
-
#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(_);
@@ -225,8 +221,13 @@
let rmrk_collection_id = <CollectionIndex<T>>::get();
<UniqueCollectionId<T>>::insert(rmrk_collection_id, unique_collection_id);
- <RmrkInernalCollectionId<T>>::insert(unique_collection_id, rmrk_collection_id);
+ <PalletCommon<T>>::set_scoped_collection_property(
+ unique_collection_id,
+ PropertyScope::Rmrk,
+ Self::rmrk_property(RmrkInternalCollectionId, &rmrk_collection_id)?
+ )?;
+
<CollectionIndex<T>>::mutate(|n| *n += 1);
Self::deposit_event(Event::CollectionCreated {
@@ -1318,8 +1319,10 @@
pub fn rmrk_collection_id(
unique_collection_id: CollectionId,
) -> Result<RmrkCollectionId, DispatchError> {
- <RmrkInernalCollectionId<T>>::try_get(unique_collection_id)
- .map_err(|_| <Error<T>>::CollectionUnknown.into())
+ Self::get_collection_property_decoded(
+ unique_collection_id,
+ RmrkInternalCollectionId
+ )
}
pub fn get_nft_collection(
pallets/proxy-rmrk-core/src/property.rsdiffbeforeafterboth20pub enum RmrkProperty<'r> {20pub enum RmrkProperty<'r> {21 Metadata,21 Metadata,22 CollectionType,22 CollectionType,23 RmrkInternalCollectionId,23 TokenType,24 TokenType,24 Transferable,25 Transferable,25 RoyaltyInfo,26 RoyaltyInfo,66 match self {67 match self {67 Self::Metadata => key!("metadata"),68 Self::Metadata => key!("metadata"),68 Self::CollectionType => key!("collection-type"),69 Self::CollectionType => key!("collection-type"),70 Self::RmrkInternalCollectionId => key!("internal-id"),69 Self::TokenType => key!("token-type"),71 Self::TokenType => key!("token-type"),70 Self::Transferable => key!("transferable"),72 Self::Transferable => key!("transferable"),71 Self::RoyaltyInfo => key!("royalty-info"),73 Self::RoyaltyInfo => key!("royalty-info"),