Skip to content

Instantly share code, notes, and snippets.

@igroomgrim
Last active March 30, 2018 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igroomgrim/ba780bacdcedfe9a2051906dc721a0bb to your computer and use it in GitHub Desktop.
Save igroomgrim/ba780bacdcedfe9a2051906dc721a0bb to your computer and use it in GitHub Desktop.
Funny example for Thailand 0.4 Election system
pragma solidity ^0.4.18;
import './Thailand.sol';
contract ThailandMilitaryPower is Thailand {
uint256 public curfewStartTime;
uint256 public curfewEndTime;
// Modifier
modifier whoHasATank() {
require(msg.sender == commanderInChief);
_;
}
function declareCoup() public whoHasATank {
_transformToPrimeMinister(commanderInChief);
address _goverment = this;
commanderInChief.transfer(_goverment.balance);
// In the real world case, it should be call selfdestruct :p
// suicide(commanderInChief);
}
function imposeCurfew(uint256 _startTime, uint256 _endTime) public whoHasATank {
curfewStartTime = _startTime;
curfewEndTime = _endTime;
}
function arrest(address _victim) public whoHasATank {
prisoners[_victim] = true;
}
function _transformToPrimeMinister(address _theChoosenOne) internal {
primeMinister = _theChoosenOne;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment