Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created May 14, 2021 05:36
Show Gist options
  • Save percybolmer/46160d6e17a379f9817790a70ef8da7f to your computer and use it in GitHub Desktop.
Save percybolmer/46160d6e17a379f9817790a70ef8da7f to your computer and use it in GitHub Desktop.
/**
* @notice renounceOwnership will set the owner to zero address
* This will make the contract owner less, It will make ALL functions with
* onlyOwner no longer callable.
* There is no way of restoring the owner
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @notice transferOwnership will assign the {newOwner} as owner
*
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @notice _transferOwnership will assign the {newOwner} as owner
*
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment