Skip to content

Commit

Permalink
change minor logic for SetAccountBalanceForDenom in interchainstaking
Browse files Browse the repository at this point in the history
  • Loading branch information
DongLieu committed Oct 5, 2023
1 parent a02415f commit c29277f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion x/interchainstaking/keeper/zones.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,16 @@ func (k *Keeper) SetAccountBalanceForDenom(ctx sdk.Context, zone *types.Zone, ad
}
k.Logger(ctx).Info("Matched withdrawal address", "address", address, "wg", zone.WithdrawalAddress.BalanceWaitgroup, "balance", zone.WithdrawalAddress.Balance)
case zone.PerformanceAddress != nil && address == zone.PerformanceAddress.Address:
k.Logger(ctx).Info("Matched performance address")
existing := zone.PerformanceAddress.Balance.AmountOf(coin.Denom)
err = zone.PerformanceAddress.SetBalance(zone.PerformanceAddress.Balance.Sub(sdk.NewCoins(sdk.NewCoin(coin.Denom, existing))...).Add(coin)) // reset this denom
if err != nil {
return err
}
err = zone.PerformanceAddress.DecrementBalanceWaitgroup()
if err != nil {
return err
}
k.Logger(ctx).Info("Matched performance address", "address", address, "wg", zone.PerformanceAddress.BalanceWaitgroup, "balance", zone.PerformanceAddress.Balance)
default:
panic("unexpected")
}
Expand Down

0 comments on commit c29277f

Please sign in to comment.