美文网首页eos技术研究
eos智能合约开发-06 token 操作(产出、交易、转账)

eos智能合约开发-06 token 操作(产出、交易、转账)

作者: uestcAries | 来源:发表于2018-08-30 18:10 被阅读10次

创建eos代币

    root@aries-virtual-machine:/home/aries/tmp/eos# cleos push action eosio.token create '[ "eosio", "1000000000.0000 SYS"]' -p eosio.token
    executed transaction: f986e9e6b5c2424af0b7df1d382e21798e4900ee691aeeb1e775334777378de7  120 bytes  2878 us
    #   eosio.token <= eosio.token::create          {"issuer":"eosio","maximum_supply":"1000000000.0000 SYS"}
    warning: transaction executed locally, but may not be confirmed by the network yet    ] 

从返回结果分析: 
    1、这笔交易消耗了120 bytes 1000 cycles. 
    2、eosio.token <= eosio.token::create 说明,这个代币是由eosio.token创建在eosio.token账户上。 
    3、{“issuer”:”eosio”,”maximum_supply”:”1000000000.0000 SYS”}说明,资产发布在eosio账户上,数量”1000000000.0000 SYS”。这一点需要注意,下面调用issue接口的时候,需要用eosio账户签名,因为资产发行在eosio账户上。
    
代币发放
    root@aries-virtual-machine:/home/aries/tmp/eos# cleos push action eosio.token issue '[ "user", "100.0000 SYS", "memo" ]' -p eosio
    executed transaction: b938b1af134751ae74a0982d834e5166ea7fabbc882eddbcbf964f2e0c31cd4c  128 bytes  1325 us
    #   eosio.token <= eosio.token::issue           {"to":"user","quantity":"100.0000 SYS","memo":"memo"}
    #   eosio.token <= eosio.token::transfer        {"from":"eosio","to":"user","quantity":"100.0000 SYS","memo":"memo"}
    #         eosio <= eosio.token::transfer        {"from":"eosio","to":"user","quantity":"100.0000 SYS","memo":"memo"}
    #          user <= eosio.token::transfer        {"from":"eosio","to":"user","quantity":"100.0000 SYS","memo":"memo"}
    warning: transaction executed locally, but may not be confirmed by the network yet    ] 
    
代币交易
    cleos push action eosio.token transfer '[ "user", "tester", "25.0000 SYS", "m" ]' -p user
    executed transaction: da3af55abf41845abd3b3cadd9166198c881589d315deb2f9937dd09107c6798  128 bytes  960 us
    #   eosio.token <= eosio.token::transfer        {"from":"user","to":"tester","quantity":"25.0000 SYS","memo":"m"}
    #          user <= eosio.token::transfer        {"from":"user","to":"tester","quantity":"25.0000 SYS","memo":"m"}
    #        tester <= eosio.token::transfer        {"from":"user","to":"tester","quantity":"25.0000 SYS","memo":"m"}
    
    warning: transaction executed locally, but may not be confirmed by the network yet    ] 
    

查看余额
    root@aries-virtual-machine:/home/aries/tmp/eos# cleos get currency balance eosio.token tester SYS
    25.0000 SYS
    root@aries-virtual-machine:/home/aries/tmp/eos# cleos get currency balance eosio.token user SYS
    75.0000 SYS

相关文章

网友评论

    本文标题:eos智能合约开发-06 token 操作(产出、交易、转账)

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