Skip to content

Commit

Permalink
fix balance math for new rebasing erc20 processor
Browse files Browse the repository at this point in the history
  • Loading branch information
apexearth committed Nov 5, 2024
1 parent c6a01d4 commit 1911a1f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/base/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/mainnet/processors/erc20s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const rebasingTracks: Record<string, Parameters<typeof createRebasingERC20Tracke
}),
getCredits: async (ctx, block, address) => {
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)
Expand Down
6 changes: 3 additions & 3 deletions src/ousd/processors/erc20s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ const rebasingTracks: Record<string, Parameters<typeof createRebasingERC20Tracke
getCredits: async (ctx, block, address) => {
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()
},
Expand Down

0 comments on commit 1911a1f

Please sign in to comment.