Skip to content

Commit 4041ba1

Browse files
committed
fix: gracefully handle networks without core pool
1 parent 2b758a9 commit 4041ba1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/keeper-bots/src/converter-bot/queries/getVTokensFromUnderlying.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ const getVTokensFromUnderlying = async (
1111
isolatedVTokens: IsolatedVTokensFromUnderlyingQuery["markets"];
1212
}> => {
1313
const isolatedPoolSubgraphClient = new SubgraphClient(getConfig().isolatedPoolsSubgraphUrl);
14-
const corePoolSubgraphClient = new SubgraphClient(getConfig().corePoolSubgraphUrl);
1514
const { data: { markets: isolatedVTokens = [] } = { isolatedVTokens: [] } } =
1615
await isolatedPoolSubgraphClient.getIsolatedVTokensFromUnderlying(underlyingAddress);
17-
const { data: { markets: coreVTokens = [] } = { coreVTokens: [] } } =
18-
await corePoolSubgraphClient.getCoreVTokensFromUnderlying(underlyingAddress);
16+
const corePoolSubgraphUrl = getConfig().corePoolSubgraphUrl;
17+
let coreVTokens: CoreVTokensFromUnderlyingQuery["markets"] = [];
18+
if (corePoolSubgraphUrl) {
19+
const corePoolSubgraphClient = new SubgraphClient(getConfig().corePoolSubgraphUrl);
20+
const { data: { markets } = { markets: [] } } = await corePoolSubgraphClient.getCoreVTokensFromUnderlying(
21+
underlyingAddress,
22+
);
23+
coreVTokens = markets;
24+
}
1925

2026
return { coreVTokens, isolatedVTokens };
2127
};

0 commit comments

Comments
 (0)