ERC20Pausable.sol 784 B

123456789101112131415161718192021222324252627
  1. pragma solidity ^0.6.0;
  2. import "./ERC20.sol";
  3. import "../../utils/Pausable.sol";
  4. /**
  5. * @title Pausable token
  6. * @dev ERC20 with pausable transfers and allowances.
  7. *
  8. * Useful for scenarios such as preventing trades until the end of an evaluation
  9. * period, or having an emergency switch for freezing all token transfers in the
  10. * event of a large bug.
  11. */
  12. contract ERC20Pausable is ERC20, Pausable {
  13. /**
  14. * @dev See {ERC20-_beforeTokenTransfer}.
  15. *
  16. * Requirements:
  17. *
  18. * - the contract must not be paused.
  19. */
  20. function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
  21. super._beforeTokenTransfer(from, to, amount);
  22. require(!paused(), "ERC20Pausable: token transfer while paused");
  23. }
  24. }