git.delta.rocks / unique-network / refs/commits / 7faf112aedc7

difftreelog

fix rmrk_property macro

Daniel Shiposha2022-05-18parent: #4e0b740.patch.diff
in: master

2 files changed

modifiedpallets/rmrk-proxy/src/misc.rsdiffbeforeafterboth
--- a/pallets/rmrk-proxy/src/misc.rs
+++ b/pallets/rmrk-proxy/src/misc.rs
@@ -1,19 +1,24 @@
 use super::*;
 use codec::{Encode, Decode};
+use frame_support::dispatch::Vec;
 use pallet_nonfungible::NonfungibleHandle;
 
 #[macro_export]
 macro_rules! rmrk_property {
     ($key:ident, $value:expr) => {
         Property {
-            key: rmrk_property!($key),
+            key: rmrk_property!(@raw $key),
             value: $value.into()
         }
     };
 
-    ($key:ident) => {
+    (@raw $key:ident) => {
         RmrkProperty::$key.to_key()
     };
+
+    ($key:ident) => {
+        PropertyScope::Rmrk.apply(rmrk_property!(@raw $key)).unwrap()
+    };
 }
 
 macro_rules! impl_rmrk_value {
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
678 }678 }
679}679}
680680
681#[derive(Debug)]
681pub enum PropertiesError {682pub enum PropertiesError {
682 NoSpaceForProperty,683 NoSpaceForProperty,
683 PropertyLimitReached,684 PropertyLimitReached,
693}694}
694695
695impl PropertyScope {696impl PropertyScope {
696 fn apply(self, key: PropertyKey) -> Result<PropertyKey, PropertiesError> {697 pub fn apply(self, key: PropertyKey) -> Result<PropertyKey, PropertiesError> {
697 let scope_str: &[u8] = match self {698 let scope_str: &[u8] = match self {
698 Self::None => return Ok(key),699 Self::None => return Ok(key),
699 Self::Rmrk => b"rmrk",700 Self::Rmrk => b"rmrk",