2017-07-05 10:28:15 +00:00
|
|
|
pragma solidity ^0.4.11;
|
|
|
|
|
|
|
|
|
|
|
|
import "../ownership/Ownable.sol";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @title Pausable
|
|
|
|
* @dev Base contract which allows children to implement an emergency stop mechanism.
|
|
|
|
*/
|
|
|
|
contract Pausable is Ownable {
|
|
|
|
event Pause();
|
|
|
|
event Unpause();
|
|
|
|
|
|
|
|
bool public paused = false;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev modifier to allow actions only when the contract IS paused
|
|
|
|
*/
|
|
|
|
modifier whenNotPaused() {
|
2018-07-11 23:49:00 +00:00
|
|
|
if (paused) revert();
|
2017-07-05 10:28:15 +00:00
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev modifier to allow actions only when the contract IS NOT paused
|
|
|
|
*/
|
|
|
|
modifier whenPaused {
|
2018-07-11 23:49:00 +00:00
|
|
|
if (!paused) revert();
|
2017-07-05 10:28:15 +00:00
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev called by the owner to pause, triggers stopped state
|
|
|
|
*/
|
2018-07-04 17:20:51 +00:00
|
|
|
function pause() public onlyOwner whenNotPaused returns (bool) {
|
2017-07-05 10:28:15 +00:00
|
|
|
paused = true;
|
2018-06-27 08:35:38 +00:00
|
|
|
emit Pause();
|
2017-07-05 10:28:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev called by the owner to unpause, returns to normal state
|
|
|
|
*/
|
2018-07-04 17:20:51 +00:00
|
|
|
function unpause() public onlyOwner whenPaused returns (bool) {
|
2017-07-05 10:28:15 +00:00
|
|
|
paused = false;
|
2018-06-27 08:35:38 +00:00
|
|
|
emit Unpause();
|
2017-07-05 10:28:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|