github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/execution/testdata/Ownable.sol (about)

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