Ownable.sol 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. pragma solidity ^0.4.18;
  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. event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
  10. /**
  11. * @dev The Ownable constructor sets the original `owner` of the contract to the sender
  12. * account.
  13. */
  14. function Ownable() public {
  15. owner = msg.sender;
  16. }
  17. /**
  18. * @dev Throws if called by any account other than the owner.
  19. */
  20. modifier onlyOwner() {
  21. require(msg.sender == owner);
  22. _;
  23. }
  24. /**
  25. * @dev Allows the current owner to transfer control of the contract to a newOwner.
  26. * @param newOwner The address to transfer ownership to.
  27. */
  28. function transferOwnership(address newOwner) public onlyOwner {
  29. require(newOwner != address(0));
  30. OwnershipTransferred(owner, newOwner);
  31. owner = newOwner;
  32. }
  33. }