Skip to content

Commit 9574dc2

Browse files
committed
only distribute whitelisted denoms and fix tests
1 parent e2f3fc8 commit 9574dc2

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

x/protocolpool/keeper/genesis.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ import (
1212

1313
func (k Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) error {
1414
currentTime := k.HeaderService.HeaderInfo(ctx).Time
15+
16+
err := k.Params.Set(ctx, *data.Params)
17+
if err != nil {
18+
return fmt.Errorf("failed to set params: %w", err)
19+
}
20+
1521
for _, cf := range data.ContinuousFund {
1622
// ignore expired ContinuousFunds
1723
if cf.Expiry != nil && cf.Expiry.Before(currentTime) {
@@ -129,5 +135,12 @@ func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error)
129135
return nil, err
130136
}
131137

138+
params, err := k.Params.Get(ctx)
139+
if err != nil {
140+
return nil, err
141+
}
142+
143+
genState.Params = &params
144+
132145
return genState, nil
133146
}

x/protocolpool/keeper/keeper.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ func (k Keeper) IterateAndUpdateFundsDistribution(ctx context.Context) error {
228228

229229
// next we iterate over the distributions, calculate each recipient's share and the remaining pool funds
230230
toDistribute := map[string]sdk.Coins{}
231-
poolFunds := sdk.NewCoins()
232231
amountToDistribute := sdk.NewCoins() // amount assigned to distributions
233232
allDistributions := sdk.NewCoins() // total amount distributed to the pool, to then calculate the remaining pool funds
234233

@@ -281,7 +280,7 @@ func (k Keeper) IterateAndUpdateFundsDistribution(ctx context.Context) error {
281280
}
282281
}
283282

284-
poolFunds = allDistributions.Sub(amountToDistribute...)
283+
poolFunds := allDistributions.Sub(amountToDistribute...)
285284
if !poolFunds.IsZero() {
286285
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ProtocolPoolDistrAccount, types.ModuleName, poolFunds); err != nil {
287286
return err

0 commit comments

Comments
 (0)