solidity/test/compilationTests/zeppelin/ownership/Claimable.sol

41 lines
917 B
Solidity
Raw Normal View History

2017-07-05 10:28:15 +00:00
pragma solidity ^0.4.11;
import './Ownable.sol';
/**
* @title Claimable
* @dev Extension for the Ownable contract, where the ownership needs to be claimed.
2017-07-05 10:28:15 +00:00
* 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.
2017-07-05 10:28:15 +00:00
*/
modifier onlyPendingOwner() {
if (msg.sender != pendingOwner) {
revert();
2017-07-05 10:28:15 +00:00
}
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to.
2017-07-05 10:28:15 +00:00
*/
2018-07-04 17:20:51 +00:00
function transferOwnership(address newOwner) public onlyOwner {
2017-07-05 10:28:15 +00:00
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
2018-07-04 17:20:51 +00:00
function claimOwnership() public onlyPendingOwner {
2017-07-05 10:28:15 +00:00
owner = pendingOwner;
pendingOwner = address(0x0);
2017-07-05 10:28:15 +00:00
}
}