Documentation ¶
Index ¶
- func FilterLocksByMinDuration(locks []lockuptypes.PeriodLock, minDuration time.Duration) []lockuptypes.PeriodLock
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- type Hooks
- type Keeper
- func (k Keeper) ActiveGaugesIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) AddToGaugeRewards(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, gaugeID uint64) error
- func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error
- func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error
- func (k Keeper) CreateGauge(ctx sdk.Context, isPerpetual bool, owner sdk.AccAddress, coins sdk.Coins, ...) (uint64, error)
- func (k Keeper) CreateGaugeRefKeys(ctx sdk.Context, gauge *types.Gauge, combinedKeys []byte) error
- func (k Keeper) Distribute(ctx sdk.Context, gauges []types.Gauge) (sdk.Coins, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) FilteredLocksDistributionEst(ctx sdk.Context, gauge types.Gauge, filteredLocks []lockuptypes.PeriodLock) (types.Gauge, sdk.Coins, bool, error)
- func (k Keeper) FinishedGaugesIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GaugesIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetActiveGauges(ctx sdk.Context) []types.Gauge
- func (k Keeper) GetEpochInfo(ctx sdk.Context) epochtypes.EpochInfo
- func (k Keeper) GetFinishedGauges(ctx sdk.Context) []types.Gauge
- func (k Keeper) GetGaugeByID(ctx sdk.Context, gaugeID uint64) (*types.Gauge, error)
- func (k Keeper) GetGaugeFromIDs(ctx sdk.Context, gaugeIDs []uint64) ([]types.Gauge, error)
- func (k Keeper) GetGauges(ctx sdk.Context) []types.Gauge
- func (k Keeper) GetLastGaugeID(ctx sdk.Context) uint64
- func (k Keeper) GetLockableDurations(ctx sdk.Context) []time.Duration
- func (k Keeper) GetModuleDistributedCoins(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetModuleToDistributeCoins(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetNotFinishedGauges(ctx sdk.Context) []types.Gauge
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPoolFromGaugeId(ctx sdk.Context, gaugeId uint64, duration time.Duration) (poolmanagertypes.PoolI, error)
- func (k Keeper) GetRewardsEst(ctx sdk.Context, addr sdk.AccAddress, locks []lockuptypes.PeriodLock, ...) sdk.Coins
- func (k Keeper) GetUpcomingGauges(ctx sdk.Context) []types.Gauge
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) SetGaugeWithRefKey(ctx sdk.Context, gauge *types.Gauge) error
- func (k *Keeper) SetHooks(ih types.IncentiveHooks) *Keeper
- func (k Keeper) SetLastGaugeID(ctx sdk.Context, ID uint64)
- func (k Keeper) SetLockableDurations(ctx sdk.Context, lockableDurations []time.Duration)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k *Keeper) SetPoolIncentivesKeeper(poolIncentiveKeeper types.PoolIncentiveKeeper)
- func (k Keeper) UpcomingGaugesIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) UpcomingGaugesIteratorAfterTime(ctx sdk.Context, time time.Time) sdk.Iterator
- func (k Keeper) UpcomingGaugesIteratorBeforeTime(ctx sdk.Context, time time.Time) sdk.Iterator
- type Querier
- func (q Querier) ActiveGauges(goCtx context.Context, req *types.ActiveGaugesRequest) (*types.ActiveGaugesResponse, error)
- func (q Querier) ActiveGaugesPerDenom(goCtx context.Context, req *types.ActiveGaugesPerDenomRequest) (*types.ActiveGaugesPerDenomResponse, error)
- func (q Querier) GaugeByID(goCtx context.Context, req *types.GaugeByIDRequest) (*types.GaugeByIDResponse, error)
- func (q Querier) Gauges(goCtx context.Context, req *types.GaugesRequest) (*types.GaugesResponse, error)
- func (q Querier) LockableDurations(ctx context.Context, _ *types.QueryLockableDurationsRequest) (*types.QueryLockableDurationsResponse, error)
- func (q Querier) ModuleToDistributeCoins(goCtx context.Context, _ *types.ModuleToDistributeCoinsRequest) (*types.ModuleToDistributeCoinsResponse, error)
- func (q Querier) RewardsEst(goCtx context.Context, req *types.RewardsEstRequest) (*types.RewardsEstResponse, error)
- func (q Querier) UpcomingGauges(goCtx context.Context, req *types.UpcomingGaugesRequest) (*types.UpcomingGaugesResponse, error)
- func (q Querier) UpcomingGaugesPerDenom(goCtx context.Context, req *types.UpcomingGaugesPerDenomRequest) (*types.UpcomingGaugesPerDenomResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterLocksByMinDuration ¶
func FilterLocksByMinDuration(locks []lockuptypes.PeriodLock, minDuration time.Duration) []lockuptypes.PeriodLock
FilterLocksByMinDuration returns locks whose lock duration is greater than the provided minimum duration.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an instance of MsgServer for the provided keeper.
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks is the wrapper struct for the incentives keeper.
func (Hooks) AfterEpochEnd ¶
AfterEpochEnd is the epoch end hook.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper provides a way to manage incentives module storage.
func NewKeeper ¶
func NewKeeper(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, ak types.AccountKeeper, bk types.BankKeeper, lk types.LockupKeeper, ek types.EpochKeeper, ck types.CommunityPoolKeeper, txfk types.TxFeesKeeper, clk types.ConcentratedLiquidityKeeper, pmk types.PoolManagerKeeper, pik types.PoolIncentiveKeeper) *Keeper
NewKeeper returns a new instance of the incentive module keeper struct.
func (Keeper) ActiveGaugesIterator ¶
ActiveGaugesIterator returns the iterator for all active gauges.
func (Keeper) AddToGaugeRewards ¶
func (k Keeper) AddToGaugeRewards(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, gaugeID uint64) error
AddToGaugeRewards adds coins to gauge.
func (Keeper) AfterEpochEnd ¶
AfterEpochEnd is the epoch end hook.
func (Keeper) BeforeEpochStart ¶
BeforeEpochStart is the epoch start hook.
func (Keeper) CreateGauge ¶
func (k Keeper) CreateGauge(ctx sdk.Context, isPerpetual bool, owner sdk.AccAddress, coins sdk.Coins, distrTo lockuptypes.QueryCondition, startTime time.Time, numEpochsPaidOver uint64, poolId uint64) (uint64, error)
CreateGauge creates a gauge with the given parameters and sends coins to the gauge. There can be 2 kinds of gauges for a given set of parameters: * lockuptypes.ByDuration - a gauge that incentivizes one of the lockable durations. For this gauge, the pool id must be 0. Fails if not.
* lockuptypes.NoLock - a gauge that incentivizes pools without locking. Initially, this is meant specifically for the concentrated liquidity pools. As a result, if NoLock gauge is being created, the given pool id must be non-zero, the pool at this id must exist and be of a concentrated liquidity type. Fails if not. Additionally, lockuptypes.Denom must be either an empty string, signifying that this is an external gauge, or be equal to types.NoLockInternalGaugeDenom(poolId). If the denom is empty, it will get overwritten to types.NoLockExternalGaugeDenom(poolId). This denom formatting is useful for querying internal vs external gauges associated with a pool.
func (Keeper) CreateGaugeRefKeys ¶
CreateGaugeRefKeys takes combinedKey (the keyPrefix for upcoming, active, or finished gauges combined with gauge start time) and adds a reference to the respective gauge ID. If gauge is active or upcoming, creates reference between the denom and gauge ID. Used to consolidate codepaths for InitGenesis and CreateGauge.
func (Keeper) Distribute ¶
Distribute distributes coins from an array of gauges to all eligible locks and pools in the case of "NoLock" gauges. CONTRACT: gauges must be active.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the x/incentives module's exported genesis.
func (Keeper) FilteredLocksDistributionEst ¶
func (k Keeper) FilteredLocksDistributionEst(ctx sdk.Context, gauge types.Gauge, filteredLocks []lockuptypes.PeriodLock) (types.Gauge, sdk.Coins, bool, error)
FilteredLocksDistributionEst estimates distribution amount of coins from gauge. It also applies an update for the gauge, handling the sending of the rewards. (Note this update is in-memory, it does not change state.)
func (Keeper) FinishedGaugesIterator ¶
FinishedGaugesIterator returns the iterator for all finished gauges.
func (Keeper) GaugesIterator ¶
GaugesIterator returns the iterator for all gauges.
func (Keeper) GetActiveGauges ¶
GetActiveGauges returns active gauges.
func (Keeper) GetEpochInfo ¶
func (k Keeper) GetEpochInfo(ctx sdk.Context) epochtypes.EpochInfo
GetEpochInfo returns EpochInfo struct given context.
func (Keeper) GetFinishedGauges ¶
GetFinishedGauges returns finished gauges.
func (Keeper) GetGaugeByID ¶
GetGaugeByID returns gauge from gauge ID.
func (Keeper) GetGaugeFromIDs ¶
GetGaugeFromIDs returns multiple gauges from a gaugeIDs array.
func (Keeper) GetLastGaugeID ¶
GetLastGaugeID returns the last used gauge ID.
func (Keeper) GetLockableDurations ¶
GetLockableDurations returns all incentivized lockable durations.
func (Keeper) GetModuleDistributedCoins ¶
GetModuleDistributedCoins returns sum of coins that have been distributed so far for all of the module.
func (Keeper) GetModuleToDistributeCoins ¶
GetModuleToDistributeCoins returns sum of coins yet to be distributed for all of the module.
func (Keeper) GetNotFinishedGauges ¶
GetNotFinishedGauges returns both upcoming and active gauges.
func (Keeper) GetPoolFromGaugeId ¶
func (k Keeper) GetPoolFromGaugeId(ctx sdk.Context, gaugeId uint64, duration time.Duration) (poolmanagertypes.PoolI, error)
GetPoolFromGaugeId returns a pool associated with the given gauge id. Returns error if there is no link between pool id and gauge id. Returns error if pool is not saved in state.
func (Keeper) GetRewardsEst ¶
func (k Keeper) GetRewardsEst(ctx sdk.Context, addr sdk.AccAddress, locks []lockuptypes.PeriodLock, endEpoch int64) sdk.Coins
GetRewardsEst returns rewards estimation at a future specific time (by epoch) If locks are nil, it returns the rewards between now and the end epoch associated with address. If locks are not nil, it returns all the rewards for the given locks between now and end epoch.
func (Keeper) GetUpcomingGauges ¶
GetUpcomingGauges returns upcoming gauges.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
InitGenesis initializes the incentives module's state from a provided genesis state.
func (Keeper) SetGaugeWithRefKey ¶
SetGaugeWithRefKey takes a single gauge and assigns a key. Takes combinedKey (the keyPrefix for upcoming, active, or finished gauges combined with gauge start time) and adds a reference to the respective gauge ID. If this gauge is active or upcoming, creates reference between the denom and gauge ID.
func (*Keeper) SetHooks ¶
func (k *Keeper) SetHooks(ih types.IncentiveHooks) *Keeper
SetHooks sets the incentives hooks.
func (Keeper) SetLastGaugeID ¶
SetLastGaugeID sets the last used gauge ID to the provided ID.
func (Keeper) SetLockableDurations ¶
SetLockableDurations sets which lockable durations will be incentivized.
func (*Keeper) SetPoolIncentivesKeeper ¶
func (k *Keeper) SetPoolIncentivesKeeper(poolIncentiveKeeper types.PoolIncentiveKeeper)
SetPoolIncentivesKeeper sets pool incentives keeper
func (Keeper) UpcomingGaugesIterator ¶
UpcomingGaugesIterator returns the iterator for all upcoming gauges.
func (Keeper) UpcomingGaugesIteratorAfterTime ¶
UpcomingGaugesIteratorAfterTime returns the iterator to get all upcoming gauges that start distribution after a specific time.
type Querier ¶
type Querier struct {
Keeper
}
Querier defines a wrapper around the incentives module keeper providing gRPC method handlers.
func (Querier) ActiveGauges ¶
func (q Querier) ActiveGauges(goCtx context.Context, req *types.ActiveGaugesRequest) (*types.ActiveGaugesResponse, error)
ActiveGauges returns all active gauges.
func (Querier) ActiveGaugesPerDenom ¶
func (q Querier) ActiveGaugesPerDenom(goCtx context.Context, req *types.ActiveGaugesPerDenomRequest) (*types.ActiveGaugesPerDenomResponse, error)
ActiveGaugesPerDenom returns all active gauges for the specified denom.
func (Querier) GaugeByID ¶
func (q Querier) GaugeByID(goCtx context.Context, req *types.GaugeByIDRequest) (*types.GaugeByIDResponse, error)
GaugeByID takes a gaugeID and returns its respective gauge.
func (Querier) Gauges ¶
func (q Querier) Gauges(goCtx context.Context, req *types.GaugesRequest) (*types.GaugesResponse, error)
Gauges returns all upcoming and active gauges.
func (Querier) LockableDurations ¶
func (q Querier) LockableDurations(ctx context.Context, _ *types.QueryLockableDurationsRequest) (*types.QueryLockableDurationsResponse, error)
LockableDurations returns all of the allowed lockable durations on chain.
func (Querier) ModuleToDistributeCoins ¶
func (q Querier) ModuleToDistributeCoins(goCtx context.Context, _ *types.ModuleToDistributeCoinsRequest) (*types.ModuleToDistributeCoinsResponse, error)
ModuleToDistributeCoins returns coins that are going to be distributed.
func (Querier) RewardsEst ¶
func (q Querier) RewardsEst(goCtx context.Context, req *types.RewardsEstRequest) (*types.RewardsEstResponse, error)
RewardsEst returns rewards estimation at a future specific time (by epoch).
func (Querier) UpcomingGauges ¶
func (q Querier) UpcomingGauges(goCtx context.Context, req *types.UpcomingGaugesRequest) (*types.UpcomingGaugesResponse, error)
UpcomingGauges returns all upcoming gauges.
func (Querier) UpcomingGaugesPerDenom ¶
func (q Querier) UpcomingGaugesPerDenom(goCtx context.Context, req *types.UpcomingGaugesPerDenomRequest) (*types.UpcomingGaugesPerDenomResponse, error)
UpcomingGaugesPerDenom returns all upcoming gauges for the specified denom.