From 6020bb04e7f44dc375bbe2971a748372ff62aeb9 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Mon, 16 May 2022 13:48:34 +0000 Subject: [PATCH] refactor: remove unneeded fn, add transactional attrs --- --- a/pallets/common/src/lib.rs +++ b/pallets/common/src/lib.rs @@ -26,6 +26,7 @@ traits::{Imbalance, Get, Currency, WithdrawReasons, ExistenceRequirement}, BoundedVec, weights::Pays, + transactional, }; use pallet_evm::GasWeightMapping; use up_data_structs::{ @@ -742,6 +743,7 @@ Ok(()) } + #[transactional] pub fn set_collection_properties( collection: &CollectionHandle, sender: &T::CrossAccountId, @@ -774,6 +776,7 @@ Ok(()) } + #[transactional] pub fn delete_collection_properties( collection: &CollectionHandle, sender: &T::CrossAccountId, @@ -816,6 +819,7 @@ Ok(()) } + #[transactional] pub fn set_property_permissions( collection: &CollectionHandle, sender: &T::CrossAccountId, @@ -837,19 +841,6 @@ .map_err(|_| >::UnableToReadUnboundedKeys.into()) }) .collect::, DispatchError>>() - } - - pub fn check_property_key(key: &PropertyKey) -> Result<(), DispatchError> { - let key_str = sp_std::str::from_utf8(key.as_slice()) - .map_err(|_| >::InvalidCharacterInPropertyKey)?; - - for ch in key_str.chars() { - if !ch.is_ascii_alphanumeric() && ch != '_' && ch != '-' { - return Err(>::InvalidCharacterInPropertyKey.into()); - } - } - - Ok(()) } pub fn filter_collection_properties( --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -18,7 +18,7 @@ use erc::ERC721Events; use evm_coder::ToLog; -use frame_support::{BoundedVec, ensure, fail}; +use frame_support::{BoundedVec, ensure, fail, transactional}; use up_data_structs::{ AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData, mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission, @@ -307,6 +307,7 @@ Ok(()) } + #[transactional] pub fn set_token_properties( collection: &NonfungibleHandle, sender: &T::CrossAccountId, @@ -390,6 +391,7 @@ } } + #[transactional] pub fn delete_token_properties( collection: &NonfungibleHandle, sender: &T::CrossAccountId, -- gitstuff