keeper

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(k Keeper) types.MsgServer

NewMsgServerImpl creates an implementation of the `MsgServer` interface for the given keeper.

func NewQueryServerImpl

func NewQueryServerImpl(k Keeper) types.QueryServer

NewQueryServerImpl creates an implementation of the `QueryServer` interface for the given keeper.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the incentives module invariants

func TotalUnreleasedIncentives

func TotalUnreleasedIncentives(k Keeper) sdk.Invariant

TotalUnreleasedIncentives asserts that the incentives module's coin balances match exactly the total amount of unreleased incentives.

Types

type Keeper

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

Keeper is the incentives module's keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, storeKey storetypes.StoreKey, accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper, distrKeeper types.DistrKeeper, stakingKeeper types.StakingKeeper,
	authority string,
) Keeper

NewKeeper creates a new incentives module keeper

func (Keeper) CreateSchedule

func (k Keeper) CreateSchedule(ctx sdk.Context, startTime, endTime time.Time, amount sdk.Coins) (schedule types.Schedule, err error)

CreateSchedule upon a successful CreateIncentivesScheduleProposal, withdraws appropriate amount of funds from the community pool, and initializes a new schedule in module store. Returns the new schedule that was created.

func (Keeper) DeleteSchedule

func (k Keeper) DeleteSchedule(ctx sdk.Context, id uint64)

DeleteSchedule removes the incentives schedule of the given id from module store.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns a genesis state for a given context and keeper

func (Keeper) GetModuleAddress

func (k Keeper) GetModuleAddress() sdk.AccAddress

GetModuleAddress returns the incentives module account's address

func (Keeper) GetNextScheduleID

func (k Keeper) GetNextScheduleID(ctx sdk.Context) uint64

GetNextScheduleId loads the next schedule id if a new schedule is to be created.

NOTE: the id should have been initialized in genesis, so it being undefined is a fatal error. we have the module panic in this case, instead of returning an error.

func (Keeper) GetSchedule

func (k Keeper) GetSchedule(ctx sdk.Context, id uint64) (schedule types.Schedule, found bool)

GetSchedule loads the incentives schedule of the specified id

func (Keeper) GetSchedulePrefixStore

func (k Keeper) GetSchedulePrefixStore(ctx sdk.Context) prefix.Store

GetSchedulePrefixStore returns a prefix store of all schedules

func (Keeper) IncrementNextScheduleID

func (k Keeper) IncrementNextScheduleID(ctx sdk.Context) uint64

IncrementNextScheduleId increases the next id by one, and returns the previous value.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState)

InitGenesis initializes the incentives module's storage according to the provided genesis state.

NOTE: we call `GetModuleAccount` instead of `SetModuleAccount` because the "get" function automatically sets the module account if it doesn't exist.

func (Keeper) IterateSchedules

func (k Keeper) IterateSchedules(ctx sdk.Context, cb func(types.Schedule) bool)

IterateSchedules iterates over all active schedules, calling the callback function with the schedule info. The iteration stops if the callback returns false.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) ReleaseBlockReward

func (k Keeper) ReleaseBlockReward(ctx sdk.Context, bondedVotes []abci.VoteInfo) (ids []uint64, totalBlockReward sdk.Coins)

ReleaseBlockReward handles the release of incentives. Returns the total amount of block reward released and the list of relevant schedule ids.

`bondedVotes` is a list of {validator address, validator voted on last block flag} for all validators in the bonded set.

func (Keeper) SetNextScheduleID

func (k Keeper) SetNextScheduleID(ctx sdk.Context, id uint64)

SetNextScheduleId sets the next schedule id to the provided value

func (Keeper) SetSchedule

func (k Keeper) SetSchedule(ctx sdk.Context, schedule types.Schedule)

SetSchedule saves the provided incentives schedule to store

func (Keeper) TerminateSchedules

func (k Keeper) TerminateSchedules(ctx sdk.Context, ids []uint64) (amount sdk.Coins, err error)

TerminateSchedules upon a successful TerminateIncentivesScheduleProposal, deletes the schedules specified by the proposal from module store, and returns the unreleased funds to the community pool. Returns the funds that ware returned.

Jump to

Keyboard shortcuts

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