EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

Using eosiocpp -g generated to an empty ABI file #2053

Closed eoline7 closed 6 years ago

eoline7 commented 6 years ago

I run the "eosiocpp -g currency.abi currency.hpp" get currency.abi like this: { "____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-04-03T06:24:59", "types": [], "structs": [], "actions": [], "tables": [] }

currency.hpp copied from eosiolib/currency.hpp What is going wrong?

Lomect commented 6 years ago

you can try by .cpp.

eoline7 commented 6 years ago

.cpp is same result

okluoquan commented 6 years ago

.hpp add code annotation will be ok

such as //@abi action and //@abi table

don't know why.

//@abi action struct PACKED( set_owner ) { account_name owner; uint32_t delay; };

//@abi table struct config { config(){} constexpr static uint64_t key = N(config); account_name owner = 0; uint32_t delay = 0; uint32_t next_id = 0; };

navcsdev commented 6 years ago

@eoline7 I read the sample then testing

farhan19aug commented 6 years ago

Thanks @okluoquan That work for me ..

anantanandgupta commented 6 years ago

I am trying to build the included examples and there is no way it is generating the proper ABI file

// file eosio.bios.cpp

#include <eosio.bios.hpp>

EOSIO_ABI( eosio::bios, (setpriv)(setalimits)(setglimits)(setprods)(reqauth) )

now in terminal

$ eosiocpp -o eosio.bios.wast eosio.bios.cpp
$ eosiocpp -g eosio.bios.abi eosio.bios.cpp

and this is the contents of the ABI file

{
  "____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-04-18T21:59:15",
  "types": [],
  "structs": [],
  "actions": [],
  "tables": [],
  "ricardian_clauses": []
}

please tell me what is wrong in there and how to correct the issue

x2x4com commented 6 years ago

@anantanandgupta try to push your contract into eos project source contracts folder, and run eosiocpp -g again.

anantanandgupta commented 6 years ago

@x2x4com I have not moved the contract from there ... the code I am building is still in that source folder.

Codegnosis commented 6 years ago

Edit: This is now working for me in the latest version.

Original comment: @anantanandgupta I'm experiencing the same issue. I'm also running eosiocpp -g in the project source directory (after having built/installed the latest master branch as of this morning), on the existing example contracts, and it's generating the same "blank" abi file. Even the simple hello contract. Not sure how to trace the issue though, since there are no error messages output during the process (with the exception of a warning regarding missing ricardian clauses)

farhan19aug commented 6 years ago

I'm having the same issue but it work fine with using @//abi action. eosio_abi is not working and because of that it generate always empty abi and all example smart contract use the eosio_abi.

noobier666 commented 6 years ago

+1

noobier666 commented 6 years ago

image

noobier666 commented 6 years ago

image

deba10106 commented 6 years ago

nothing worked for me. My currency folder is inside contracts folder, not inside eos.bios. I also get empty abi file!

Joelone commented 6 years ago

I had the same issue, moving my contract to eos/contracts/my_contract works for me.

chenguo-github commented 6 years ago

I have come into the same problem for empty abi file, have anyone solved the problem? Thanks!

svenpohl commented 6 years ago

Same issue here - empty abi with "eosiocpp -g eosio.token.abi eosio.token.cpp" and "eosiocpp -g eosio.token.abi eosio.token.hpp" - no error message. Any solution?

dominic-healid commented 6 years ago

What is the cause of this issue? I have tried all solutions mentioned but no luck.

JohnnyZhao commented 6 years ago

code annotation worked for me....

such as //@abi action and //@abi table

Thanks to @okluoquan

andriantolie commented 6 years ago

currency.hpp is no longer available so I'm going to close this issue. To be able to use eosiocpp, you need //@abi annotation and also EOSIO_ABI by the way.

andriantolie commented 6 years ago

And also eosio.token.abi is not generated by eosiocpp. It hasn't been annotated to support eosiocpp :)

nejc-skerjanc commented 6 years ago

Is there anything new? eosiocpp still make empty .abi file on my node...

dominic-healid commented 6 years ago

in my case the actions is the only field that is empty from the ABI file.

Any thoughts?

{
  "____comment": "This file was generated by eosio-abigen. DO NOT EDIT - 2018-08-22T07:10:24",
  "version": "eosio::abi/1.0",
  "types": [],
  "structs": [{
      "name": "account",
      "base": "",
      "fields": [{
          "name": "balance",
          "type": "asset"
        }
      ]
    },{
      "name": "currency",
      "base": "",
      "fields": [{
          "name": "supply",
          "type": "asset"
        },{
          "name": "max_supply",
          "type": "asset"
        },{
          "name": "issuer",
          "type": "name"
        }
      ]
    }
  ],
  "actions": [],
  "tables": [{
      "name": "accounts",
      "index_type": "i64",
      "key_names": [
        "balance"
      ],
      "key_types": [
        "asset"
      ],
      "type": "account"
    },{
      "name": "stat",
      "index_type": "i64",
      "key_names": [
        "supply"
      ],
      "key_types": [
        "asset"
      ],
      "type": "currency"
    }
  ],
  "ricardian_clauses": [],
  "error_messages": [],
  "abi_extensions": []
}
nejc-skerjanc commented 6 years ago

some versions of source code generated empty .abi file in the past (they hada bug)...but now they are changing command for compiling....you need to write your own .abi file until they prepare new compiler (url: https://developers.eos.io/eosio-cpp/docs/how-to-write-an-abi - red sector)

i suggest you to compile older version of source code in separate directory- just for compiling...

dominic-healid commented 6 years ago

thanks for the response @nejc-skerjanc

Actually what I did, I manually added the entries for the actions field however I'm still getting an error that says.

Error 3050000: action exception
Error Details:
Unknown action create in contract proposal

even I already have this on my abi file

 "actions": [{
      "name": "transfer",
      "type": "transfer",
      "ricardian_contract": ""
    },{
      "name": "issue",
      "type": "issue",
      "ricardian_contract": ""
    }, {
      "name": "create",
      "type": "create",
      "ricardian_contract": ""
}]
nejc-skerjanc commented 6 years ago

in this abi file also structures/header lines are missed: you should check few abi files in these contracts: https://github.com/EOSIO/eos/tree/master/contracts

qyvlik commented 6 years ago
docker run --name eos-dev eosio/eos-dev
docker exec eos-dev /bin/bash
# change the path and use the eosiocpp to gen the contracts
cd /eos/contracts