Documentation ¶
Index ¶
- type ExecuteByIncentiveTypeCB
- type Keeper
- func (k Keeper) AddIncentives(ctx sdk.Context, incentives []types.Incentive) error
- func (k Keeper) ExecuteByIncentiveType(ctx sdk.Context, incentive types.Incentive, cb ExecuteByIncentiveTypeCB) error
- func (k Keeper) ExecuteIncentiveStrategy(ctx sdk.Context, incentive types.Incentive, strategy types.Strategy) error
- func (k Keeper) ExecuteStrategies(ctx sdk.Context) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetIncentivesByType(ctx sdk.Context, incentive types.Incentive) ([]types.Incentive, error)
- func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState)
- func (k Keeper) RemoveIncentivesByType(ctx sdk.Context, incentive types.Incentive) error
- type QueryServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecuteByIncentiveTypeCB ¶
ExecuteByIncentiveTypeCB is a callback function that can utilized to update all incentives of a given type. This is useful for having incentive/strategy pairs that are meant to last several blocks. This function should return the updated incentive, or nil if the incentive should be deleted.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper is the base keeper for the x/incentives module.
func NewKeeper ¶
func NewKeeper( sk storetypes.StoreKey, incentiveStrategies map[types.Incentive]types.Strategy, ) Keeper
NewKeeper constructs a new keeper from a store-key and a given set of (incentive, strategies) pairings. Note, if the strategies map is empty, then the keeper will not be able to process any incentives. This must be set by the application developer. Each incentive type must have a corresponding strategy function.
func (Keeper) AddIncentives ¶
AddIncentives adds a set of incentives to the module's state.
func (Keeper) ExecuteByIncentiveType ¶
func (k Keeper) ExecuteByIncentiveType( ctx sdk.Context, incentive types.Incentive, cb ExecuteByIncentiveTypeCB, ) error
ExecuteByIncentiveType updates all incentives of a given type.
func (Keeper) ExecuteIncentiveStrategy ¶
func (k Keeper) ExecuteIncentiveStrategy( ctx sdk.Context, incentive types.Incentive, strategy types.Strategy, ) error
ExecuteIncentiveStrategy executes a given strategy for all incentives of a given type. Note that the strategy may mutate the incentive, and return a new incentive to be stored. Stategies must return nil if the incentive should be deleted. Otherwise, the incentive will be updated.
func (Keeper) ExecuteStrategies ¶
ExecuteStrategies executes all of the strategies with the stored incentives.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the current store state as a genesis state. Note, that if any of the incentive types have no entries in the store, they will not be included in the genesis state.
func (Keeper) GetIncentivesByType ¶
func (k Keeper) GetIncentivesByType(ctx sdk.Context, incentive types.Incentive) ([]types.Incentive, error)
GetIncentivesByType returns all incentives of a given type.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState)
InitGenesis initializes the store state from a genesis state. Note, that all of the incentive types (e.g. badprice, goodprice) must be registered with the keeper in order for this to execute successfully.
type QueryServer ¶
type QueryServer struct {
// contains filtered or unexported fields
}
QueryServer is the default implementation of the x/incentives QueryServer.
func NewQueryServer ¶
func NewQueryServer(k Keeper) QueryServer
NewQueryServer returns an implementation of the x/incentives QueryServer.
func (QueryServer) GetAllIncentives ¶
func (q QueryServer) GetAllIncentives( ctx context.Context, _ *types.GetAllIncentivesRequest, ) (*types.GetAllIncentivesResponse, error)
GetAllIncentives returns all incentives currently stored in the module.
func (QueryServer) GetIncentivesByType ¶
func (q QueryServer) GetIncentivesByType( ctx context.Context, req *types.GetIncentivesByTypeRequest, ) (*types.GetIncentivesByTypeResponse, error)
GetIncentivesByType returns all incentives of a given type currently stored in the incentives module. If the type is not registered with the module, an error is returned.