EOSIO / eosio.contracts

Smart contracts that provide some of the basic functions of the EOSIO blockchain
https://eosio.github.io/eosio.contracts/latest
MIT License
326 stars 415 forks source link

eosio.token -- Error 3015004: The type defined in the ABI is invalid #112

Closed TornadoM closed 3 years ago

TornadoM commented 6 years ago

I followed the tutorial: https://developers.eos.io/eosio-home/docs/token-contract.

The contracts seems to be deployed successfully with the command:
cleos set contract eosio.token eosio.token --abi eosio.token.abi -p eosio.token@active

Response: Reading WASM from eosio.token/eosio.token.wasm... Publishing contract... executed transaction: 12948529459321d25366157fb97ba42cc27c51a0a6e25849ccfe4297295e47c5 9696 bytes 15970 us # eosio <= eosio::setcode {"account":"eosio.token","vmtype":0,"vmversion":0,"code":"0061736d0100000001aa011c60037f7e7f0060047f... # eosio <= eosio::setabi {"account":"eosio.token","abi":"0e656f73696f3a3a6162692f312e30000605636c6f73650002056f776e6572046e61...

However when I tried to interact with the contract: cleos push action eosio.token issue '[ "alice", "100.0000 SYS", "memo" ]' -p eosio@active

It came with such error: Error 3015004: The type defined in the ABI is invalid

The code is cloned yesterday and compiled with: eosio-cpp -I include -o eosio.token.wasm src/eosio.token.cpp --abigen

Anyone knows which part goes wrong? Thanks a lot!

swoopyy commented 6 years ago

I also get this: Error 3015004: The type defined in the ABI is invalid Error Details: account

It looks like eosio tables are not transpiled into abi file for some reason.

wuyahuang commented 6 years ago

same issue. 108

vchengsong commented 6 years ago

@TornadoM this is because the generated eosio.token.abi lack of the following "structs" definitions: { "name": "account", "base": "", "fields": [ {"name":"balance", "type":"asset"} ] }, { "name": "currency_stats", "base": "", "fields": [ {"name":"supply", "type":"asset"}, {"name":"max_supply", "type":"asset"}, {"name":"issuer", "type":"name"} ] }

and the correct "tables" definition is: "tables": [ { "name": "accounts", "type": "account", "index_type": "i64", "key_names" : ["currency"], "key_types" : ["uint64"] }, { "name": "stat", "type": "currency_stats", "index_type": "i64", "key_names" : ["currency"], "key_types" : ["uint64"] } ],

you can find the full correct abi file here https://github.com/vchengsong/eosio.contracts/blob/master/eosio.token/abi/eosio.token.abi

swoopyy commented 6 years ago

Updated eosio.cdt to the latest version and now it works