I have created smart contract inside the /build/contracts and running this comman generates empty abi file.
eosiocpp -g eosio.test.abi eosio.test.cpp
tried both hpp and cpp but same result.
You could use of the newest macros:
Added ACTION macro which is simply a shortcut for [[eosio::action]] void.
Added TABLE macro which is simply a shortcut for struct [[eosio::table]].
Added CONTRACT macro which is simply a shortcut for class [[eosio::contract]].
When you're generating your ABI consider a few things:
Use the new command eosio-cpp
For example: eosio-cpp -I include -o my_contract.wasm my_contract.cpp -abigen
Use the C++ 11 attributes included in the newest EOSIO version such as [[eosio::action]], [[eosio::table]], [[eosio::contract]]
you need extra comments marked in hpp file to help eosiocpp generate concrete abi file. for actions, you need to add comment
above its declaration. for multi_index table, you need to add comment
//@abi table <underlying class or struct name> (i64|i32)
above the underlying class or struct definition.
I had this happen to me last night. Make sure the class name and your file names match.
In other words, if you're compiling the hello contract, make sure the file names are
I'm assuming you are using one of the new CDTs
In my case the following command worked
eosio-abigen hello.cpp --contract=hello --output=hello.abi
This may be caused by an invalid contract name. If filename and contract class name do not match,
eosio-cpp does not generate the abi.
If your file has the name
foobar then your contract must also have the name
foobar. If this is not the case you need to specify the
Assuming your file is named
foobar.test.cpp and your contract name is
foobar, you need to compile with:
eosio-cpp -abigen fooobar.test.cpp -o foobar.wasm -contract=foobar