Skip to content

Commit eb3ee6a

Browse files
committed
feat(gateway-contracts): update pausing and unpausing tasks
1 parent 23ce14f commit eb3ee6a

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

gateway-contracts/tasks/pauseContracts.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ import { getRequiredEnvVar } from "./utils/loadVariables";
1010
import { pascalCaseToSnakeCase } from "./utils/stringOps";
1111

1212
// Helper function to get a Gateway contract and its proxy address
13-
async function getGatewayContract(name: string, ethers: HardhatEthersHelpers, useInternalAddress: boolean) {
13+
async function getGatewayContract(
14+
name: string,
15+
ethers: HardhatEthersHelpers,
16+
useInternalAddress: boolean,
17+
envVarPrivateKeyName: string,
18+
) {
1419
// Get the pauser wallet
15-
const pauserPrivateKey = getRequiredEnvVar("PAUSER_PRIVATE_KEY");
20+
const pauserPrivateKey = getRequiredEnvVar(envVarPrivateKeyName);
1621
const pauser = new Wallet(pauserPrivateKey).connect(ethers.provider);
1722

1823
// Get contract factories
@@ -41,7 +46,7 @@ async function getGatewayContract(name: string, ethers: HardhatEthersHelpers, us
4146
// Helper function to pause a contract
4247
async function pauseSingleContract(name: string, ethers: HardhatEthersHelpers, useInternalAddress: boolean) {
4348
// Get the contract and its address
44-
const { contract, proxyAddress } = await getGatewayContract(name, ethers, useInternalAddress);
49+
const { contract, proxyAddress } = await getGatewayContract(name, ethers, useInternalAddress, "PAUSER_PRIVATE_KEY");
4550

4651
// Pause the contract
4752
await contract.pause();
@@ -52,7 +57,7 @@ async function pauseSingleContract(name: string, ethers: HardhatEthersHelpers, u
5257
// Helper function to unpause a contract
5358
async function unpauseSingleContract(name: string, ethers: HardhatEthersHelpers, useInternalAddress: boolean) {
5459
// Get the contract and its address
55-
const { contract, proxyAddress } = await getGatewayContract(name, ethers, useInternalAddress);
60+
const { contract, proxyAddress } = await getGatewayContract(name, ethers, useInternalAddress, "DEPLOYER_PRIVATE_KEY"); // NOTE: this task won't work once ownership will be transferred from initial deployer to the multisig
5661

5762
// Unpause the contract
5863
await contract.unpause();
@@ -131,7 +136,12 @@ task("task:pauseAllGatewayContracts")
131136
const name = "GatewayConfig";
132137

133138
// Get the GatewayConfig contract and its address
134-
const { contract, proxyAddress } = await getGatewayContract(name, hre.ethers, useInternalProxyAddress);
139+
const { contract, proxyAddress } = await getGatewayContract(
140+
name,
141+
hre.ethers,
142+
useInternalProxyAddress,
143+
"PAUSER_PRIVATE_KEY",
144+
);
135145

136146
// Pause all the Gateway contracts
137147
await contract.pauseAllGatewayContracts();
@@ -153,7 +163,12 @@ task("task:unpauseAllGatewayContracts")
153163
const name = "GatewayConfig";
154164

155165
// Get the GatewayConfig contract and its address
156-
const { contract, proxyAddress } = await getGatewayContract(name, hre.ethers, useInternalProxyAddress);
166+
const { contract, proxyAddress } = await getGatewayContract(
167+
name,
168+
hre.ethers,
169+
useInternalProxyAddress,
170+
"DEPLOYER_PRIVATE_KEY", // NOTE: this task won't work once ownership will be transferred from initial deployer to the multisig
171+
);
157172

158173
// Unpause all the Gateway contracts
159174
await contract.unpauseAllGatewayContracts();

0 commit comments

Comments
 (0)