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

Extract deployment transaction from upgraded contract #46

Merged
merged 2 commits into from
Jan 24, 2024
Merged
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 src/upgrades.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import "@openzeppelin/hardhat-upgrades"

import type { Contract, ContractFactory } from "ethers"
import type {
Contract,
ContractFactory,
ContractTransactionResponse,
} from "ethers"
import type {
Artifact,
FactoryOptions,
Expand Down Expand Up @@ -149,7 +153,13 @@ async function upgradeProxy<T extends Contract>(
opts?.proxyOpts
)) as T

const deploymentTransaction = newContractInstance.deploymentTransaction()
// This is a workaround to get the deployment transaction. The upgradeProxy attaches
// the deployment transaction to the field under a different name than ethers
// contract.deploymentTransaction() function expects.
// TODO: Remove this workaround once the issue is fixed on the OpenZeppelin side.
// Tracked in: https://github.com/keep-network/hardhat-helpers/issues/49
const deploymentTransaction =
newContractInstance.deployTransaction as unknown as ContractTransactionResponse

// Let the transaction propagate across the ethereum nodes. This is mostly to
// wait for all Alchemy nodes to catch up their state.
Expand Down