Skip to content

Commit 0dbde76

Browse files
committed
Added pause deposits toggle to spoke pool upgrade script
1 parent 4b60fdd commit 0dbde76

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

contracts/SpokePool.sol

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,18 +289,6 @@ abstract contract SpokePool is
289289
// Allows cross domain admin to upgrade UUPS proxy implementation.
290290
function _authorizeUpgrade(address newImplementation) internal override onlyAdmin {}
291291

292-
/**
293-
* @notice Try to upgrade to new implementation and then downgrade to old implementation.
294-
* @dev This is used to test the upgradeability of the contract.
295-
* @param newImplementation New implementation address.
296-
*/
297-
function try_upgradeTo(address newImplementation) public {
298-
address oldImplementation = _getImplementation();
299-
upgradeTo(newImplementation);
300-
upgradeTo(oldImplementation);
301-
revert("SUCCESSFULLY_UPGRADED_AND_DOWNGRADED");
302-
}
303-
304292
/**
305293
* @notice Pauses deposit-related functions. This is intended to be used if this contract is deprecated or when
306294
* something goes awry.

tasks/upgradeSpokePool.ts

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,46 @@ task("upgrade-spokepool", "Generate calldata to upgrade a SpokePool deployment")
1717
}
1818

1919
// @dev Any spoke pool's interface can be used here since they all should have the same upgradeTo function signature.
20-
const abi = ["function upgradeTo(address newImplementation) external"];
20+
const abi = [
21+
{
22+
inputs: [
23+
{
24+
internalType: "address",
25+
name: "newImplementation",
26+
type: "address",
27+
},
28+
{ internalType: "bytes", name: "data", type: "bytes" },
29+
],
30+
name: "upgradeToAndCall",
31+
outputs: [],
32+
stateMutability: "payable",
33+
type: "function",
34+
},
35+
{
36+
inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }],
37+
name: "multicall",
38+
outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }],
39+
stateMutability: "nonpayable",
40+
type: "function",
41+
},
42+
{
43+
inputs: [{ internalType: "bool", name: "pause", type: "bool" }],
44+
name: "pauseDeposits",
45+
outputs: [],
46+
stateMutability: "nonpayable",
47+
type: "function",
48+
},
49+
];
2150
const spokePool = new ethers.Contract(implementation, abi);
2251

23-
const upgradeTo = spokePool.interface.encodeFunctionData("upgradeTo", [implementation]);
52+
const data = spokePool.interface.encodeFunctionData("multicall", [
53+
[
54+
spokePool.interface.encodeFunctionData("pauseDeposits", [true]),
55+
spokePool.interface.encodeFunctionData("pauseDeposits", [false]),
56+
],
57+
]);
58+
59+
const upgradeTo = spokePool.interface.encodeFunctionData("upgradeToAndCall", [implementation, data]);
2460
console.log(`upgradeTo bytes: `, upgradeTo);
2561

2662
console.log(

0 commit comments

Comments
 (0)