Documentation ¶
Index ¶
- type Keeper
- func (k Keeper) CreateEpochInfo(ctx sdk.Context, epochInfo types.EpochInfo) error
- func (k Keeper) EpochInfo(c context.Context, req *types.QueryGetEpochInfoRequest) (*types.QueryEpochInfoResponse, error)
- func (k Keeper) EpochInfoAll(c context.Context, req *types.QueryAllEpochInfoRequest) (*types.QueryEpochInfoAllResponse, error)
- func (k Keeper) GetAllEpochInfo(ctx sdk.Context) (list []types.EpochInfo)
- func (k Keeper) GetEpochInfo(ctx sdk.Context, id types.EpochInfoName) (val types.EpochInfo, found bool)
- func (k Keeper) InitializeForGenesis(ctx sdk.Context)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MaybeStartNextEpoch(ctx sdk.Context, id types.EpochInfoName) (nextEpochStarted bool, err error)
- func (k Keeper) MustGetFundingSampleEpochInfo(ctx sdk.Context) types.EpochInfo
- func (k Keeper) MustGetFundingTickEpochInfo(ctx sdk.Context) types.EpochInfo
- func (k Keeper) MustGetStatsEpochInfo(ctx sdk.Context) types.EpochInfo
- func (k Keeper) NumBlocksSinceEpochStart(ctx sdk.Context, id types.EpochInfoName) (uint32, error)
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 ¶
CreateEpochInfo creates a new EpochInfo. Return an error if the epoch fails validation, if the epoch Id already exists.
func (Keeper) EpochInfo ¶
func (k Keeper) EpochInfo( c context.Context, req *types.QueryGetEpochInfoRequest) (*types.QueryEpochInfoResponse, error)
func (Keeper) EpochInfoAll ¶
func (k Keeper) EpochInfoAll( c context.Context, req *types.QueryAllEpochInfoRequest) (*types.QueryEpochInfoAllResponse, error)
func (Keeper) GetAllEpochInfo ¶
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 (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 (Keeper) MustGetFundingTickEpochInfo ¶
func (Keeper) MustGetStatsEpochInfo ¶
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.