Skip to content

Commit

Permalink
fix(defender): rollout on missing networks
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbeckers committed Mar 13, 2024
1 parent fe4bcec commit 5bafc14
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion defender/src/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import config from "./config";
import { ApiError, ConfigError } from "./errors";
import { NETWORKS } from "./networks";
import { NETWORKS, getNetworkConfigFromName } from "./networks";
import { reset } from "./reset";
import { rollOut } from "./rollout";
import { updateAutotask, updateSentinel } from "./update";
Expand Down Expand Up @@ -29,6 +29,18 @@ const setup = async () => {
const oldAutoTasks = await autotaskClient.list();
const oldSentinels = await sentinelClient.list();

const networksDeployed = oldAutoTasks.items
.map((task) => getNetworkConfigFromName(task.name).chainId)
.filter((value, index, array) => array.indexOf(value) === index);

const missingNetworks = networks.filter(
(network) => !networksDeployed.includes(network.chainId),
);

if (missingNetworks.length > 0) {
await rollOut(missingNetworks);
}

let updates = false;

if (oldAutoTasks.items.length > 0) {
Expand Down

0 comments on commit 5bafc14

Please sign in to comment.