diff --git a/x/uibc/module/abci.go b/x/uibc/module/abci.go index 4b72338e46..4c5df229be 100644 --- a/x/uibc/module/abci.go +++ b/x/uibc/module/abci.go @@ -1,6 +1,8 @@ package uibc import ( + "time" + sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/tendermint/tendermint/abci/types" "github.com/umee-network/umee/v6/x/uibc/quota/keeper" @@ -8,17 +10,23 @@ import ( // BeginBlock implements BeginBlock for the x/uibc module. func BeginBlock(ctx sdk.Context, k keeper.Keeper) { + logger := ctx.Logger().With("module", "uibc") quotaExpires, err := k.GetExpire() if err != nil { // TODO, use logger as argument - ctx.Logger().Error("can't get quota exipre", "error", err) + logger.Error("can't get quota exipre", "error", err) return } // reset quotas if quotaExpires == nil || quotaExpires.Before(ctx.BlockTime()) { if err = k.ResetAllQuotas(); err != nil { - ctx.Logger().Error("can't get quota exipre", "error", err) + logger.Error("can't get quota exipre", "error", err) + } else { + logger.Info("IBC Quota Reset") + ctx.EventManager().EmitEvent( + sdk.NewEvent("/umee/uibc/v1/EventQuotaReset", + sdk.NewAttribute("next_expire", quotaExpires.UTC().Format(time.RFC3339)))) } } }