contract Ownable {
    
  address public owner;
  
   //这里是个事件，供前端监听
  event OwnerEvent(address indexed previousOwner, address indexed newOwner);

  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.这是一个构造函数，在合约启动时只运行一次，将合约的地址赋给地址owner
   */
  constructor() public {
    owner = msg.sender;
  }


  /**
   * @dev Throws if called by any account other than the owner。这里就是modifier onlyOwner的修饰符，用来判定是否是合约的发布者
   * 
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }


  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   * 让合约拥有者修改指定新的合约拥有者，并调用事件来监听
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    emit OwnerEvent(owner, newOwner);
    owner = newOwner;
  }

}
function transferOwnership(address newOwner) public onlyOwner {
  require(newOwner != address(0));
  emit OwnerEvent(owner, newOwner);
  owner = newOwner;
}

/**
 * @dev Allows the current owner to transfer control of the contract to a newOwner.
 * @param newOwner The address to transfer ownership to.
 * 让合约拥有者修改指定新的合约拥有者，并调用事件来监听
 */