From 5583131c4b84e838f8423487f8f585f87072b260 Mon Sep 17 00:00:00 2001 From: Amit Yadav Date: Thu, 15 Aug 2024 13:20:00 +0530 Subject: [PATCH] [Data]: Commitment module fix (#723) fix --- x/commitment/migrations/v4_migration.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x/commitment/migrations/v4_migration.go b/x/commitment/migrations/v4_migration.go index 91342605c..c856dea87 100644 --- a/x/commitment/migrations/v4_migration.go +++ b/x/commitment/migrations/v4_migration.go @@ -20,6 +20,14 @@ func (m Migrator) V4Migration(ctx sdk.Context) error { commitments = m.keeper.GetAllCommitments(ctx) for _, c := range commitments { + // claim >= vestedSoFar fix + for _, vesting := range c.VestingTokens { + vestedSoFar := vesting.VestedSoFar(ctx) + if vesting.ClaimedAmount.GT(vestedSoFar) { + vesting.ClaimedAmount = vestedSoFar + } + } + newCommittedTokens := []*types.CommittedTokens{} for _, commitmentToken := range c.CommittedTokens { if commitmentToken.Amount.GT(sdk.ZeroInt()) {