Is there a tool to generate a solidity code from the ABI interface?

const Ballot = [{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"delegate","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"winningProposal","outputs":[{"name":"winningProposal","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"voter","type":"address"}],"name":"giveRightToVote","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"proposal","type":"uint8"}],"name":"vote","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"_numProposals","type":"uint8"}],"payable":false,"type":"constructor"}]

Should result into something like:

contract Ballot {
  function Ballot(uint8 _numProposals) {}
  function giveRightToVote(address voter) {}
  function delegate(address to) {}
  function vote(uint8 proposal) {}
  function winningProposal() constant returns (uint8 winningProposal) {}

grabABI, which is part of QuickBlocks, comes very close. It's open source, so you could modify it slightly to surround its output with the contract part and add the squiggles after each function, but it should be easy.

You can find it on github.

| improve this answer | |

Here is a tool that takes an ABI and convert it to its Solidity interface: https://bia.is/tools/abi2solidity/

Source code is published on GitHub: https://github.com/maxme/abi2solidity/

| improve this answer | |

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.