Skip to content

Commit

Permalink
fix: improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasmatt committed Dec 6, 2023
1 parent a95cee7 commit 8adab45
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions x/inflation/keeper/inflation.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,23 @@ func (k Keeper) AllocatePolynomialInflation(
strategicAccountAddr, err := k.sudoKeeper.GetRoot(ctx)
if err != nil {
k.Logger(ctx).Error("get root account error", "error", err)
return staking, strategic, community, nil
return staking, strategic, community, err
}

if err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, strategicAccountAddr, sdk.NewCoins(strategic)); err != nil {
k.Logger(ctx).Error("send coins to root account error", "error", err)
return sdk.Coin{}, sdk.Coin{}, sdk.Coin{}, nil
return sdk.Coin{}, sdk.Coin{}, sdk.Coin{}, err
}

_ = ctx.EventManager().EmitTypedEvents(
if err := ctx.EventManager().EmitTypedEvents(
&types.InflationDistributionEvent{
StakingRewards: staking,
StrategicReserve: strategic,
CommunityPool: community,
},
)
); err != nil {
return sdk.Coin{}, sdk.Coin{}, sdk.Coin{}, err
}

return staking, strategic, community, nil
}
Expand Down

0 comments on commit 8adab45

Please sign in to comment.