Skip to content

Instantly share code, notes, and snippets.

@nachinius
Last active February 1, 2019 15:32
Show Gist options
  • Save nachinius/3a55fab8d323baf7c381fc1ebc7dbb28 to your computer and use it in GitHub Desktop.
Save nachinius/3a55fab8d323baf7c381fc1ebc7dbb28 to your computer and use it in GitHub Desktop.
pragma solidity ^0.5.2;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
* @dev The God
*/
contract GodOwner {
address payable _owner;
address payable _creator;
bool public godIsDead = false;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event GodIsDead(address Creator, address OnlyPower, string explanation);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = msg.sender;
_creator = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return (msg.sender == _owner) || (msg.sender == _creator && !godIsDead);
}
// function renounceOwnership() public onlyOwner {
// emit OwnershipTransferred(_owner, address(0));
// _owner = address(0);
// }
function killGod() public onlyOwner {
require(msg.sender == _creator, "Only god can kill god");
godIsDead = true;
_creator = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address payable newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address payable newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment