Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
fix(studio): Fix zero totals case (#2546)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich committed Apr 7, 2023
1 parent 7131fb3 commit a06ac7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export abstract class SiloFinanceDTokenTokenFetcher extends AppTokenTemplatePosi
const reserveRaw = await multicall
.wrap(siloLensContract)
.totalBorrowAmountWithInterest(definition.siloAddress, appToken.tokens[0].address);
if (reserveRaw.isZero()) return [0];

const reserve = Number(reserveRaw) / 10 ** appToken.tokens[0].decimals;
const pricePerShare = reserve / Number(appToken.supply);
return [pricePerShare];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export abstract class SiloFinanceSTokenTokenFetcher extends AppTokenTemplatePosi
const reserveRaw = await multicall
.wrap(siloLensContract)
.totalDepositsWithInterest(definition.siloAddress, appToken.tokens[0].address);
if (reserveRaw.isZero()) return [0];

const reserve = Number(reserveRaw) / 10 ** appToken.tokens[0].decimals;
const pricePerShare = reserve / Number(appToken.supply);
return [pricePerShare];
Expand Down

0 comments on commit a06ac7b

Please sign in to comment.