git.delta.rocks / unique-network / refs/commits / a87d1032a92f

difftreelog

fix add weight to RFT and NFT eth methods

Grigoriy Simonov2022-12-15parent: #42f53fc.patch.diff
in: master

2 files changed

modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
59 /// @param isMutable Permission to mutate property.59 /// @param isMutable Permission to mutate property.
60 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.60 /// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.
61 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.61 /// @param tokenOwner Permission to mutate property by token owner if property is mutable.
62 #[weight(<SelfWeightOf<T>>::set_token_property_permissions(1))]
62 fn set_token_property_permission(63 fn set_token_property_permission(
63 &mut self,64 &mut self,
64 caller: caller,65 caller: caller,
91 /// @param key Property key.92 /// @param key Property key.
92 /// @param value Property value.93 /// @param value Property value.
93 #[solidity(hide)]94 #[solidity(hide)]
95 #[weight(<SelfWeightOf<T>>::set_token_properties(1))]
94 fn set_property(96 fn set_property(
95 &mut self,97 &mut self,
96 caller: caller,98 caller: caller,
166 /// @param tokenId ID of the token.168 /// @param tokenId ID of the token.
167 /// @param key Property key.169 /// @param key Property key.
168 #[solidity(hide)]170 #[solidity(hide)]
171 #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]
169 fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {172 fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {
170 let caller = T::CrossAccountId::from_eth(caller);173 let caller = T::CrossAccountId::from_eth(caller);
171 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;174 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
185 /// @dev Throws error if `msg.sender` has no permission to edit the property.188 /// @dev Throws error if `msg.sender` has no permission to edit the property.
186 /// @param tokenId ID of the token.189 /// @param tokenId ID of the token.
187 /// @param keys Properties key.190 /// @param keys Properties key.
191 #[weight(<SelfWeightOf<T>>::delete_token_properties(keys.len() as u32))]
188 fn delete_properties(192 fn delete_properties(
189 &mut self,193 &mut self,
190 token_id: uint256,194 token_id: uint256,
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -62,6 +62,7 @@
 	/// @param isMutable Permission to mutate property.
 	/// @param collectionAdmin Permission to mutate property by collection admin if property is mutable.
 	/// @param tokenOwner Permission to mutate property by token owner if property is mutable.
+	#[weight(<SelfWeightOf<T>>::set_token_property_permissions(1))]
 	fn set_token_property_permission(
 		&mut self,
 		caller: caller,
@@ -94,6 +95,7 @@
 	/// @param key Property key.
 	/// @param value Property value.
 	#[solidity(hide)]
+	#[weight(<SelfWeightOf<T>>::set_token_properties(1))]
 	fn set_property(
 		&mut self,
 		caller: caller,
@@ -126,6 +128,7 @@
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
 	/// @param properties settable properties
+	#[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]
 	fn set_properties(
 		&mut self,
 		caller: caller,
@@ -168,6 +171,7 @@
 	/// @param tokenId ID of the token.
 	/// @param key Property key.
 	#[solidity(hide)]
+	#[weight(<SelfWeightOf<T>>::delete_token_properties(1))]
 	fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {
 		let caller = T::CrossAccountId::from_eth(caller);
 		let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -187,6 +191,7 @@
 	/// @dev Throws error if `msg.sender` has no permission to edit the property.
 	/// @param tokenId ID of the token.
 	/// @param keys Properties key.
+	#[weight(<SelfWeightOf<T>>::delete_token_properties(keys.len() as u32))]
 	fn delete_properties(
 		&mut self,
 		token_id: uint256,