Skip to content

Commit

Permalink
Fix claimed amount (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-stakewise authored Dec 18, 2024
1 parent c562842 commit cff098f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mappings/merkleDistributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,15 @@ export function handleRewardsRootUpdated(event: RewardsRootUpdated): void {
export function handleRewardsClaimed(event: RewardsClaimed): void {
const user = event.params.account
const tokens = event.params.tokens
const amounts = event.params.cumulativeAmounts
const cumulativeAmounts = event.params.cumulativeAmounts
for (let i = 0; i < tokens.length; i++) {
const claimedAmountId = `${tokens[i].toHex()}-${user.toHex()}`
let claimedAmount = DistributorClaimedAmount.load(claimedAmountId)
if (claimedAmount == null) {
claimedAmount = new DistributorClaimedAmount(claimedAmountId)
claimedAmount.cumulativeClaimedAmount = BigInt.zero()
}
claimedAmount.cumulativeClaimedAmount = claimedAmount.cumulativeClaimedAmount.plus(amounts[i])
claimedAmount.cumulativeClaimedAmount = cumulativeAmounts[i]
claimedAmount.save()
}
store.remove('DistributorClaim', user.toHex())
Expand Down

0 comments on commit cff098f

Please sign in to comment.