-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into support-sepolia
- Loading branch information
Showing
118 changed files
with
27,998 additions
and
11,457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
cross-chain/arbitrum/deploy_l2/32_manual_upgrade_arbitrum_wormhole_gateway.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import type { Artifact, HardhatRuntimeEnvironment } from "hardhat/types" | ||
import type { DeployFunction, Deployment } from "hardhat-deploy/types" | ||
import { ContractFactory } from "ethers" | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { ethers, helpers, deployments } = hre | ||
|
||
const { deployer } = await helpers.signers.getNamedSigners() | ||
|
||
const proxyDeployment: Deployment = await deployments.get( | ||
"ArbitrumWormholeGateway" | ||
) | ||
const implementationContractFactory: ContractFactory = | ||
await ethers.getContractFactory("L2WormholeGateway", { | ||
signer: deployer, | ||
}) | ||
|
||
// Deploy new implementation contract | ||
const newImplementationAddress: string = (await hre.upgrades.prepareUpgrade( | ||
proxyDeployment, | ||
implementationContractFactory, | ||
{ | ||
kind: "transparent", | ||
} | ||
)) as string | ||
|
||
deployments.log( | ||
`new implementation contract deployed at: ${newImplementationAddress}` | ||
) | ||
|
||
// Assemble proxy upgrade transaction. | ||
const proxyAdmin = await hre.upgrades.admin.getInstance() | ||
const proxyAdminOwner = await proxyAdmin.owner() | ||
|
||
const upgradeTxData = await proxyAdmin.interface.encodeFunctionData( | ||
"upgrade", | ||
[proxyDeployment.address, newImplementationAddress] | ||
) | ||
|
||
deployments.log( | ||
`proxy admin owner ${proxyAdminOwner} is required to upgrade proxy implementation with transaction:\n` + | ||
`\t\tfrom: ${proxyAdminOwner}\n` + | ||
`\t\tto: ${proxyAdmin.address}\n` + | ||
`\t\tdata: ${upgradeTxData}` | ||
) | ||
|
||
// Update Deployment Artifact | ||
const gatewayArtifact: Artifact = | ||
hre.artifacts.readArtifactSync("L2WormholeGateway") | ||
|
||
await deployments.save("ArbitrumWormholeGateway", { | ||
...proxyDeployment, | ||
abi: gatewayArtifact.abi, | ||
implementation: newImplementationAddress, | ||
}) | ||
|
||
// Contracts can be verified on L2 Arbiscan in a similar way as we do it on | ||
// L1 Etherscan | ||
if (hre.network.tags.arbiscan) { | ||
// We use `verify` instead of `verify:verify` as the `verify` task is defined | ||
// in "@openzeppelin/hardhat-upgrades" to verify the proxy’s implementation | ||
// contract, the proxy itself and any proxy-related contracts, as well as | ||
// link the proxy to the implementation contract’s ABI on (Ether)scan. | ||
await hre.run("verify", { | ||
address: newImplementationAddress, | ||
constructorArgsParams: proxyDeployment.args, | ||
}) | ||
} | ||
} | ||
|
||
export default func | ||
|
||
func.tags = ["ManualUpgradeArbitrumWormholeGateway"] | ||
|
||
// Comment this line when running an upgrade. | ||
// yarn deploy --tags ManualUpgradeArbitrumWormholeGateway --network <network> | ||
func.skip = async () => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.