Skip to content

Commit

Permalink
feature: Fixes #86 Avoid panic in ibc begin/end block (FundCommunityP…
Browse files Browse the repository at this point in the history
…oolFromModule)
  • Loading branch information
InnerPeace080 committed Oct 4, 2024
1 parent 73fbf92 commit c4e6333
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions x/distribution/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ func NewKeeper(
// The amount is first added to the distribution module account and then directly
// added to the pool. An error is returned if the amount cannot be sent to the
// module account.
func (k Keeper) FundCommunityPoolFromModule(ctx sdk.Context, amount sdk.Coins, senderModule string) error {
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, senderModule, types.ModuleName, amount); err != nil {
func (k Keeper) FundCommunityPoolFromModule(ctx sdk.Context, amounts sdk.Coins, senderModule string) error {
// ensure amount not contains zero
amounts = sdk.NewCoins(amounts...)
if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, senderModule, types.ModuleName, amounts); err != nil {
return err
}

feePool := k.GetFeePool(ctx)
feePool.CommunityPool = feePool.CommunityPool.Add(sdk.NewDecCoinsFromCoins(amount...)...)
feePool.CommunityPool = feePool.CommunityPool.Add(sdk.NewDecCoinsFromCoins(amounts...)...)
k.SetFeePool(ctx, feePool)

return nil
Expand Down

0 comments on commit c4e6333

Please sign in to comment.