Skip to content

Commit

Permalink
Updates to WalletCoordinator upgrade script
Browse files Browse the repository at this point in the history
- cast type of proxy admin instance
- update deployment artifact before referencing it in by
  `getContract("WalletCoordinator")`
- verify implementation contract
  • Loading branch information
nkuba committed Jul 5, 2023
1 parent 716bf06 commit 0c405da
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions solidity/deploy/81_upgrade_wallet_coordinator_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
)

// Assemble proxy upgrade transaction.
const proxyAdmin: ProxyAdmin = await hre.upgrades.admin.getInstance()
const proxyAdmin: ProxyAdmin =
(await hre.upgrades.admin.getInstance()) as ProxyAdmin
const proxyAdminOwner = await proxyAdmin.owner()

const upgradeTxData = await proxyAdmin.interface.encodeFunctionData(
Expand All @@ -43,6 +44,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
`\t\tdata: ${upgradeTxData}`
)

// Update Deployment Artifact
const walletCoordinatorArtifact: Artifact =
hre.artifacts.readArtifactSync("WalletCoordinator")

await deployments.save("WalletCoordinator", {
...proxyDeployment,
abi: walletCoordinatorArtifact.abi,
implementation: newImplementationAddress,
})

// Assemble parameters upgrade transaction.
const walletCoordinator: WalletCoordinator =
await helpers.contracts.getContract("WalletCoordinator")
Expand All @@ -62,22 +73,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
`\t\tdata: ${updateRedemptionProposalParametersTxData}`
)

// Update Deployment Artifact
const walletCoordinatorArtifact: Artifact =
hre.artifacts.readArtifactSync("WalletCoordinator")

await deployments.save("WalletCoordinator", {
...proxyDeployment,
abi: walletCoordinatorArtifact.abi,
implementation: newImplementationAddress,
})

if (hre.network.tags.etherscan) {
// We use `verify` instead of `verify:verify` as the `verify` task is defined
// in "@openzeppelin/hardhat-upgrades" to perform Etherscan verification
// of Proxy and Implementation contracts.
await hre.run("verify", {
address: proxyDeployment.address,
address: newImplementationAddress,
constructorArgsParams: proxyDeployment.args,
})
}
Expand Down

0 comments on commit 0c405da

Please sign in to comment.