Hello, how can i use beforetokenttransfer only when transfering and not when minting?
When minting the from
argument will be 0
, and when burning the to
argument is 0
.
So you can include an if statement like this:
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
if (from != address(0) && to != address(0)) {
// here it is a transfer
}
}