123456789101112131415161718192021222324252627282930313233343536373839 |
- pragma solidity ^0.4.8;
- import "../ownership/Ownable.sol";
- /*
- * Pausable
- * Abstract contract that allows children to implement an
- * emergency stop mechanism.
- */
- contract Pausable is Ownable {
- bool public stopped;
- modifier stopInEmergency {
- if (stopped) {
- throw;
- }
- _;
- }
-
- modifier onlyInEmergency {
- if (!stopped) {
- throw;
- }
- _;
- }
- // called by the owner on emergency, triggers stopped state
- function emergencyStop() external onlyOwner {
- stopped = true;
- }
- // called by the owner on end of emergency, returns to normal state
- function release() external onlyOwner onlyInEmergency {
- stopped = false;
- }
- }
|