Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
facundomedica committed Oct 11, 2024
1 parent cdd876b commit 99235e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions x/protocolpool/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ func (k Keeper) IterateAndUpdateFundsDistribution(ctx context.Context) error {
toDistribute := map[string]sdk.Coins{}
poolFunds := sdk.NewCoins()
amountToDistribute := sdk.NewCoins() // amount assigned to distributions

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of poolFunds is never used.
totalDistribution := sdk.NewCoins() // total amount distributed to the pool, to then calculate the remaining pool funds
allDistributions := sdk.NewCoins() // total amount distributed to the pool, to then calculate the remaining pool funds

if err = k.Distributions.Walk(ctx, nil, func(key time.Time, amount types.DistributionAmount) (stop bool, err error) {
percentageToDistribute := math.LegacyZeroDec()
totalDistribution = totalDistribution.Add(amount.Amount...)
allDistributions = allDistributions.Add(amount.Amount...)

for _, f := range funds {
if f.Expiry != nil && f.Expiry.Before(key) {
Expand Down Expand Up @@ -272,7 +272,7 @@ func (k Keeper) IterateAndUpdateFundsDistribution(ctx context.Context) error {
}
}

poolFunds = totalDistribution.Sub(amountToDistribute...)
poolFunds = allDistributions.Sub(amountToDistribute...)
if !poolFunds.IsZero() {
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ProtocolPoolDistrAccount, types.ModuleName, poolFunds); err != nil {
return err
Expand Down

0 comments on commit 99235e2

Please sign in to comment.