keeper

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: GPL-3.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

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl returns an instance of MsgServer.

Types

type Hooks

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

Hooks wrapper struct for incentives keeper.

func (Hooks) AfterEpochEnd

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

func (Hooks) BeforeEpochStart

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

epochs hooks.

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, bk types.BankKeeper, lk types.LockupKeeper, ek types.EpochKeeper, ak types.AccountKeeper) *Keeper

func (Keeper) ActiveGaugesIterator

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

ActiveGaugesIterator returns iterator for active gauges.

func (Keeper) AddToGaugeRewards

func (k Keeper) AddToGaugeRewards(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coins, gaugeID uint64) error

AddToGauge add coins to gauge.

func (Keeper) AfterEpochEnd

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

func (Keeper) BeforeEpochStart

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

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 create a gauge and send coins to the gauge.

func (Keeper) CreateGaugeRefKeys

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

CreateGaugeRefKeys adds gauge references as needed. 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 coins from gauge according to its conditions.

func (Keeper) FilteredLocksDistributionEst

func (k Keeper) FilteredLocksDistributionEst(ctx sdk.Context, gauge types.Gauge, filteredLocks []lockuptypes.PeriodLock) (types.Gauge, sdk.Coins, error)

FilteredLocksDistributionEst estimate distribution amount coins from gauge for fitting conditions Expectation: gauge is a valid gauge filteredLocks are all locks that are valid for 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 iterator for finished gauges.

func (Keeper) GaugesIterator

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

GaugesIterator returns 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

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 gauges from gauge ids reference.

func (Keeper) GetGauges

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

GetGauges returns gauges both upcoming and active.

func (Keeper) GetLastGaugeID

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

GetLastGaugeID returns ID used last time.

func (Keeper) GetLockableDurations

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

func (Keeper) GetLocksToDistribution

func (k Keeper) GetLocksToDistribution(ctx sdk.Context, distrTo lockuptypes.QueryCondition) []lockuptypes.PeriodLock

GetLocksToDistribution get locks that are associated to a condition.

func (Keeper) GetModuleDistributedCoins

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

GetModuleDistributedCoins returns sum of distributed coins so far.

func (Keeper) GetModuleToDistributeCoins

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

GetModuleToDistributeCoins returns sum of to distribute coins for all of the module.

func (Keeper) GetNotFinishedGauges

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

func (Keeper) GetParams

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

GetParams returns the total set params.

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 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 scheduled gauges.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct.

func (Keeper) Logger

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

func (Keeper) SendCoinsFromModuleToManyAccounts

func (k Keeper) SendCoinsFromModuleToManyAccounts(ctx sdk.Context, senderModule string, recipientAddrs []sdk.AccAddress, amts []sdk.Coins) error

func (Keeper) SetGaugeWithRefKey

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

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(ih types.IncentiveHooks) *Keeper

Set the incentives hooks

func (Keeper) SetLastGaugeID

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

SetLastGaugeID save ID used by last gauge.

func (Keeper) SetLockableDurations

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

func (Keeper) SetParams

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

SetParams sets the total set of params.

func (Keeper) UpcomingGaugesIterator

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

UpcomingGaugesIterator returns iterator for upcoming gauges.

func (Keeper) UpcomingGaugesIteratorAfterTime

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

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

func (Keeper) UpcomingGaugesIteratorBeforeTime

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

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

type Querier added in v1.1.0

type Querier struct {
	Keeper
}

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

func NewQuerier

func NewQuerier(k Keeper) Querier

func (Querier) ActiveGauges added in v1.1.0

ActiveGauges returns active gauges.

func (Querier) ActiveGaugesPerDenom added in v1.1.0

ActiveGaugesPerDenom returns active gauges for the specified denom.

func (Querier) GaugeByID added in v1.1.0

GaugeByID returns Gauge by id.

func (Querier) Gauges added in v1.1.0

func (q Querier) Gauges(goCtx context.Context, req *types.GaugesRequest) (*types.GaugesResponse, error)

Gauges returns gauges both upcoming and active.

func (Querier) LockableDurations added in v1.1.0

func (Querier) ModuleDistributedCoins added in v1.1.0

ModuleDistributedCoins returns coins that are distributed by module so far.

func (Querier) ModuleToDistributeCoins added in v1.1.0

ModuleToDistributeCoins returns coins that is going to be distributed.

func (Querier) RewardsEst added in v1.1.0

RewardsEst returns rewards estimation at a future specific time.

func (Querier) UpcomingGauges added in v1.1.0

UpcomingGauges returns scheduled gauges.

func (Querier) UpcomingGaugesPerDenom added in v1.1.0

Jump to

Keyboard shortcuts

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