From 1911a1f9bacd9e5d79cfc53c2affa5413efdf139 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 5 Nov 2024 09:11:27 +0700 Subject: [PATCH] fix balance math for new rebasing erc20 processor --- src/base/erc20.ts | 2 +- src/mainnet/processors/erc20s.ts | 2 +- src/ousd/processors/erc20s.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/base/erc20.ts b/src/base/erc20.ts index 842b9dde..7a35f79b 100644 --- a/src/base/erc20.ts +++ b/src/base/erc20.ts @@ -25,7 +25,7 @@ export const baseERC20s = [ }), getCredits: async (ctx, block, address) => { const oToken = new otoken.Contract(ctx, block.header, baseAddresses.tokens.superOETHb) - return oToken.creditsBalanceOfHighres(address).then((credits) => credits._1) + return oToken.creditsBalanceOfHighres(address).then((credits) => credits._0) }, getCreditsPerToken: async (ctx, block) => { const oToken = new otoken.Contract(ctx, block.header, baseAddresses.tokens.superOETHb) diff --git a/src/mainnet/processors/erc20s.ts b/src/mainnet/processors/erc20s.ts index bf11fd17..037ed0fe 100644 --- a/src/mainnet/processors/erc20s.ts +++ b/src/mainnet/processors/erc20s.ts @@ -56,7 +56,7 @@ const rebasingTracks: Record { const oToken = new otoken.Contract(ctx, block.header, tokens.OETH) - return oToken.creditsBalanceOfHighres(address).then((credits) => credits._1) + return oToken.creditsBalanceOfHighres(address).then((credits) => credits._0) }, getCreditsPerToken: async (ctx, block) => { const oToken = new otoken.Contract(ctx, block.header, tokens.OETH) diff --git a/src/ousd/processors/erc20s.ts b/src/ousd/processors/erc20s.ts index e510c5c2..726cc2dc 100644 --- a/src/ousd/processors/erc20s.ts +++ b/src/ousd/processors/erc20s.ts @@ -18,14 +18,14 @@ const rebasingTracks: Record { const oToken = new otoken.Contract(ctx, block.header, tokens.OUSD) if (block.header.height < 13533937) { - return oToken.creditsBalanceOf(address).then((credits) => credits._1) + return oToken.creditsBalanceOf(address).then((credits) => credits._0 * 1000000000n) } - return oToken.creditsBalanceOfHighres(address).then((credits) => credits._1) + return oToken.creditsBalanceOfHighres(address).then((credits) => credits._0) }, getCreditsPerToken: async (ctx, block) => { const oToken = new otoken.Contract(ctx, block.header, tokens.OUSD) if (block.header.height < 13533937) { - return oToken.rebasingCreditsPerToken() + return oToken.rebasingCreditsPerToken().then((cpt) => cpt * 1000000000n) } return oToken.rebasingCreditsPerTokenHighres() },