Documentation ¶
Index ¶
- func NewMsgServerImpl(k Keeper) types.MsgServer
- func NewQueryServerImpl(k Keeper) types.QueryServer
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func TotalUnreleasedIncentives(k Keeper) sdk.Invariant
- type Keeper
- func (k Keeper) CreateSchedule(ctx sdk.Context, startTime, endTime time.Time, amount sdk.Coins) (schedule types.Schedule, err error)
- func (k Keeper) DeleteSchedule(ctx sdk.Context, id uint64)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetModuleAddress() sdk.AccAddress
- func (k Keeper) GetNextScheduleID(ctx sdk.Context) uint64
- func (k Keeper) GetSchedule(ctx sdk.Context, id uint64) (schedule types.Schedule, found bool)
- func (k Keeper) GetSchedulePrefixStore(ctx sdk.Context) prefix.Store
- func (k Keeper) IncrementNextScheduleID(ctx sdk.Context) uint64
- func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState)
- func (k Keeper) IterateSchedules(ctx sdk.Context, cb func(types.Schedule) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) ReleaseBlockReward(ctx sdk.Context, bondedVotes []abci.VoteInfo) (ids []uint64, totalBlockReward sdk.Coins)
- func (k Keeper) SetNextScheduleID(ctx sdk.Context, id uint64)
- func (k Keeper) SetSchedule(ctx sdk.Context, schedule types.Schedule)
- func (k Keeper) TerminateSchedules(ctx sdk.Context, ids []uint64) (amount sdk.Coins, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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 ¶
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 ¶
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 ¶
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 ¶
GetSchedule loads the incentives schedule of the specified id
func (Keeper) GetSchedulePrefixStore ¶
GetSchedulePrefixStore returns a prefix store of all schedules
func (Keeper) IncrementNextScheduleID ¶
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 ¶
IterateSchedules iterates over all active schedules, calling the callback function with the schedule info. The iteration stops if the callback returns false.
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 ¶
SetNextScheduleId sets the next schedule id to the provided value
func (Keeper) SetSchedule ¶
SetSchedule saves the provided incentives schedule to store
func (Keeper) TerminateSchedules ¶
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.