Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants