@@ -38,12 +38,12 @@ func (k Keeper) EndBlocker(ctx sdk.Context) error {
3838 err := k .ProcessLPRewardDistribution (cacheCtx )
3939 if err != nil {
4040 ctx .Logger ().Error (fmt .Sprintf ("Failed to process lp rewards distribution: %s" , err .Error ()))
41+ return err
4142 } else {
4243 write ()
43- // distribute external rewards
44- k .ProcessExternalRewardsDistribution (ctx )
4544 }
46-
45+ // distribute external rewards
46+ k .ProcessExternalRewardsDistribution (ctx )
4747 return nil
4848}
4949
@@ -343,7 +343,8 @@ func (k Keeper) ConvertGasFeesToUsdc(ctx sdk.Context, baseCurrency string, addre
343343 continue
344344 }
345345
346- tokenOutAmount , _ , err := k .amm .InternalSwapExactAmountIn (ctx , address , address , pool , tokenIn , baseCurrency , math .ZeroInt (), osmomath .ZeroBigDec (), osmomath .ZeroBigDec ())
346+ cacheCtx , write := ctx .CacheContext ()
347+ tokenOutAmount , _ , err := k .amm .InternalSwapExactAmountIn (cacheCtx , address , address , pool , tokenIn , baseCurrency , math .ZeroInt (), osmomath .ZeroBigDec (), osmomath .ZeroBigDec ())
347348 if err != nil {
348349 // Continue as we can swap it when this amount is higher
349350 if err == ammtypes .ErrTokenOutAmountZero {
@@ -355,10 +356,10 @@ func (k Keeper) ConvertGasFeesToUsdc(ctx sdk.Context, baseCurrency string, addre
355356 sdk .NewAttribute ("Token amount" , "0" ),
356357 ),
357358 })
358- continue
359359 }
360- return sdk. Coins {}, err
360+ continue
361361 }
362+ write ()
362363
363364 // Swapped USDC coin
364365 swappedCoins := sdk .NewCoins (sdk .NewCoin (baseCurrency , tokenOutAmount ))
0 commit comments