Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pxrl/genericOP
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl committed Nov 14, 2024
2 parents baedc1e + a522da0 commit 2c69a72
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const tasks = [
"verifySpokePool",
"evmRelayMessageWithdrawal",
"testChainAdapter",
"upgradeSpokePool",
];

// eslint-disable-next-line node/no-missing-require
Expand Down
29 changes: 0 additions & 29 deletions scripts/upgradeTo.ts

This file was deleted.

29 changes: 29 additions & 0 deletions tasks/upgradeSpokePool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";

task("upgrade-spokepool", "Generate calldata to upgrade a SpokePool deployment")
.addParam("implementation", "New SpokePool implementation address")
.setAction(async function (args, hre: HardhatRuntimeEnvironment) {
const { implementation } = args;
if (!implementation) {
console.log("Usage: yarn hardhat upgrade-spokepool --implementation <implementation>");
return;
}

const { deployments, ethers } = hre;

if (ethers.utils.getAddress(implementation) !== implementation) {
throw new Error(`Implementation address must be checksummed (${implementation})`);
}

// @dev Any spoke pool's interface can be used here since they all should have the same upgradeTo function signature.
const { abi } = await deployments.get("Ethereum_SpokePool");
const spokePool = new ethers.Contract(implementation, abi);

const upgradeTo = spokePool.interface.encodeFunctionData("upgradeTo", [implementation]);
console.log(`upgradeTo bytes: `, upgradeTo);

console.log(
`Call relaySpokePoolAdminFunction() with the params [<chainId>, ${upgradeTo}] on the hub pool from the owner's account.`
);
});

0 comments on commit 2c69a72

Please sign in to comment.