24 lines
524 B
Go
24 lines
524 B
Go
package keeper
|
|
|
|
import (
|
|
"github.com/cosmos/cosmos-sdk/telemetry"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/cosmos/cosmos-sdk/x/protocolpool/types"
|
|
)
|
|
|
|
func (k Keeper) BeginBlocker(ctx sdk.Context) error {
|
|
start := telemetry.Now()
|
|
defer telemetry.ModuleMeasureSince(types.ModuleName, start, telemetry.MetricKeyBeginBlocker)
|
|
|
|
params, err := k.Params.Get(ctx)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if uint64(ctx.BlockHeight())%params.DistributionFrequency == 0 {
|
|
return k.DistributeFunds(ctx)
|
|
}
|
|
|
|
return nil
|
|
}
|