cosmos-sdk/x/epochs/keeper/hooks.go
Hieu Vu 1028e27f79
feat(x/epochs): upstream osmosis epoch module (#19697)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
2024-04-04 08:10:25 +00:00

28 lines
814 B
Go

package keeper
import (
"context"
"cosmossdk.io/x/epochs/types"
)
// Hooks gets the hooks for governance Keeper
func (k Keeper) Hooks() types.EpochHooks {
if k.hooks == nil {
// return a no-op implementation if no hooks are set
return types.MultiEpochHooks{}
}
return k.hooks
}
// AfterEpochEnd gets called at the end of the epoch, end of epoch is the timestamp of first block produced after epoch duration.
func (k Keeper) AfterEpochEnd(ctx context.Context, identifier string, epochNumber int64) error {
return k.Hooks().AfterEpochEnd(ctx, identifier, epochNumber)
}
// BeforeEpochStart new epoch is next block of epoch end block
func (k Keeper) BeforeEpochStart(ctx context.Context, identifier string, epochNumber int64) error {
return k.Hooks().BeforeEpochStart(ctx, identifier, epochNumber)
}