diff --git a/defender/src/setup.ts b/defender/src/setup.ts index 0d56ee67..61fb2f9e 100644 --- a/defender/src/setup.ts +++ b/defender/src/setup.ts @@ -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"; @@ -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) { diff --git a/graph/networks.json b/graph/networks.json index 5babcf29..b96eae16 100644 --- a/graph/networks.json +++ b/graph/networks.json @@ -16,5 +16,17 @@ "address": "0xa16DFb32Eb140a6f3F2AC68f41dAd8c7e83C4941", "startBlock": 4421942 } + }, + "base": { + "HypercertMinter": { + "address": "0xC2d179166bc9dbB00A03686a5b17eCe2224c2704", + "startBlock": 11261815 + } + }, + "base-sepolia": { + "HypercertMinter": { + "address": "0xC2d179166bc9dbB00A03686a5b17eCe2224c2704", + "startBlock": 6771210 + } } }