I'm reading ERC20.sol source code. There's a question about the approve function.
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
In the function, it requires owner != address(0) and spender != address(0). I just wonder should we do the amount check in the function? Such as:
require(amount <= _balances[owner]);
Thanks.