Skip to content

Commit 3d8e4a4

Browse files
committed
cli: support wh transceiver pauser (evm)
1 parent cbb4587 commit 3d8e4a4

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

cli/src/index.ts

+30-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export type ChainConfig = {
7171
token: string,
7272
transceivers: {
7373
threshold: number,
74-
wormhole: string,
74+
wormhole: { address: string, pauser?: string },
7575
},
7676
limits: {
7777
outbound: string,
@@ -1312,6 +1312,29 @@ async function pushDeployment<C extends Chain>(deployment: Deployment<C>, signer
13121312
}
13131313
}
13141314
}
1315+
} else if (k === "transceivers") {
1316+
// TODO: refactor this nested loop stuff into separate functions at least
1317+
// alternatively we could first recursively collect all the things
1318+
// to do into a flattened list (with entries like
1319+
// transceivers.wormhole.pauser), and have a top-level mapping of
1320+
// these entries to how they should be handled
1321+
for (const j of Object.keys(diff[k] as object)) {
1322+
if (j === "wormhole") {
1323+
for (const l of Object.keys(diff[k]![j] as object)) {
1324+
if (l === "pauser") {
1325+
const newTransceiverPauser = toUniversal(deployment.manager.chain, diff[k]![j]![l]!.push!);
1326+
txs.push(deployment.whTransceiver.setPauser(newTransceiverPauser, signer.address.address));
1327+
} else {
1328+
console.error(`Unsupported field: ${k}.${j}.${l}`);
1329+
process.exit(1);
1330+
}
1331+
}
1332+
} else {
1333+
console.error(`Unsupported field: ${k}.${j}`);
1334+
process.exit(1);
1335+
1336+
}
1337+
}
13151338
} else {
13161339
console.error(`Unsupported field: ${k}`);
13171340
process.exit(1);
@@ -1404,6 +1427,8 @@ async function pullChainConfig<N extends Network, C extends Chain>(
14041427

14051428
const version = getVersion(manager.chain, ntt);
14061429

1430+
const transceiverPauser = await ntt.getTransceiver(0).then((t) => t?.getPauser() ?? null);
1431+
14071432
const config: ChainConfig = {
14081433
version,
14091434
mode,
@@ -1413,13 +1438,16 @@ async function pullChainConfig<N extends Network, C extends Chain>(
14131438
token: addresses.token!,
14141439
transceivers: {
14151440
threshold,
1416-
wormhole: addresses.transceiver!.wormhole!,
1441+
wormhole: { address: addresses.transceiver!.wormhole! },
14171442
},
14181443
limits: {
14191444
outbound: outboundLimitDecimals,
14201445
inbound: {},
14211446
},
14221447
};
1448+
if (transceiverPauser) {
1449+
config.transceivers.wormhole.pauser = transceiverPauser.toString();
1450+
}
14231451
if (pauser) {
14241452
config.pauser = pauser.toString();
14251453
}

0 commit comments

Comments
 (0)