1. 所有合约的基类

#define CONTRACT class [[eosio::contract]] // 合约
#define ACTION [[eosio::action]] //动作
#define TABLE struct [[eosio::table]] //表

namespace eosio{/*** new contract should derive from this class, so it can make use of eosio_ABI macro.*/
class contract {public:/*** Construct a new contract given the contract name** @param self - The name of the account this contract is deployed on* @param first_receiver - The account the incoming action was first received at.* @param ds - The datastream used*/contract( name self, name first_receiver, datastream<const char*> ds ):_self(self),_first_receiver(first_receiver),_ds(ds) {}/***       * Get this contract name       ** @return name - The name of this contract*/inline name get_self()const { return _self; }/*** The first_receiver name of the action this contract is processing.** @return name - The first_receiver name of the action this contract is processing.*/[[deprecated]]inline name get_code()const { return _first_receiver; }/*** The account the incoming action was first received at.** @return name - The first_receiver name of the action this contract is processing.*/inline name get_first_receiver()const { return _first_receiver; }/*** Get the datastream for this contract** @return datastream<const char*> - The datastream for this contract*/inline datastream<const char*>& get_datastream() { return _ds; }/*** Get the datastream for this contract** @return datastream<const char*> - The datastream for this contract*/inline const datastream<const char*>& get_datastream()const { return _ds; }protected:/**       * The name of the account this contract is deployed on.       */name _self;//合约的名字,准确的说,是部署当前合约的账号/**       * The account the incoming action was first received at.       */name _first_receiver;//调用合约 动作的账号,一般是当前合约所在的账号/**       * The datastream for this contract       */datastream<const char*> _ds = datastream<const char*>(nullptr, 0);// 保存了那些使用 eosio::ignore 忽略的字段
};

EOS 智能合约源代码解读 (5)class contract相关推荐

  1. EOS 智能合约源代码解读 (11)wrap合约“action_wrapper类”

    1. 功能 对于许多用例,需要从合同代码向另一个合同发送新操作.这是合同之间能够积极沟通的唯一途径.它为特定智能合约代码的特定操作创建"操作模板",然后可使用该模板来调用此操作. ...

  2. EOS 智能合约源代码解读 (7)合约开发示例

    官方提供了一个工具eosiocpp,它可以按照固定的模板创建一个新的智能合约.eosiocpp可以创建2个合约文件(曾经是三个文件),它们仅仅包含了合约的框架. 1. HelloWorld合约代码如下 ...

  3. EOS 智能合约源代码解读 (1)总体说明

    1. 基本定义 在eos私有节点操作中,我们通常是一个合约对应一个合约账户,并且一个账户中只能部署一个智能合约.如果在同一个账户部署多个合约,那么最后部署的合约会覆盖掉之前的合约.每个帐户都至少链接到 ...

  4. EOS 智能合约源代码解读 (6)合约之action

    1. 动作 ( action ) 是 EOS 合约的灵魂,是 EOS 的基础组成单位 1.1 一个动作就是一个公开的 ( pubic ) 的 C++ 类的成员方法 必须使用 [[eosio::acti ...

  5. EOS 智能合约源代码解读 (14)system合约“exchange_state.hpp”

    1. 使用bancor数学创建一个在两种资产类型中的50/50的中继 namespace eosiosystem {using eosio::asset;using eosio::symbol;typ ...

  6. EOS 智能合约源代码解读 (10)token合约“几种关键操作”

    1. create:负责创建资产 void token::create( const text_name& issuer, const asset& maximum_supply) { ...

  7. EOS 智能合约源代码解读 (10)token合约“简介”

    1. 记录用户的token,比如有哪些代币 class [[eosio::contract("eosio.token")]] token : public contract {pu ...

  8. EOS 智能合约源代码解读 (3)asset.hpp

    1. 合约中关于资产的数据结构的定义 输入字符串: "10.0000 CUR" 输出:amount = 10, symbol(4,"CUR") /**asset ...

  9. EOS 智能合约源代码解读 (9)boot合约

    1. 作用 激活 protocol features 性质 activating desired protocol features prior to deploying a system contr ...

最新文章

  1. Linux内核网络栈1.2.13-socket.c函数概述
  2. 图解ARP协议分析实例
  3. pyhton 反转单词顺序
  4. DynamipsGUI
  5. 用Express、MySQL搭建项目(接口以及静态文件获取、文件上传等)
  6. 《xUnit Test Patterns》学习笔记4 - Principles of Test Automation
  7. 面试题系列(10):一个大型电商网有大量的图片,加载很慢,你有哪些方法优化这些图片的加载?...
  8. java大数据组件Zookeeper
  9. triz矛盾矩阵_TRIZ 创新方法 培训 之TRIZ 公开课 大纲 三天 班
  10. Android 使用GridView以表格的形式显示多张图片
  11. 今天修了一个bug,关于debug日志的问题
  12. 帆软报表帮助文档_给大家分享一款值得推荐的免费好用的web报表插件
  13. excel删除行闪退_xp系统打开excel表格就闪退怎么回事_xp打开excel表格闪退如何解决...
  14. java购物系统需求分析_java网上购物系统需求分析.doc
  15. Log4j有哪几种日志级别呢?
  16. linux运行直播软件,在Linux下可用Wine安装和运行虎牙直播、斗鱼直播
  17. CUDA Programming Model--CUDA编程模型
  18. 初识selenium--发送QQ邮件
  19. timeval 计时器
  20. DCloud是什么?

热门文章

  1. SpringBoot:Inferred type 'S' for type parameter 'S' is not within its bound
  2. 11MYSQL:慢查询以及优化步骤
  3. Andriod --- JetPack (三):ViewModel 的诞生
  4. 【Scratch】青少年蓝桥杯_每日一题_4.19_考试成绩
  5. android pod 组件化_使用 Pod 实现私有模块化管理(组件化 Pods 实现方案)
  6. 奇安信为什么大量招人_券商招人鄙视链:985学历vs美本学历,究竟谁垫底?
  7. 这份门禁系统培训PPT也太全面了,门禁系统知识,看这一篇就够了
  8. 五大关键物联网应用助力优化数据中心基础设施管理
  9. 数据中心设计的六个关键考虑因素
  10. ensp启动设备蓝屏_为什么早期的Windows经常死机蓝屏,现在却很少发生?这些你都知道吗?...