-
Notifications
You must be signed in to change notification settings - Fork 266
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
Add txOverrides
option for overriding transaction parameters
#852
Conversation
Thanks for this PR! This looks like a reasonable approach which would address #85. Particularly, since I’ve made some changes to separate the option type for Hardhat and Truffle, since Truffle does not use ethers.js. Additional changes:
|
txOverrides
option for overriding transaction parameters
const overrides = opts.txOverrides ? [opts.txOverrides] : []; | ||
const upgradeTx = await beaconContract.upgradeTo(nextImpl, ...overrides); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you just write upgradeTo(nextImpl, overrides)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would cause an error because then overrides
appears as an array and Ethers tries to use it as part of the actual function arguments.
We need to spread the array because its element opts.txOverrides
is the actual overrides object, and if that is not present, then it will be excluded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry my question was actually if we write upgradeTo(nextImpl, opts.txOverrides)
🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't work, but we could use either:
upgradeTo(nextImpl, opts.txOverrides ?? {})
or
upgradeTo(nextImpl, withDefaults(opts).txOverrides)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that these options will work with Truffle, I recall it working weird if you pass an empty object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, these don't work for Truffle. Will leave them as-is for both Hardhat and Truffle, for consistency.
Fixes #85