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