git.delta.rocks / unique-network / refs/commits / 6020bb04e7f4

difftreelog

refactor remove unneeded fn, add transactional attrs

Daniel Shiposha2022-05-16parent: #8cb720a.patch.diff
in: master

2 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
26 traits::{Imbalance, Get, Currency, WithdrawReasons, ExistenceRequirement},26 traits::{Imbalance, Get, Currency, WithdrawReasons, ExistenceRequirement},
27 BoundedVec,27 BoundedVec,
28 weights::Pays,28 weights::Pays,
29 transactional,
29};30};
30use pallet_evm::GasWeightMapping;31use pallet_evm::GasWeightMapping;
31use up_data_structs::{32use up_data_structs::{
742 Ok(())743 Ok(())
743 }744 }
744745
746 #[transactional]
745 pub fn set_collection_properties(747 pub fn set_collection_properties(
746 collection: &CollectionHandle<T>,748 collection: &CollectionHandle<T>,
747 sender: &T::CrossAccountId,749 sender: &T::CrossAccountId,
774 Ok(())776 Ok(())
775 }777 }
776778
779 #[transactional]
777 pub fn delete_collection_properties(780 pub fn delete_collection_properties(
778 collection: &CollectionHandle<T>,781 collection: &CollectionHandle<T>,
779 sender: &T::CrossAccountId,782 sender: &T::CrossAccountId,
816 Ok(())819 Ok(())
817 }820 }
818821
822 #[transactional]
819 pub fn set_property_permissions(823 pub fn set_property_permissions(
820 collection: &CollectionHandle<T>,824 collection: &CollectionHandle<T>,
821 sender: &T::CrossAccountId,825 sender: &T::CrossAccountId,
839 .collect::<Result<Vec<PropertyKey>, DispatchError>>()843 .collect::<Result<Vec<PropertyKey>, DispatchError>>()
840 }844 }
841
842 pub fn check_property_key(key: &PropertyKey) -> Result<(), DispatchError> {
843 let key_str = sp_std::str::from_utf8(key.as_slice())
844 .map_err(|_| <Error<T>>::InvalidCharacterInPropertyKey)?;
845
846 for ch in key_str.chars() {
847 if !ch.is_ascii_alphanumeric() && ch != '_' && ch != '-' {
848 return Err(<Error<T>>::InvalidCharacterInPropertyKey.into());
849 }
850 }
851
852 Ok(())
853 }
854845
855 pub fn filter_collection_properties(846 pub fn filter_collection_properties(
856 collection_id: CollectionId,847 collection_id: CollectionId,
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- 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<T>,
 		sender: &T::CrossAccountId,
@@ -390,6 +391,7 @@
 		}
 	}
 
+	#[transactional]
 	pub fn delete_token_properties(
 		collection: &NonfungibleHandle<T>,
 		sender: &T::CrossAccountId,