--- 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(>::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(>::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(>::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(>::delete_token_properties(keys.len() as u32))] fn delete_properties( &mut self, token_id: uint256, --- 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(>::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(>::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(>::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(>::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(>::delete_token_properties(keys.len() as u32))] fn delete_properties( &mut self, token_id: uint256,