From cff098f7e4c44a4eee33024f92db20b6ad7857ae Mon Sep 17 00:00:00 2001 From: evgeny-stakewise <123374581+evgeny-stakewise@users.noreply.github.com> Date: Thu, 19 Dec 2024 00:47:26 +0300 Subject: [PATCH] Fix claimed amount (#90) --- src/mappings/merkleDistributor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mappings/merkleDistributor.ts b/src/mappings/merkleDistributor.ts index ad21986..754124e 100644 --- a/src/mappings/merkleDistributor.ts +++ b/src/mappings/merkleDistributor.ts @@ -279,7 +279,7 @@ 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) @@ -287,7 +287,7 @@ export function handleRewardsClaimed(event: RewardsClaimed): void { 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())