0

how do I debug this so the compiler isn't showing any warnings? or is there nothing wrong with it

from solidity:
Warning: Function state mutability can be restricted to view
  --> FireworkToken.sol:19:5:
   |
19 |     function balanceOf(address owner) 
   |     ^ (Relevant source part starts here and spans across multiple lines).
1

1 Answer 1

0

The function its referring to does not modify and state variables of the contract when you get this warning. Its best practice to add the view modifier to functions that do not modify state. Here is a post with some detailed reason of why we want to do this. Is there any profit from using pure and view functions modifiers?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.