Hi!
I'm a newbie. I have a question. Why function transferFrom
in lib not check allowance before exec _transfer
and require can revert data when the condition inside is failed?
the function here, code I get from github
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
Ths for you support.