我是靠谱客的博主 帅气哈密瓜,这篇文章主要介绍3.22 以太坊:以太猫源码分析2,现在分享给大家,希望可以做个参考。

00A. Ownable 合约:提供基本的认证控制

 // 提供基本的认证控制
contract Ownable {
  address public owner; 
  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  function Ownable() {
    owner = msg.sender;
  }
  /**
   * @dev Throws if called by any account other than the owner.
   */
   // 修改器 合约所有所有者控制
  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) onlyOwner {
    if (newOwner != address(0)) { // 新地址不能是空
      owner = newOwner;
    }
  }
}

00B. 基因接口(这是唯一一个没有开源的地方)

// 基因接口
contract GeneScienceInterface {
    /// @dev simply a boolean to indicate this is the contract we expec

最后

以上就是帅气哈密瓜最近收集整理的关于3.22 以太坊:以太猫源码分析2的全部内容,更多相关3.22内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部