DelayedClaimable.sol 1022 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. pragma solidity ^0.4.11;
  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 {
  18. if (_start > _end)
  19. throw;
  20. end = _end;
  21. start = _start;
  22. }
  23. /**
  24. * @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
  25. * the specified start and end time.
  26. */
  27. function claimOwnership() onlyPendingOwner {
  28. if ((block.number > end) || (block.number < start))
  29. throw;
  30. owner = pendingOwner;
  31. pendingOwner = 0x0;
  32. end = 0;
  33. }
  34. }