Skip to content

Commit 091a0de

Browse files
committed
fix div zero
1 parent 96fdb82 commit 091a0de

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/mainnet/processors/protocol/protocol.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ const getOTokenDetails = async (
218218
)
219219
const woethBalance = superOETHbWrappedOETH?.balanceETH ?? 0n
220220
detail.bridgedTvl = woethBalance
221-
detail.revenue += ((detailOETH?.revenue ?? 0n) * woethBalance) / detail.tvl
221+
if (detail.tvl !== 0n) {
222+
detail.revenue += ((detailOETH?.revenue ?? 0n) * woethBalance) / detail.tvl
223+
}
222224
} else if (detail.product === 'superOETHp') {
223225
const detailOETH = await getProtocolDailyStatDetail(ctx, date, 'OETH')
224226
const superOETHpWrappedOETH = await getLatestStrategyBalance(
@@ -228,7 +230,9 @@ const getOTokenDetails = async (
228230
)
229231
const woethBalance = superOETHpWrappedOETH?.balanceETH ?? 0n
230232
detail.bridgedTvl = woethBalance
231-
detail.revenue += ((detailOETH?.revenue ?? 0n) * woethBalance) / detail.tvl
233+
if (detail.tvl !== 0n) {
234+
detail.revenue += ((detailOETH?.revenue ?? 0n) * woethBalance) / detail.tvl
235+
}
232236
}
233237

234238
details.push(detail)

0 commit comments

Comments
 (0)