Ownable.sol 509 B

123456789101112131415161718192021222324252627282930
  1. pragma solidity ^0.4.8;
  2. /*
  3. * Ownable
  4. *
  5. * Base contract with an owner.
  6. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
  7. */
  8. contract Ownable {
  9. address public owner;
  10. function Ownable() {
  11. owner = msg.sender;
  12. }
  13. modifier onlyOwner() {
  14. if (msg.sender != owner) {
  15. throw;
  16. }
  17. _;
  18. }
  19. function transferOwnership(address newOwner) onlyOwner {
  20. if (newOwner != address(0)) {
  21. owner = newOwner;
  22. }
  23. }
  24. }