0

example:

function addAllowedTokens(address _token) public onlyOwner {
        if (!tokenIsAllowed(_token)) {
            allowedTokens[_token] = true;
        }
    }

In this code, the allowedTokens mapping won't always be modified? I have a test that calls this functions and doesn't modify the mapping, and it passes but a lot of weird console stuff gets printed.

MORAL OF QUESTION IS: WHAT HAPPENS WHEN A NON-VIEW FUNCTION IS CALLED AND DOESN'T MODIFY THE SMART CONTRACT?

My intuition is that this should be fine and just run. But seems like something different may be happening.

1 Answer 1

0

It wastes gas because people will call it on-chain

1
  • Thank you thank you
    – tythereum
    Jan 7 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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