Ownable.sol 887 B

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