CodeWars SPOILER
I'm trying to learn by doing, and I'm pretty confused. I'm working on a kata for making a coin and sending it to others. My solution fails the test because it says I'm not checking the balance, but I've got this line as the first command in the function:
require( (amount > 0) && (balanceOf(msg.sender) >= amount) );
I've looked at the other solutions that passed and they all use an if statement:
if(balanceOf(msg.sender) < amount) return;
Are there limits to how many require() statements I have in a contract or function?
From what I've read, I thought require() is always preferred as the cheapest (least gas) way of checking something and failing gracefully. I can obviously just write an if statement...
I just need to know if I'm missing something or if the kata test is just borked.
require(amount > 0)
is technically wrong. ERC20 says that aTransfer
event should still fire when theamount
is 0.