|
|
|
pragma solidity ^0.4.24;
|
|
|
|
|
|
|
|
|
|
|
|
import "../ownership/Ownable.sol";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @title Pausable
|
|
|
|
* @dev Base contract which allows children to implement an emergency stop mechanism.
|
|
|
|
*/
|
|
|
|
contract Pausable is Ownable {
|
|
|
|
event Paused();
|
|
|
|
event Unpaused();
|
|
|
|
|
|
|
|
bool private paused_ = false;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return true if the contract is paused, false otherwise.
|
|
|
|
*/
|
|
|
|
function paused() public view returns(bool) {
|
|
|
|
return paused_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Modifier to make a function callable only when the contract is not paused.
|
|
|
|
*/
|
|
|
|
modifier whenNotPaused() {
|
|
|
|
require(!paused_);
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Modifier to make a function callable only when the contract is paused.
|
|
|
|
*/
|
|
|
|
modifier whenPaused() {
|
|
|
|
require(paused_);
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev called by the owner to pause, triggers stopped state
|
|
|
|
*/
|
|
|
|
function pause() public onlyOwner whenNotPaused {
|
|
|
|
paused_ = true;
|
|
|
|
emit Paused();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev called by the owner to unpause, returns to normal state
|
|
|
|
*/
|
|
|
|
function unpause() public onlyOwner whenPaused {
|
|
|
|
paused_ = false;
|
|
|
|
emit Unpaused();
|
|
|
|
}
|
|
|
|
}
|