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
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,