Does it make sense to make every function in an ERC20 Token Contract unpayable using

require(msg.value == 0);

just in case that someone accidentally sends eth to the contract.


No. A function requires the payable modifier to receive ETH.

There's also a fallback (no name) function that can be made payable or not. But it must be made payable.

Keep in mind inheritance if you're using libraries/frameworks.

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.