ERC20Pausable.sol 932 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Pausable.sol)
  3. pragma solidity ^0.8.0;
  4. import "../ERC20.sol";
  5. import "../../../security/Pausable.sol";
  6. /**
  7. * @dev ERC20 token with pausable token transfers, minting and burning.
  8. *
  9. * Useful for scenarios such as preventing trades until the end of an evaluation
  10. * period, or having an emergency switch for freezing all token transfers in the
  11. * event of a large bug.
  12. */
  13. abstract contract ERC20Pausable is ERC20, Pausable {
  14. /**
  15. * @dev See {ERC20-_beforeTokenTransfer}.
  16. *
  17. * Requirements:
  18. *
  19. * - the contract must not be paused.
  20. */
  21. function _beforeTokenTransfer(
  22. address from,
  23. address to,
  24. uint256 amount
  25. ) internal virtual override {
  26. super._beforeTokenTransfer(from, to, amount);
  27. require(!paused(), "ERC20Pausable: token transfer while paused");
  28. }
  29. }