Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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.
payable
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.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.