keeper

package
v0.0.0-...-baf6593 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,

) *Keeper

func (Keeper) CreateEpochInfo

func (k Keeper) CreateEpochInfo(ctx sdk.Context, epochInfo types.EpochInfo) error

CreateEpochInfo creates a new EpochInfo. Return an error if the epoch fails validation, if the epoch Id already exists.

func (Keeper) GetAllEpochInfo

func (k Keeper) GetAllEpochInfo(ctx sdk.Context) (list []types.EpochInfo)

GetAllEpochInfo returns all epochInfos

func (Keeper) GetEpochInfo

func (k Keeper) GetEpochInfo(
	ctx sdk.Context,
	id types.EpochInfoName,
) (val types.EpochInfo, found bool)

GetEpochInfo returns an epochInfo from its id

func (Keeper) InitializeForGenesis

func (k Keeper) InitializeForGenesis(ctx sdk.Context)

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) MaybeStartNextEpoch

func (k Keeper) MaybeStartNextEpoch(ctx sdk.Context, id types.EpochInfoName) (nextEpochStarted bool, err error)

MaybeStartNextEpoch initializes and/or ticks the next epoch. First, initializes `EpochInfo` if all below conditions are met: - `EpochInfo.IsInitialized` is false - `BlockHeight` >= 2 (for accurate current block time) - `BlockTime` >= `EpochInfo.NextTick` If `EpochInfo.IsInitialized` is true, checks if current `BlockTime` has reached `NextTick` of the epoch, and if so starts a new epoch by updating `NextTick`, `CurrentEpoch` and `NextEpochStartBlock`.

func (Keeper) MustGetFundingSampleEpochInfo

func (k Keeper) MustGetFundingSampleEpochInfo(
	ctx sdk.Context,
) types.EpochInfo

func (Keeper) MustGetFundingTickEpochInfo

func (k Keeper) MustGetFundingTickEpochInfo(
	ctx sdk.Context,
) types.EpochInfo

func (Keeper) MustGetStatsEpochInfo

func (k Keeper) MustGetStatsEpochInfo(
	ctx sdk.Context,
) types.EpochInfo

func (Keeper) NumBlocksSinceEpochStart

func (k Keeper) NumBlocksSinceEpochStart(
	ctx sdk.Context,
	id types.EpochInfoName,
) (
	uint32,
	error,
)

NumBlocksSinceEpochStart returns the number of blocks since the epoch started.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL