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: upgrade-proxy/UpgradeFunction #874

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/plugin-hardhat/src/upgrade-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,18 @@ export function makeUpgradeProxy(hre: HardhatRuntimeEnvironment, defenderModule:
const upgradeTx = await upgradeTo(nextImpl, call);

const inst = attach(ImplFactory, proxyAddress);
// @ts-ignore Won't be readonly because inst was created through attach.
inst.deployTransaction = upgradeTx;

// as is -> inst.deployTransaction = upgradeTx;
// inst(instance of ethers.Contract) dose not have property named deployTransaction but deploymentTransaction
// and it is a function which returns ethers.ContractTransactionResponse | null , not ethers.TransactionResponse itself
// it shoud be correted like below
// @ts-ignore
inst.deploymentTransaction = () => upgradeTx || null;

// Additionally, upgradeTx is not tx about deployment (also each type is different)
// I think it's better way to not override deploymentTrnasaction with upgradeTx and just block until upgradeTx to be resolved like below code
await upgradeTx.wait();

return inst;
};

Expand Down