ERC20.sol transferFrom, why is require(currentAllowance >= amount) after _transfer?

In the file ERC20.sol, the transferFrom function first executes _transfer, then only later requires that currentAllowance >= amount. i understand that the transaction will revert in the event that currentAllowance >= amount is false, but why isn't this requirement checked before _transfer is called? this appears to be out of line with the standard best practice order of:

  • require
  • update state variables
  • do function

We're actually considering switching the order to be better aligned with best practices.

1 Like