日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2025/3/21 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。