Ownable.sol 948 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. pragma solidity ^0.4.8;
  2. /**
  3. * @title Ownable
  4. *
  5. * @dev The Ownable contract has an owner address, and provides basic authorization control
  6. * functions, this simplifies the implementation of "user permissions".
  7. */
  8. contract Ownable {
  9. address public owner;
  10. /**
  11. * @dev The Ownable constructor sets the original `owner` of the contract to the sender
  12. * account.
  13. */
  14. function Ownable() {
  15. owner = msg.sender;
  16. }
  17. /**
  18. * @dev The onlyOwner modifier throws if called by any account other than the owner.
  19. */
  20. modifier onlyOwner() {
  21. if (msg.sender != owner) {
  22. throw;
  23. }
  24. _;
  25. }
  26. /**
  27. * @dev The transferOwnership function allows the current owner to transfer control of the
  28. * contract to a newOwner.
  29. * @param newOwner The address to transfer ownership to.
  30. */
  31. function transferOwnership(address newOwner) onlyOwner {
  32. if (newOwner != address(0)) {
  33. owner = newOwner;
  34. }
  35. }
  36. }