Skip to content

Commit

Permalink
fix(IRO): invariant only check sufficiency of IRO tokens after settli…
Browse files Browse the repository at this point in the history
…ng (#1571)
  • Loading branch information
danwt authored Nov 28, 2024
1 parent 81a984c commit 5e0a7c7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions x/iro/keeper/invariants.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ func InvariantAccounting(k Keeper) uinv.Func {
if !dymBalance.IsZero() {
errs = append(errs, fmt.Errorf("dym tokens left in settled: planID: %d, balance: %s", plan.Id, dymBalance))
}
}

// Check if module has enough RA tokens to cover the claimable amount
claimable := plan.TotalAllocation.Amount.Sub(plan.ClaimedAmt)
moduleBal := k.BK.GetBalance(ctx, k.AK.GetModuleAddress(types.ModuleName), plan.SettledDenom)
if moduleBal.Amount.LT(claimable) {
errs = append(errs, fmt.Errorf("insufficient RA tokens: planID: %d, required: %s, available: %s",
plan.Id, claimable, moduleBal.Amount))
// Check if module has enough RA tokens to cover the claimable amount
claimable := plan.SoldAmt.Sub(plan.ClaimedAmt)
moduleBal := k.BK.GetBalance(ctx, k.AK.GetModuleAddress(types.ModuleName), plan.SettledDenom)
if moduleBal.Amount.LT(claimable) {
errs = append(errs, fmt.Errorf("insufficient RA tokens: planID: %d, required: %s, available: %s",
plan.Id, claimable, moduleBal.Amount))
}
}
}

Expand Down

0 comments on commit 5e0a7c7

Please sign in to comment.