mirror of
https://github.com/fluencelabs/smartcontracts
synced 2025-04-25 11:12:16 +00:00
37 lines
818 B
Solidity
37 lines
818 B
Solidity
|
pragma solidity ^0.4.18;
|
||
|
|
||
|
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
|
||
|
|
||
|
/*
|
||
|
* Haltable
|
||
|
*
|
||
|
* Abstract contract that allows children to implement an
|
||
|
* emergency stop mechanism. Differs from Pausable by causing a throw when in halt mode.
|
||
|
*
|
||
|
*
|
||
|
* Originally envisioned in FirstBlood ICO contract.
|
||
|
*/
|
||
|
contract Haltable is Ownable {
|
||
|
bool public halted;
|
||
|
|
||
|
modifier stopInEmergency {
|
||
|
require(!halted);
|
||
|
_;
|
||
|
}
|
||
|
|
||
|
modifier onlyInEmergency {
|
||
|
require(halted);
|
||
|
_;
|
||
|
}
|
||
|
|
||
|
// called by the owner on emergency, triggers stopped state
|
||
|
function halt() external onlyOwner {
|
||
|
halted = true;
|
||
|
}
|
||
|
|
||
|
// called by the owner on end of emergency, returns to normal state
|
||
|
function unhalt() external onlyOwner onlyInEmergency {
|
||
|
halted = false;
|
||
|
}
|
||
|
|
||
|
}
|