-
Notifications
You must be signed in to change notification settings - Fork 271
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
Support TypeChain in deploy and upgrade proxy functions - continuation of work done on #535 #1099
Support TypeChain in deploy and upgrade proxy functions - continuation of work done on #535 #1099
Conversation
…onProxy, deployBeacon, upgradeProxy, upgradeBeacon, and forceImport functions
1e452b5
to
837272c
Compare
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.
Thanks a lot for picking this up and sorry for the late response. This looks great!
I made a few changes as follows:
deployBeacon
andupgradeBeacon
should return anUpgradeableBeacon
instance, rather than the implementation contract's type. We don't generate detailed TypeChain information forUpgradeableBeacon
for now, so I've reverted those to just returnContract
.forceImport
could also return an UpgradeableBeacon if the given address is a beacon. For simplicity, I've reverted that as well so it just returnsContract
.- changed the type definition of
ContractTypeOfFactory
to beReturnType<F['attach']> & ReturnType<F['deploy']>
since with Ethers v6,attach
just returns a BaseContract which does not have the contract's type. But TypeChain provides an override ofdeploy
which gives us the expected type -- this seems to work.
For reference, since our tests in this project uses JS, I created a sample TS project and tested it with these testcases: https://github.com/ericglau/hardhat-upgrades-typechain-tests/blob/main/test/test.ts
Continuation of work done on #535 by frimoldi.
See #325 and #1082.
Returns type safe contract types with:
deployProxy
,deployContract
,deployBeaconProxy
, andupgradeProxy
functions.This does not apply to
deployBeacon
,upgradeBeacon
, andforceImport
since those can returnUpgradeableBeacon
rather than the implementation contract type.