Skip to content

Instantly share code, notes, and snippets.

@nuuneoi
Created August 24, 2018 20:11
Show Gist options
  • Save nuuneoi/bfebdd056fd05ae9e713a069aa18d3ae to your computer and use it in GitHub Desktop.
Save nuuneoi/bfebdd056fd05ae9e713a069aa18d3ae to your computer and use it in GitHub Desktop.
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
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