Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ABI Encoder v2 + ABI Spec v6.6 #17

Merged
merged 5 commits into from
Jun 16, 2020
Merged

ABI Encoder v2 + ABI Spec v6.6 #17

merged 5 commits into from
Jun 16, 2020

Conversation

gakonst
Copy link
Owner

@gakonst gakonst commented Jun 16, 2020

Motivation

Partially fixes #5. Some ABI Encoder v2 structs are now supported. More complex ones such as DyDx's contracts are still not supported because they require implementing Tokenize and/or Detokenize for types such as (Address, Address, (Address, Address)) (i.e. nested tuples).

This PR breaks compatibility with ABIs that do not have a stateMutability key in their functions.

(ethabi did not support ABIs which did not include the deprecated constantkeyword. Notably, Vyper produces deprecated ABIs as well.)

Solution

  1. Fork ethabi and cherrypick the useful changes I've seen across various PRs. Details in the recent commits: https://github.com/gakonst/ethabi/commits/master
  2. Expand tuples in codegen, similar logic as here: https://github.com/graphprotocol/solidity-bindgen/blob/master/solidity-bindgen-macros/src/abi_gen.rs#L89-L97.
  3. Re-enable all the more complex Tokenize implementations
  4. Add example for generating bindings: cargo run --example abigen <contract name> path/to/contract.sol will print the bindings to stdout. If you specify an additional path, the generated bindings will be written to the file corresponding to that path

@gakonst gakonst force-pushed the gakonst/abiencoder-v2 branch 3 times, most recently from a2f6edd to e0b4bee Compare June 16, 2020 10:23
@gakonst gakonst merged commit 570b45e into master Jun 16, 2020
@gakonst gakonst deleted the gakonst/abiencoder-v2 branch June 16, 2020 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Codegen for ABIEncoderV2
1 participant