keeper

package
v0.1.0-merlin.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

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

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

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

func (h Hooks) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

AfterEpochEnd is the epoch end hook.

func (Hooks) BeforeEpochStart

func (h Hooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

BeforeEpochStart is the epoch start hook.

type Keeper

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

Keeper provides a way to manage incentives module storage.

func NewKeeper

NewKeeper returns a new instance of the incentive module keeper struct.

func (Keeper) ActiveGaugesIterator

func (k Keeper) ActiveGaugesIterator(ctx sdk.Context) sdk.Iterator

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

func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

AfterEpochEnd is the epoch end hook.

func (Keeper) BeforeEpochStart

func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

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) (uint64, error)

CreateGauge creates a gauge and sends coins to the gauge.

func (Keeper) CreateGaugeRefKeys

func (k Keeper) CreateGaugeRefKeys(ctx sdk.Context, gauge *types.Gauge, combinedKeys []byte, activeOrUpcomingGauge bool) error

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

func (k Keeper) Distribute(ctx sdk.Context, gauges []types.Gauge) (sdk.Coins, error)

Distribute distributes coins from an array of gauges to all eligible locks.

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

func (k Keeper) FinishedGaugesIterator(ctx sdk.Context) sdk.Iterator

FinishedGaugesIterator returns the iterator for all finished gauges.

func (Keeper) GaugesIterator

func (k Keeper) GaugesIterator(ctx sdk.Context) sdk.Iterator

GaugesIterator returns the iterator for all gauges.

func (Keeper) GetActiveGauges

func (k Keeper) GetActiveGauges(ctx sdk.Context) []types.Gauge

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

func (k Keeper) GetFinishedGauges(ctx sdk.Context) []types.Gauge

GetFinishedGauges returns finished gauges.

func (Keeper) GetGaugeByID

func (k Keeper) GetGaugeByID(ctx sdk.Context, gaugeID uint64) (*types.Gauge, error)

GetGaugeByID returns gauge from gauge ID.

func (Keeper) GetGaugeFromIDs

func (k Keeper) GetGaugeFromIDs(ctx sdk.Context, gaugeIDs []uint64) ([]types.Gauge, error)

GetGaugeFromIDs returns multiple gauges from a gaugeIDs array.

func (Keeper) GetGauges

func (k Keeper) GetGauges(ctx sdk.Context) []types.Gauge

GetGauges returns upcoming, active, and finished gauges.

func (Keeper) GetLastGaugeID

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

GetLastGaugeID returns the last used gauge ID.

func (Keeper) GetLockableDurations

func (k Keeper) GetLockableDurations(ctx sdk.Context) []time.Duration

GetLockableDurations returns all incentivized lockable durations.

func (Keeper) GetModuleDistributedCoins

func (k Keeper) GetModuleDistributedCoins(ctx sdk.Context) sdk.Coins

GetModuleDistributedCoins returns sum of coins that have been distributed so far for all of the module.

func (Keeper) GetModuleToDistributeCoins

func (k Keeper) GetModuleToDistributeCoins(ctx sdk.Context) sdk.Coins

GetModuleToDistributeCoins returns sum of coins yet to be distributed for all of the module.

func (Keeper) GetNotFinishedGauges

func (k Keeper) GetNotFinishedGauges(ctx sdk.Context) []types.Gauge

GetNotFinishedGauges returns both upcoming and active gauges.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns all of the parameters in the incentive module.

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

func (k Keeper) GetUpcomingGauges(ctx sdk.Context) []types.Gauge

GetUpcomingGauges returns upcoming gauges.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Hooks returns the hook wrapper struct.

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) Logger

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

Logger returns a logger instance for the incentives module.

func (Keeper) SetGaugeWithRefKey

func (k Keeper) SetGaugeWithRefKey(ctx sdk.Context, gauge *types.Gauge) error

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

func (k Keeper) SetLastGaugeID(ctx sdk.Context, ID uint64)

SetLastGaugeID sets the last used gauge ID to the provided ID.

func (Keeper) SetLockableDurations

func (k Keeper) SetLockableDurations(ctx sdk.Context, lockableDurations []time.Duration)

SetLockableDurations sets which lockable durations will be incentivized.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets all of the parameters in the incentive module.

func (Keeper) UpcomingGaugesIterator

func (k Keeper) UpcomingGaugesIterator(ctx sdk.Context) sdk.Iterator

UpcomingGaugesIterator returns the iterator for all upcoming gauges.

func (Keeper) UpcomingGaugesIteratorAfterTime

func (k Keeper) UpcomingGaugesIteratorAfterTime(ctx sdk.Context, time time.Time) sdk.Iterator

UpcomingGaugesIteratorAfterTime returns the iterator to get all upcoming gauges that start distribution after a specific time.

func (Keeper) UpcomingGaugesIteratorBeforeTime

func (k Keeper) UpcomingGaugesIteratorBeforeTime(ctx sdk.Context, time time.Time) sdk.Iterator

UpcomingGaugesIteratorBeforeTime returns the iterator to get all upcoming gauges that have already started distribution before a specific time.

type Querier

type Querier struct {
	Keeper
}

Querier defines a wrapper around the incentives module keeper providing gRPC method handlers.

func NewQuerier

func NewQuerier(k Keeper) Querier

NewQuerier creates a new Querier struct.

func (Querier) ActiveGauges

ActiveGauges returns all active gauges.

func (Querier) ActiveGaugesPerDenom

ActiveGaugesPerDenom returns all active gauges for the specified denom.

func (Querier) GaugeByID

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

LockableDurations returns all of the allowed lockable durations on chain.

func (Querier) ModuleToDistributeCoins

ModuleToDistributeCoins returns coins that are going to be distributed.

func (Querier) RewardsEst

RewardsEst returns rewards estimation at a future specific time (by epoch).

func (Querier) UpcomingGauges

UpcomingGauges returns all upcoming gauges.

func (Querier) UpcomingGaugesPerDenom

UpcomingGaugesPerDenom returns all upcoming gauges for the specified denom.

Jump to

Keyboard shortcuts

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