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

There's no way to accept multiple ABIs at once #41

Open
gnidan opened this issue Nov 17, 2021 · 5 comments
Open

There's no way to accept multiple ABIs at once #41

gnidan opened this issue Nov 17, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@gnidan
Copy link
Owner

gnidan commented Nov 17, 2021

abi-to-sol currently accepts one ABI JSON as input and produces one "primary" interface as output alongside any number of other struct or interface definitions.

This suffices for the use case of copying a single ABI (e.g. from Etherscan) and pasting it into your project; you can reference the interface by name in your own Solidity code, and you can even reference all the struct definitions and such that the original Solidity contract defined.

But this is not ideal if your project interfaces with multiple deployed contracts from the same project (e.g. Factory, Router, etc.), since multiple contracts from the same project will likely reference the same structs. Right now, you can run abi-to-sol multiple times (once for each related ABI), and presumably save the output to multiple separate .sol files. Problem is: now you can't use a normal global import all of these files at the same time, since solc will complain if you import two of the same identifier.

It seems natural that abi-to-sol should target this use case, since it already does the hard work of collecting all these different identifiers and organizing them in the right interface containers.

One open question: is it okay, when operating on multiple ABIs, for abi-to-sol to output just one single Solidity source (like it does now), or is it necessary for abi-to-sol to allow configuration that produces multiple sources (to be saved as separate files)?

@RyanRHall
Copy link

RyanRHall commented Apr 26, 2023

+1 this would be a helpful feature when generating interfaces for contracts that utilize a proxy / logic pattern. My current solution is to combine the ABIs first and then run the generator on the merged ABI.

@gnidan
Copy link
Owner Author

gnidan commented May 26, 2023

@RyanRHall thanks for your feedback! Since your comment, I've made some progress on addressing this limitation. I hope to get some time soon to finish that up!

@RyanRHall
Copy link

@gnidan amazing 🎉 excited to see it. Happy to take the PR for a test drive if you want some feedback.

@gnidan
Copy link
Owner Author

gnidan commented Jun 4, 2023

@gnidan amazing 🎉 excited to see it. Happy to take the PR for a test drive if you want some feedback.

Thanks for the offer @RyanRHall! Not sure if your offer extends to precursor work, but I just redid a bunch of internals in #114 that I'm a bit worried could introduce bugs. I'm going to do a bit more thorough testing before I merge+release it as v0.8.0, but if there's a way for you to try this out in your existing workflow, I'd love the extra validation!

Once that's in, it should be pretty trivial to get multiple ABI support in place (this precursor work has been such a blocker for a long time, oof!)

Update: that change has now been released in abi-to-sol v0.8.0 (see release notes)

Repository owner deleted a comment from Mortal-zz Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants
@gnidan @RyanRHall and others