-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into pxrl/genericOP
- Loading branch information
Showing
3 changed files
with
30 additions
and
29 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 was deleted.
Oops, something went wrong.
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,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.` | ||
); | ||
}); |