EOS 智能合约源代码解读 (5)class contract

2024-03-28 08:48

本文主要是介绍EOS 智能合约源代码解读 (5)class contract,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

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的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/855093

相关文章

Python实现word文档内容智能提取以及合成

《Python实现word文档内容智能提取以及合成》这篇文章主要为大家详细介绍了如何使用Python实现从10个左右的docx文档中抽取内容,再调整语言风格后生成新的文档,感兴趣的小伙伴可以了解一下... 目录核心思路技术路径实现步骤阶段一:准备工作阶段二:内容提取 (python 脚本)阶段三:语言风格调

python3 gunicorn配置文件的用法解读

《python3gunicorn配置文件的用法解读》:本文主要介绍python3gunicorn配置文件的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录python3 gunicorn配置文件配置文件服务启动、重启、关闭启动重启关闭总结python3 gun

关于pandas的read_csv方法使用解读

《关于pandas的read_csv方法使用解读》:本文主要介绍关于pandas的read_csv方法使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录pandas的read_csv方法解读read_csv中的参数基本参数通用解析参数空值处理相关参数时间处理相关

Java编译生成多个.class文件的原理和作用

《Java编译生成多个.class文件的原理和作用》作为一名经验丰富的开发者,在Java项目中执行编译后,可能会发现一个.java源文件有时会产生多个.class文件,从技术实现层面详细剖析这一现象... 目录一、内部类机制与.class文件生成成员内部类(常规内部类)局部内部类(方法内部类)匿名内部类二、

java之Objects.nonNull用法代码解读

《java之Objects.nonNull用法代码解读》:本文主要介绍java之Objects.nonNull用法代码,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录Java之Objects.nonwww.chinasem.cnNull用法代码Objects.nonN

SpringCloud负载均衡spring-cloud-starter-loadbalancer解读

《SpringCloud负载均衡spring-cloud-starter-loadbalancer解读》:本文主要介绍SpringCloud负载均衡spring-cloud-starter-loa... 目录简述主要特点使用负载均衡算法1. 轮询负载均衡策略(Round Robin)2. 随机负载均衡策略(

解读spring.factories文件配置详情

《解读spring.factories文件配置详情》:本文主要介绍解读spring.factories文件配置详情,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录使用场景作用内部原理机制SPI机制Spring Factories 实现原理用法及配置spring.f

Spring MVC使用视图解析的问题解读

《SpringMVC使用视图解析的问题解读》:本文主要介绍SpringMVC使用视图解析的问题解读,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Spring MVC使用视图解析1. 会使用视图解析的情况2. 不会使用视图解析的情况总结Spring MVC使用视图

Linux中的进程间通信之匿名管道解读

《Linux中的进程间通信之匿名管道解读》:本文主要介绍Linux中的进程间通信之匿名管道解读,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、基本概念二、管道1、温故知新2、实现方式3、匿名管道(一)管道中的四种情况(二)管道的特性总结一、基本概念我们知道多

Linux系统之authconfig命令的使用解读

《Linux系统之authconfig命令的使用解读》authconfig是一个用于配置Linux系统身份验证和账户管理设置的命令行工具,主要用于RedHat系列的Linux发行版,它提供了一系列选项... 目录linux authconfig命令的使用基本语法常用选项示例总结Linux authconfi