|
|
|
@ -234,6 +234,8 @@ contract ERC20 is Context, IERC20, IERC20Metadata { |
|
|
|
|
_balances[recipient] += amount; |
|
|
|
|
|
|
|
|
|
emit Transfer(sender, recipient, amount); |
|
|
|
|
|
|
|
|
|
_afterTokenTransfer(sender, recipient, amount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** @dev Creates `amount` tokens and assigns them to `account`, increasing |
|
|
|
@ -253,6 +255,8 @@ contract ERC20 is Context, IERC20, IERC20Metadata { |
|
|
|
|
_totalSupply += amount; |
|
|
|
|
_balances[account] += amount; |
|
|
|
|
emit Transfer(address(0), account, amount); |
|
|
|
|
|
|
|
|
|
_afterTokenTransfer(address(0), account, amount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -279,6 +283,8 @@ contract ERC20 is Context, IERC20, IERC20Metadata { |
|
|
|
|
_totalSupply -= amount; |
|
|
|
|
|
|
|
|
|
emit Transfer(account, address(0), amount); |
|
|
|
|
|
|
|
|
|
_afterTokenTransfer(account, address(0), amount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -313,7 +319,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata { |
|
|
|
|
* Calling conditions: |
|
|
|
|
* |
|
|
|
|
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens |
|
|
|
|
* will be to transferred to `to`. |
|
|
|
|
* will be transferred to `to`. |
|
|
|
|
* - when `from` is zero, `amount` tokens will be minted for `to`. |
|
|
|
|
* - when `to` is zero, `amount` of ``from``'s tokens will be burned. |
|
|
|
|
* - `from` and `to` are never both zero. |
|
|
|
@ -325,4 +331,24 @@ contract ERC20 is Context, IERC20, IERC20Metadata { |
|
|
|
|
address to, |
|
|
|
|
uint256 amount |
|
|
|
|
) internal virtual {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Hook that is called after any transfer of tokens. This includes |
|
|
|
|
* minting and burning. |
|
|
|
|
* |
|
|
|
|
* Calling conditions: |
|
|
|
|
* |
|
|
|
|
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens |
|
|
|
|
* has been transferred to `to`. |
|
|
|
|
* - when `from` is zero, `amount` tokens have been minted for `to`. |
|
|
|
|
* - when `to` is zero, `amount` of ``from``'s tokens have been burned. |
|
|
|
|
* - `from` and `to` are never both zero. |
|
|
|
|
* |
|
|
|
|
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. |
|
|
|
|
*/ |
|
|
|
|
function _afterTokenTransfer( |
|
|
|
|
address from, |
|
|
|
|
address to, |
|
|
|
|
uint256 amount |
|
|
|
|
) internal virtual {} |
|
|
|
|
} |
|
|
|
|