You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.9 KiB
74 lines
1.9 KiB
5 years ago
|
pragma solidity ^0.6.0;
|
||
8 years ago
|
|
||
6 years ago
|
import "../GSN/Context.sol";
|
||
8 years ago
|
|
||
8 years ago
|
/**
|
||
6 years ago
|
* @dev Contract module which allows children to implement an emergency stop
|
||
|
* mechanism that can be triggered by an authorized account.
|
||
|
*
|
||
|
* This module is used through inheritance. It will make available the
|
||
|
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
|
||
|
* the functions of your contract. Note that they will not be pausable by
|
||
|
* simply including this module, only once the modifiers are put in place.
|
||
9 years ago
|
*/
|
||
5 years ago
|
contract Pausable is Context {
|
||
6 years ago
|
/**
|
||
|
* @dev Emitted when the pause is triggered by a pauser (`account`).
|
||
|
*/
|
||
6 years ago
|
event Paused(address account);
|
||
6 years ago
|
|
||
|
/**
|
||
|
* @dev Emitted when the pause is lifted by a pauser (`account`).
|
||
|
*/
|
||
6 years ago
|
event Unpaused(address account);
|
||
|
|
||
|
bool private _paused;
|
||
|
|
||
6 years ago
|
/**
|
||
|
* @dev Initializes the contract in unpaused state. Assigns the Pauser role
|
||
|
* to the deployer.
|
||
|
*/
|
||
6 years ago
|
constructor () internal {
|
||
|
_paused = false;
|
||
|
}
|
||
|
|
||
|
/**
|
||
6 years ago
|
* @dev Returns true if the contract is paused, and false otherwise.
|
||
6 years ago
|
*/
|
||
|
function paused() public view returns (bool) {
|
||
|
return _paused;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dev Modifier to make a function callable only when the contract is not paused.
|
||
|
*/
|
||
|
modifier whenNotPaused() {
|
||
6 years ago
|
require(!_paused, "Pausable: paused");
|
||
6 years ago
|
_;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dev Modifier to make a function callable only when the contract is paused.
|
||
|
*/
|
||
|
modifier whenPaused() {
|
||
6 years ago
|
require(_paused, "Pausable: not paused");
|
||
6 years ago
|
_;
|
||
|
}
|
||
|
|
||
|
/**
|
||
6 years ago
|
* @dev Called by a pauser to pause, triggers stopped state.
|
||
6 years ago
|
*/
|
||
5 years ago
|
function _pause() internal virtual whenNotPaused {
|
||
6 years ago
|
_paused = true;
|
||
6 years ago
|
emit Paused(_msgSender());
|
||
6 years ago
|
}
|
||
|
|
||
|
/**
|
||
6 years ago
|
* @dev Called by a pauser to unpause, returns to normal state.
|
||
6 years ago
|
*/
|
||
5 years ago
|
function _unpause() internal virtual whenPaused {
|
||
6 years ago
|
_paused = false;
|
||
6 years ago
|
emit Unpaused(_msgSender());
|
||
6 years ago
|
}
|
||
9 years ago
|
}
|