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
--- 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<T>,
 		sender: &T::CrossAccountId,
@@ -774,6 +776,7 @@
 		Ok(())
 	}
 
+	#[transactional]
 	pub fn delete_collection_properties(
 		collection: &CollectionHandle<T>,
 		sender: &T::CrossAccountId,
@@ -816,6 +819,7 @@
 		Ok(())
 	}
 
+	#[transactional]
 	pub fn set_property_permissions(
 		collection: &CollectionHandle<T>,
 		sender: &T::CrossAccountId,
@@ -837,19 +841,6 @@
 					.map_err(|_| <Error<T>>::UnableToReadUnboundedKeys.into())
 			})
 			.collect::<Result<Vec<PropertyKey>, DispatchError>>()
-	}
-
-	pub fn check_property_key(key: &PropertyKey) -> Result<(), DispatchError> {
-		let key_str = sp_std::str::from_utf8(key.as_slice())
-			.map_err(|_| <Error<T>>::InvalidCharacterInPropertyKey)?;
-
-		for ch in key_str.chars() {
-			if !ch.is_ascii_alphanumeric() && ch != '_' && ch != '-' {
-				return Err(<Error<T>>::InvalidCharacterInPropertyKey.into());
-			}
-		}
-
-		Ok(())
 	}
 
 	pub fn filter_collection_properties(
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
1818
19use erc::ERC721Events;19use erc::ERC721Events;
20use evm_coder::ToLog;20use evm_coder::ToLog;
21use frame_support::{BoundedVec, ensure, fail};21use frame_support::{BoundedVec, ensure, fail, transactional};
22use up_data_structs::{22use up_data_structs::{
23 AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,23 AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData, CreateNftExData,
24 mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission,24 mapping::TokenAddressMapping, NestingRule, budget::Budget, Property, PropertyPermission,
307 Ok(())307 Ok(())
308 }308 }
309309
310 #[transactional]
310 pub fn set_token_properties(311 pub fn set_token_properties(
311 collection: &NonfungibleHandle<T>,312 collection: &NonfungibleHandle<T>,
312 sender: &T::CrossAccountId,313 sender: &T::CrossAccountId,
390 }391 }
391 }392 }
392393
394 #[transactional]
393 pub fn delete_token_properties(395 pub fn delete_token_properties(
394 collection: &NonfungibleHandle<T>,396 collection: &NonfungibleHandle<T>,
395 sender: &T::CrossAccountId,397 sender: &T::CrossAccountId,