Created
October 25, 2019 14:49
-
-
Save beenhero/7a491787aa4346fcac4057bc4b6eccd0 to your computer and use it in GitHub Desktop.
Claimable.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: openzeppelin-solidity/contracts/ownership/Claimable.sol | |
/** | |
* @title Claimable | |
* @dev Extension for the Ownable contract, where the ownership needs to be claimed. | |
* This allows the new owner to accept the transfer. | |
*/ | |
contract Claimable is Ownable { | |
address public pendingOwner; | |
/** | |
* @dev Modifier throws if called by any account other than the pendingOwner. | |
*/ | |
modifier onlyPendingOwner() { | |
require(msg.sender == pendingOwner); | |
_; | |
} | |
/** | |
* @dev Allows the current owner to set the pendingOwner address. | |
* @param newOwner The address to transfer ownership to. | |
*/ | |
function transferOwnership(address newOwner) public onlyOwner { | |
pendingOwner = newOwner; | |
} | |
/** | |
* @dev Allows the pendingOwner address to finalize the transfer. | |
*/ | |
function claimOwnership() public onlyPendingOwner { | |
emit OwnershipTransferred(owner, pendingOwner); | |
owner = pendingOwner; | |
pendingOwner = address(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment