Skip to content

Commit

Permalink
change minor logic for SetAccountBalanceForDenom in interchainstaking (
Browse files Browse the repository at this point in the history
…quicksilver-zone#669)

Co-authored-by: Nguyen Thanh Nhan <[email protected]>
  • Loading branch information
DongLieu and ThanhNhann authored Oct 13, 2023
1 parent d786e8b commit a24dc70
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 a24dc70

Please sign in to comment.