Skip to content

Commit

Permalink
add check if multicall is returning null/undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpeluche committed Jul 8, 2024
1 parent 8f39f9c commit 8d02234
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions projects/contrax-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ async function getSteerData(api) {
}),
]);

bals.forEach((bal, i) => {
for (const [i, bal] of bals.entries()) {
if (!bal || !supplies[i] || !reserves[i] || !reserves[i][0] || !reserves[i][1]) continue
const ratio = bal / supplies[i];
const token0Bal = reserves[i][0] * ratio;
const token1Bal = reserves[i][1] * ratio;
api.addToken(token0s[i], token0Bal);
api.addToken(token1s[i], token1Bal);
});
}
}

async function getGMXData(api) {
Expand Down

0 comments on commit 8d02234

Please sign in to comment.