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.
41 lines
732 B
41 lines
732 B
pragma solidity ^0.4.8;
|
|
|
|
|
|
import "../ownership/Ownable.sol";
|
|
|
|
|
|
/*
|
|
* Pausable
|
|
* Abstract contract that allows children to implement a
|
|
* pause mechanism.
|
|
*/
|
|
contract Pausable is Ownable {
|
|
event Pause();
|
|
event Unpause();
|
|
|
|
bool public paused = false;
|
|
|
|
modifier whenNotPaused() {
|
|
if (paused) throw;
|
|
_;
|
|
}
|
|
|
|
modifier whenPaused {
|
|
if (!paused) throw;
|
|
_;
|
|
}
|
|
|
|
// called by the owner to pause, triggers stopped state
|
|
function pause() onlyOwner whenNotPaused returns (bool) {
|
|
paused = true;
|
|
Pause();
|
|
return true;
|
|
}
|
|
|
|
// called by the owner to unpause, returns to normal state
|
|
function unpause() onlyOwner whenPaused returns (bool) {
|
|
paused = false;
|
|
Unpause();
|
|
return true;
|
|
}
|
|
}
|
|
|