Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 5bafc14

Browse files
committed
fix(defender): rollout on missing networks
1 parent fe4bcec commit 5bafc14

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

defender/src/setup.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import config from "./config";
22
import { ApiError, ConfigError } from "./errors";
3-
import { NETWORKS } from "./networks";
3+
import { NETWORKS, getNetworkConfigFromName } from "./networks";
44
import { reset } from "./reset";
55
import { rollOut } from "./rollout";
66
import { updateAutotask, updateSentinel } from "./update";
@@ -29,6 +29,18 @@ const setup = async () => {
2929
const oldAutoTasks = await autotaskClient.list();
3030
const oldSentinels = await sentinelClient.list();
3131

32+
const networksDeployed = oldAutoTasks.items
33+
.map((task) => getNetworkConfigFromName(task.name).chainId)
34+
.filter((value, index, array) => array.indexOf(value) === index);
35+
36+
const missingNetworks = networks.filter(
37+
(network) => !networksDeployed.includes(network.chainId),
38+
);
39+
40+
if (missingNetworks.length > 0) {
41+
await rollOut(missingNetworks);
42+
}
43+
3244
let updates = false;
3345

3446
if (oldAutoTasks.items.length > 0) {

0 commit comments

Comments
 (0)