2

I have created some ricardian contracts with file names like "contract_name.action_name_rc.md". Is it possible to generate ABI file with these Ricardian Contracts automatically?

Edit:

I have cpp and hpp files, I can generate abi file with "eosiocpp" successfully. The only problem are the ricardian contracts, I know how to put the ricardian contracts to the abi file manually, but it is just too much work to do if I have to add them manually after every time I regenerate the abi file. I just want to know if there is a way to have them included in the abi automatically.

1

The ABI file is actually generated from the cpp file you're compiling from.

eosiocpp -g file.abi file.cpp

This is also the reason you use the macro in your code to tell the compiler which of your functions is an action and which of your tables are callable.

EOSIO_ABI( scope, (action 1)(action 2)...(action n) );

From here, the ricardian contract can be based off of this ABI. Reason being is that the ABI is a direct and templated collection of actions that the ricardian contract can be written from and detail the actions for.

See this video from Thomas Cox for a better explanation.

|improve this answer|||||
  • Thanks for your reply. Are you saying there is no way to generate the ricardian contracts to the abi? I must manually put the ricardian contract content to the abi file? – mochunhei Jul 7 '18 at 11:45
  • So there are a few files we are discussing here. There is the cpp file which is your code. Then the only way to generate an ABI file is by compiling it with eosiocpp which takes the macro I mentioned above and creates the ABI which acts like an API for the contract. From here, a ricardian contract can be used to display and explain what the ABI actions do. So yes and no. If you are asking if you can just create an ABI from a ricardian contract, there is currently no way of doing this. – Nat Jul 7 '18 at 11:47
  • Thanks, I guess I didn't ask it clearly. I have cpp and hpp files, I can generate abi file with "eosiocpp" successfully. The only problem are the ricardian contracts, I know how to put the ricardian contracts to the abi file manually, but it is just too much work to do if I have to add them manually after every time I regenerate the abi file. I just want to know if there is a way to have them included in the abi automatically. – mochunhei Jul 7 '18 at 11:57
  • I haven't seen any scripts to auto create a default ricardian, but there are probably some out there. I know you can find some examples of ricardian contracts on monstereos's repo: github.com/leordev/monstereos – Nat Jul 7 '18 at 12:00
  • I've seen monstereos's repo, I wonder how he created the abi file with all the ricardian contracts in it. I don't need any script to create default ricardian, I have written the ricardian contracts into the md files myself, I just need a way to have them included into the abi file. – mochunhei Jul 7 '18 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.