Skip to content

Commit

Permalink
fix: gracefully handle networks without core pool
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Aug 20, 2024
1 parent a0697ef commit 0b5eac7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ const getVTokensFromUnderlying = async (
isolatedVTokens: IsolatedVTokensFromUnderlyingQuery["markets"];
}> => {
const isolatedPoolSubgraphClient = new SubgraphClient(getConfig().isolatedPoolsSubgraphUrl);
const corePoolSubgraphClient = new SubgraphClient(getConfig().corePoolSubgraphUrl);
const { data: { markets: isolatedVTokens = [] } = { isolatedVTokens: [] } } =
await isolatedPoolSubgraphClient.getIsolatedVTokensFromUnderlying(underlyingAddress);
const { data: { markets: coreVTokens = [] } = { coreVTokens: [] } } =
const corePoolSubgraphUrl = getConfig().corePoolSubgraphUrl
let coreVTokens: CoreVTokensFromUnderlyingQuery["markets"] = []
if (corePoolSubgraphUrl) {
const corePoolSubgraphClient = new SubgraphClient(getConfig().corePoolSubgraphUrl);
const { data: { markets } = {markets: [] } } =
await corePoolSubgraphClient.getCoreVTokensFromUnderlying(underlyingAddress);
coreVTokens = markets
}

return { coreVTokens, isolatedVTokens };
};
Expand Down

0 comments on commit 0b5eac7

Please sign in to comment.