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

feat(abigen): add MultiAbigen to generate multiple contract bindings #724

Merged
merged 5 commits into from
Dec 23, 2021

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Dec 22, 2021

Motivation

rust-analyzer and intellij still struggle to expand the abigen! macro and fail to provide useful intellisense, this makes it harder to get started with abigen!and usually requires to expand the macro by hand to see what functions are available.

Solution

The new MultiAbigen type can be used to create bindings for several contract at once and generate a new module like this: https://github.com/Gearbox-protocol/liquidation-bot/blob/master/src/bindings/mod.rs

This can be used to generate a module like this once, keep that in repository so that intellisense is available and ensure the CI will fail if the generated code is out of date

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - wonder if we should create a binary which exposes the functionality that one can easily install to re-generate their bindings? Feels like this is the high level utility we needed to make such a CLI useful.

@gakonst gakonst merged commit c7cf5be into gakonst:master Dec 23, 2021
@mattsse
Copy link
Collaborator Author

mattsse commented Dec 23, 2021

Nice - wonder if we should create a binary which exposes the functionality that one can easily install to re-generate their bindings? Feels like this is the high level utility we needed to make such a CLI useful.

I don't know if a cli is appropriate for this feature only, but adding such a cli should be pretty easy.
However, the intended setup would be to run this as in a test to ensure everything is up to date.

What could be useful as well is a workspace template for https://github.com/cargo-generate/cargo-generate

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.

None yet

2 participants