Skip to content

Commit 098a443

Browse files
committed
convert urates to 18 decimals
1 parent 2988f41 commit 098a443

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/templates/otoken/otoken-daily-stats.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,14 @@ export const processOTokenDailyStats = async (
164164
).then((a) => a?.rate ?? 0n),
165165
underlyingSymbol === 'ETH'
166166
? 10n ** 18n
167-
: ensureExchangeRate(ctx, block, underlyingSymbol as CurrencyAddress, 'ETH').then((a) => a?.rate ?? 0n),
167+
: ensureExchangeRate(ctx, block, underlyingSymbol as CurrencyAddress, 'ETH').then(
168+
(a) => (a ? a.rate * 10n ** BigInt(18 - a.decimals) : 0n),
169+
),
168170
underlyingSymbol === 'USD'
169171
? 10n ** 18n
170-
: ensureExchangeRate(ctx, block, underlyingSymbol as CurrencyAddress, 'USD').then((a) => a?.rate ?? 0n),
172+
: ensureExchangeRate(ctx, block, underlyingSymbol as CurrencyAddress, 'USD').then(
173+
(a) => (a ? a.rate * 10n ** BigInt(18 - a.decimals) : 0n),
174+
),
171175
])
172176
if (process.env.DEBUG_PERF === 'true') {
173177
ctx.log.info(`getOTokenDailyStat async calls took ${Date.now() - asyncStartTime}ms`)

0 commit comments

Comments
 (0)