DelayedClaimable.sol 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. pragma solidity ^0.4.18;
  2. import "./Claimable.sol";
  3. /**
  4. * @title DelayedClaimable
  5. * @dev Extension for the Claimable contract, where the ownership needs to be claimed before/after
  6. * a certain block number.
  7. */
  8. contract DelayedClaimable is Claimable {
  9. uint256 public end;
  10. uint256 public start;
  11. /**
  12. * @dev Used to specify the time period during which a pending
  13. * owner can claim ownership.
  14. * @param _start The earliest time ownership can be claimed.
  15. * @param _end The latest time ownership can be claimed.
  16. */
  17. function setLimits(uint256 _start, uint256 _end) onlyOwner public {
  18. require(_start <= _end);
  19. end = _end;
  20. start = _start;
  21. }
  22. /**
  23. * @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
  24. * the specified start and end time.
  25. */
  26. function claimOwnership() onlyPendingOwner public {
  27. require((block.number <= end) && (block.number >= start));
  28. OwnershipTransferred(owner, pendingOwner);
  29. owner = pendingOwner;
  30. pendingOwner = address(0);
  31. end = 0;
  32. }
  33. }