Skip to content

Instantly share code, notes, and snippets.

@nareddyt
Created January 15, 2018 15:13
Show Gist options
  • Save nareddyt/07eb71a9b7e5321918699b1270b779b4 to your computer and use it in GitHub Desktop.
Save nareddyt/07eb71a9b7e5321918699b1270b779b4 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.19;
// Note that anyone can stop this contract from running!
// Only owner can restart it :)
contract PubliclyStoppable {
address public owner;
bool public stopped;
function PubliclyStoppable() public {
owner = msg.sender;
stopped = false;
}
modifier stopInEmergency {
require(!stopped);
_;
}
modifier onlyInEmergency {
require(stopped);
require(msg.sender == owner);
_;
}
function stop() external stopInEmergency {
stopped = true;
}
function start() external onlyInEmergency {
stopped = false;
}
}
contract TestNodeDDOS is PubliclyStoppable {
function loop1() public stopInEmergency constant returns (uint256) {
while (!stopped) {
uint256 temp = 1;
}
return 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment