Skip to content

Commit

Permalink
missing credits update on opt in
Browse files Browse the repository at this point in the history
  • Loading branch information
apexearth committed Dec 6, 2024
1 parent a7b465d commit 0aec5e0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/templates/otoken/otoken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,11 @@ export const createOTokenProcessor = (params: {

owner.delegatedTo = null
if (option === RebasingOption.OptIn) {
const afterHighResUpgrade = block.header.height >= (params.Upgrade_CreditsBalanceOfHighRes ?? 0)
const otokenContract = new otoken.Contract(ctx, block.header, params.otokenAddress)
owner.credits = afterHighResUpgrade
? await otokenContract.creditsBalanceOfHighres(owner.address).then((c) => c._0)
: await otokenContract.creditsBalanceOf(owner.address).then((c) => c._0 * 1000000000n)
rebaseOption.status = RebasingOption.OptIn
owner.rebasingOption = RebasingOption.OptIn
otokenObject.nonRebasingSupply -= owner.balance
Expand Down

0 comments on commit 0aec5e0

Please sign in to comment.