aboutsummaryrefslogtreecommitdiffstats
path: root/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol
blob: f019d2f144a33c1864756f49f97ff07b32a78a49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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. 
   * @param _start The earliest time ownership can be claimed.
   * @param _end The latest time ownership can be claimed. 
   */
  function setLimits(uint256 _start, uint256 _end) public onlyOwner {
    if (_start > _end)
        throw;
    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. 
   */
  function claimOwnership() public onlyPendingOwner {
    if ((block.number > end) || (block.number < start))
        throw;
    owner = pendingOwner;
    pendingOwner = address(0x0);
    end = 0;
  }

}