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

FIX: Generate structs for constructor arguments #2631

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Oct 10, 2023

Motivation

I noticed that the Abigen did not generate a struct for the constructor parameters. This was a struct that did not appear anywhere else in the interface, so I thought it was because ethers only generates bindings for interacting with an already deployed contract, especially because there was an open issue seemingly asking for this feature: #1239 and also because the generated deploy method took a generic input parameter.

Upon closer inspection it looked like it should generate structs for the constructor inputs, however this did not happen because the constructor (at least in our case) didn't have a name. This would normally be the name of the function, but since a constructor doesn't need any, it's empty.

Solution

Use the name "constructor" if the item.name is empty.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

cool, tysm

@DaniPopes DaniPopes merged commit 23f5766 into gakonst:master Oct 18, 2023
19 checks passed
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

3 participants