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

44 lines
1.0 KiB
Solidity
Raw Normal View History

2017-07-05 10:28:15 +00:00
pragma solidity ^0.4.11;
import './Claimable.sol';
/**
* @title DelayedClaimable
* @dev Extension for the Claimable contract, where the ownership needs to be claimed before/after
* a certain block number.
*/
contract DelayedClaimable is Claimable {
uint256 public end;
uint256 public start;
/**
* @dev Used to specify the time period during which a pending
* owner can claim ownership.
2017-07-05 10:28:15 +00:00
* @param _start The earliest time ownership can be claimed.
* @param _end The latest time ownership can be claimed.
2017-07-05 10:28:15 +00:00
*/
2018-07-04 17:20:51 +00:00
function setLimits(uint256 _start, uint256 _end) public onlyOwner {
2017-07-05 10:28:15 +00:00
if (_start > _end)
revert();
2017-07-05 10:28:15 +00:00
end = _end;
start = _start;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
* the specified start and end time.
2017-07-05 10:28:15 +00:00
*/
2018-07-04 17:20:51 +00:00
function claimOwnership() public onlyPendingOwner {
2017-07-05 10:28:15 +00:00
if ((block.number > end) || (block.number < start))
revert();
2017-07-05 10:28:15 +00:00
owner = pendingOwner;
pendingOwner = address(0x0);
2017-07-05 10:28:15 +00:00
end = 0;
}
}