I have a smart contract lottery that requires people to send exactly 0.2 ethers to its address in order to participate.
In the constructor:
ante = 0.2 ether;
And in the payable function
require(msg.value == ante);
If someone sends the wrong amount, not only do do they lose the 0.2 ethers, but they also get penalized with extra ether. I tried sending 0.3 ethers on purpose from Metamask and I lost 0.45 ethers from my test account.
How do I avoid this?
Thanks