Files
openzeppelin-contracts/contracts/token/ERC20/ERC20Pausable.sol
Nicolás Venturo c9630526e2 Draft and lifecycles directories cleanup (#2122)
* Move Pausable into utils

* Move Strings into utils

* Move Counters into utils

* Move SignedSafeMath into math

* Remove ERC1046

* Make ERC20Snapshot.snapshot internal

* Move ERC20Snapshot into ERC20

* Add drafts deprecation notice

* Remove drafts directory

* Add changelog entry

* Apply suggestions from code review

Co-Authored-By: Francisco Giordano <frangio.1@gmail.com>

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
2020-03-16 16:27:15 -03:00

28 lines
784 B
Solidity

pragma solidity ^0.6.0;
import "./ERC20.sol";
import "../../utils/Pausable.sol";
/**
* @title Pausable token
* @dev ERC20 with pausable transfers and allowances.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
contract ERC20Pausable is ERC20, Pausable {
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
}