Claimable.sol 895 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. pragma solidity ^0.4.11;
  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. if (msg.sender != pendingOwner) {
  15. throw;
  16. }
  17. _;
  18. }
  19. /**
  20. * @dev Allows the current owner to set the pendingOwner address.
  21. * @param newOwner The address to transfer ownership to.
  22. */
  23. function transferOwnership(address newOwner) onlyOwner {
  24. pendingOwner = newOwner;
  25. }
  26. /**
  27. * @dev Allows the pendingOwner address to finalize the transfer.
  28. */
  29. function claimOwnership() onlyPendingOwner {
  30. owner = pendingOwner;
  31. pendingOwner = 0x0;
  32. }
  33. }