eos合約遷移到gxchain的總結(jié)

一 頭文件

#include <eosiolib/eosio.hpp>

#include <graphenelib/graphene.hpp>

#include <graphenelib/system.h>
#include <graphenelib/contract.hpp>
#include <graphenelib/dispatcher.hpp>
#include <graphenelib/multi_index.hpp>
#include <graphenelib/print.hpp>
#include <graphenelib/types.h>
#include <graphenelib/global.h>

二 斷言

eosio_assert 改 graphene_assert

三 abi導(dǎo)出注釋

[[eosio::action]] 改 // @abi action
[[eosio::table]] 改 //@abi table userinfo i64

四 多索引標(biāo)的初始化

_users(_self, _self.value) 改 _users(_self, _self)

五 打印

eosio::print 改 print

六 多索引表的類型聲明

typedef eosio::multi_index<name("users"), user_info> users_table; 

 typedef multi_index<N(users), userinfo> users_table;

七require_auth 鑒權(quán)

require_auth在gxchain不支持,刪除

八 事務(wù)分發(fā)宏定義名稱

EOSIO_DISPATCH 改 GRAPHENE_ABI

九 時(shí)間函數(shù)

now() 改 get_head_block_time()

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容