问题复现
新建账号 bcskillsurou
,并部署eosio.token合约,此账号创建代币EOS,并发行后
cleos set contract bcskillsurou /mnt/c/github/eos/build/contracts/eosio.token/ -p bcskillsurou
cleos push action bcskillsurou create '["eosio","1500000000.00000000 BSC",0,0,0]' -p bcskillsurou
cleos push action bcskillsurou issue '["eosio","150000000.00000000 BSC","issue"]' -p bcskillsurou
当使用cleos执行transfer时
cleos -u https://www.bcskill.com transfer bcskillsurou xxxxxxxxxxxx "10 BSC"
提示
Error 3010014: Invalid symbol
Error Details:
Symbol BSC is not supported by token contract bcskillsurou
但使用push action
cleos -u https://dev-api-chain.valicn.com push action bcskillsurou transfer '["bcskillsurou", "xxxxxxxxxxxx","100000000.0000 BSC","vote"]' -p bcskillsurou
是发送正常的.说明问题判断条件不在合约.
查看cleos代码
问题代码所在(cleos/main.cpp)
因为cleos 执行transfer时会先执行rpc get_currency_stats_func,拿到代币的精度,然后补齐.但默认是从系统主代币token合约(eosio.token)获取,如果是自定义合约的话,需要单独参数(["--contract,-c"](https://github.com/EOSIO/eos/blob/448287d520f5f8c282139ecc60f227c218d42e82/programs/cleos/main.cpp#L3033 ""--contract,-c""))指定.
所以正确的transfer 命令为
cleos -u https://www.bcskill.com transfer bcskillsurou xxxxxxxxxxxx "10 BSC" -c bcskillsurou
版权属于:区块链中文技术社区 / 转载原创者
本文链接:https://bcskill.com/index.php/archives/615.html
相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!