Skip to content

Instantly share code, notes, and snippets.

@facuspagnuolo
Created January 10, 2018 22:07
Show Gist options
  • Save facuspagnuolo/71931c4acfd2e7d8250c73371cc7b2a1 to your computer and use it in GitHub Desktop.
Save facuspagnuolo/71931c4acfd2e7d8250c73371cc7b2a1 to your computer and use it in GitHub Desktop.
Ownable
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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment