美文网首页公信宝区块链技术
eos合约迁移到gxchain的总结

eos合约迁移到gxchain的总结

作者: 剑有偏锋 | 来源:发表于2019-03-14 17:40 被阅读4次

    一 头文件

    #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导出注释

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

    四 多索引标的初始化

    _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 鉴权

    require_auth在gxchain不支持,删除

    八 事务分发宏定义名称

    EOSIO_DISPATCH 改 GRAPHENE_ABI

    九 时间函数

    now() 改 get_head_block_time()

    相关文章

      网友评论

        本文标题:eos合约迁移到gxchain的总结

        本文链接:https://www.haomeiwen.com/subject/wipcmqtx.html