Claimable.sol 943 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. pragma solidity ^0.4.18;
  2. import "./Ownable.sol";
  3. /**
  4. * @title Claimable
  5. * @dev Extension for the Ownable contract, where the ownership needs to be claimed.
  6. * This allows the new owner to accept the transfer.
  7. */
  8. contract Claimable is Ownable {
  9. address public pendingOwner;
  10. /**
  11. * @dev Modifier throws if called by any account other than the pendingOwner.
  12. */
  13. modifier onlyPendingOwner() {
  14. require(msg.sender == pendingOwner);
  15. _;
  16. }
  17. /**
  18. * @dev Allows the current owner to set the pendingOwner address.
  19. * @param newOwner The address to transfer ownership to.
  20. */
  21. function transferOwnership(address newOwner) onlyOwner public {
  22. pendingOwner = newOwner;
  23. }
  24. /**
  25. * @dev Allows the pendingOwner address to finalize the transfer.
  26. */
  27. function claimOwnership() onlyPendingOwner public {
  28. OwnershipTransferred(owner, pendingOwner);
  29. owner = pendingOwner;
  30. pendingOwner = address(0);
  31. }
  32. }