I am wondering about the efficiency of the implementation of the supply capping mechanism in ERC20Capped.sol.
It seems each time a transfer is made, the _beforeTokenTransfer
function will be called to verify that the cap is not exceeded. Whereas it would seem more natural to inline this verification within the functions that may actually increase totalSupply
. Eg in the standard case the _mint
function.
Incidentally, the error messages "ERC20: mint to the zero address"
, "ERC20: burn from the zero address"
look inverted to me, one burns (mints) to (from) the zero address.