Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) incentive.MsgServer
- func RegisterInvariants(_ sdk.InvariantRegistry, _ Keeper)
- type BondHooks
- type Keeper
- func (k Keeper) BondHooks() BondHooks
- func (k Keeper) BondSummary(ctx sdk.Context, addr sdk.AccAddress, denom string) (bonded sdk.Coin, unbonding sdk.Coin, unbondings []incentive.Unbonding)
- func (k Keeper) EndBlock(ctx sdk.Context) (skipped bool, err error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *incentive.GenesisState
- func (k Keeper) GetBonded(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
- func (k Keeper) GetLastRewardsTime(ctx sdk.Context) int64
- func (k Keeper) GetParams(ctx sdk.Context) incentive.Params
- func (k Keeper) InitGenesis(ctx sdk.Context, gs incentive.GenesisState)
- func (k Keeper) KVStore(ctx sdk.Context) sdk.KVStore
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) ModuleBalance(ctx sdk.Context, denom string) sdk.Coin
- func (k Keeper) UpdateAccount(ctx sdk.Context, addr sdk.AccAddress) (sdk.Coins, error)
- type Querier
- func (q Querier) AccountBonds(goCtx context.Context, req *incentive.QueryAccountBonds) (*incentive.QueryAccountBondsResponse, error)
- func (q Querier) ActualRates(goCtx context.Context, req *incentive.QueryActualRates) (*incentive.QueryActualRatesResponse, error)
- func (q Querier) CompletedIncentivePrograms(goCtx context.Context, req *incentive.QueryCompletedIncentivePrograms) (*incentive.QueryCompletedIncentiveProgramsResponse, error)
- func (q Querier) CurrentRates(goCtx context.Context, req *incentive.QueryCurrentRates) (*incentive.QueryCurrentRatesResponse, error)
- func (q Querier) IncentiveProgram(goCtx context.Context, req *incentive.QueryIncentiveProgram) (*incentive.QueryIncentiveProgramResponse, error)
- func (q Querier) LastRewardTime(goCtx context.Context, req *incentive.QueryLastRewardTime) (*incentive.QueryLastRewardTimeResponse, error)
- func (q Querier) OngoingIncentivePrograms(goCtx context.Context, req *incentive.QueryOngoingIncentivePrograms) (*incentive.QueryOngoingIncentiveProgramsResponse, error)
- func (q Querier) Params(goCtx context.Context, req *incentive.QueryParams) (*incentive.QueryParamsResponse, error)
- func (q Querier) PendingRewards(goCtx context.Context, req *incentive.QueryPendingRewards) (*incentive.QueryPendingRewardsResponse, error)
- func (q Querier) TotalBonded(goCtx context.Context, req *incentive.QueryTotalBonded) (*incentive.QueryTotalBondedResponse, error)
- func (q Querier) TotalUnbonding(goCtx context.Context, req *incentive.QueryTotalUnbonding) (*incentive.QueryTotalUnbondingResponse, error)
- func (q Querier) UpcomingIncentivePrograms(goCtx context.Context, req *incentive.QueryUpcomingIncentivePrograms) (*incentive.QueryUpcomingIncentiveProgramsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of MsgServer for the x/incentive module.
func RegisterInvariants ¶
func RegisterInvariants(_ sdk.InvariantRegistry, _ Keeper)
RegisterInvariants registers empty incentive module invariants
Types ¶
type BondHooks ¶
type BondHooks struct {
// contains filtered or unexported fields
}
BondHooks defines a structure around the x/incentive Keeper that implements various BondHooks interface defined by other modules such as x/leverage.
func (BondHooks) ForceUnbondTo ¶
ForceUnbondTo instantly unbonds uTokens until an account's bonded amount of a given uToken is no greater than a certain amount.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.Codec, storeKey storetypes.StoreKey, bk incentive.BankKeeper, lk incentive.LeverageKeeper, ) Keeper
func (Keeper) BondSummary ¶
func (k Keeper) BondSummary(ctx sdk.Context, addr sdk.AccAddress, denom string) ( bonded sdk.Coin, unbonding sdk.Coin, unbondings []incentive.Unbonding, )
BondSummary gets the total bonded and unbonding for a given account, as well as a list of ongoing unbondings, for a single uToken denom. It ignores completed unbondings without actually clearing those unbondings in state, so it is safe for use by queries and any parts of Msg functions which are not intended to alter state.
func (Keeper) EndBlock ¶
EndBlock updates incentive programs and reward accumulators, then sets LastRewardTime to the current block time. Also protects against negative time elapsed (without causing chain halt). In addition to regular error, returns a boolean indicating whether the main logic was skipped due to a blockTime issue. These situations are accompanied by error logs.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *incentive.GenesisState
ExportGenesis returns the x/incentive module's exported genesis state.
func (Keeper) GetBonded ¶
GetBonded retrieves the amount of uTokens of a given denom which are bonded by an account
func (Keeper) GetLastRewardsTime ¶
getLastRewardsTime gets the last unix time incentive rewards were computed globally by EndBlocker. panics if it would return a negative value.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, gs incentive.GenesisState)
InitGenesis initializes the x/incentive module state from a provided genesis state.
func (Keeper) ModuleBalance ¶
ModuleBalance returns the amount of a given token held in the x/incentive module account
func (Keeper) UpdateAccount ¶
UpdateAccount finishes any unbondings associated with an account which have ended and claims any pending rewards. It returns the amount of rewards claimed.
Unlike updateRewards and updatePrograms, this function is not called during EndBlock.
REQUIREMENT: This function must be called during any message or hook which creates an unbonding or updates bonded amounts. Leverage hooks which decrease borrower collateral must also call this before acting. This ensures that between any two consecutive claims by a single account, bonded amounts were constant on that account for each collateral uToken denom.
type Querier ¶
type Querier struct {
Keeper
}
Querier implements a QueryServer for the x/incentive module.
func NewQuerier ¶
func (Querier) AccountBonds ¶
func (q Querier) AccountBonds( goCtx context.Context, req *incentive.QueryAccountBonds, ) (*incentive.QueryAccountBondsResponse, error)
func (Querier) ActualRates ¶
func (q Querier) ActualRates( goCtx context.Context, req *incentive.QueryActualRates, ) (*incentive.QueryActualRatesResponse, error)
func (Querier) CompletedIncentivePrograms ¶
func (q Querier) CompletedIncentivePrograms( goCtx context.Context, req *incentive.QueryCompletedIncentivePrograms, ) (*incentive.QueryCompletedIncentiveProgramsResponse, error)
func (Querier) CurrentRates ¶
func (q Querier) CurrentRates( goCtx context.Context, req *incentive.QueryCurrentRates, ) (*incentive.QueryCurrentRatesResponse, error)
func (Querier) IncentiveProgram ¶
func (q Querier) IncentiveProgram( goCtx context.Context, req *incentive.QueryIncentiveProgram, ) (*incentive.QueryIncentiveProgramResponse, error)
func (Querier) LastRewardTime ¶
func (q Querier) LastRewardTime( goCtx context.Context, req *incentive.QueryLastRewardTime, ) (*incentive.QueryLastRewardTimeResponse, error)
func (Querier) OngoingIncentivePrograms ¶
func (q Querier) OngoingIncentivePrograms( goCtx context.Context, req *incentive.QueryOngoingIncentivePrograms, ) (*incentive.QueryOngoingIncentiveProgramsResponse, error)
func (Querier) Params ¶
func (q Querier) Params( goCtx context.Context, req *incentive.QueryParams, ) (*incentive.QueryParamsResponse, error)
func (Querier) PendingRewards ¶
func (q Querier) PendingRewards( goCtx context.Context, req *incentive.QueryPendingRewards, ) (*incentive.QueryPendingRewardsResponse, error)
func (Querier) TotalBonded ¶
func (q Querier) TotalBonded( goCtx context.Context, req *incentive.QueryTotalBonded, ) (*incentive.QueryTotalBondedResponse, error)
func (Querier) TotalUnbonding ¶
func (q Querier) TotalUnbonding( goCtx context.Context, req *incentive.QueryTotalUnbonding, ) (*incentive.QueryTotalUnbondingResponse, error)
func (Querier) UpcomingIncentivePrograms ¶
func (q Querier) UpcomingIncentivePrograms( goCtx context.Context, req *incentive.QueryUpcomingIncentivePrograms, ) (*incentive.QueryUpcomingIncentiveProgramsResponse, error)