keeper

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccountHistory added in v0.3.4

func NewAccountHistory(account string, coins sdk.Coins) *types.AccountHistory

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl returns an instance of MsgServer for the provided keeper.

func UnmarshalRefArray

func UnmarshalRefArray(bz []byte) []uint64

Types

type Distributor

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

func NewDistributor

func NewDistributor(keeper DistributorKeeper) Distributor

func (Distributor) Distribute

func (d Distributor) Distribute(
	ctx sdk.Context,
	gauge *types.Gauge,
	filterStakes types.Stakes,
) (types.DistributionSpec, error)

type DistributorKeeper

type DistributorKeeper interface {
	ValueForShares(ctx sdk.Context, coin sdk.Coin, tick int64) (sdk.Int, error)
	GetStakesByQueryCondition(ctx sdk.Context, distrTo *types.QueryCondition) types.Stakes
}

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

func NewKeeper(
	storeKey storetypes.StoreKey,
	paramSpace paramtypes.Subspace,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	ek types.EpochKeeper,
	dk types.DexKeeper,
	authority string,
) *Keeper

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

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 types.QueryCondition,
	startTime time.Time,
	numEpochsPaidOver uint64,
	pricingTick int64,
) (*types.Gauge, error)

CreateGauge creates a gauge and sends coins to the gauge.

func (Keeper) CreateStake

func (k Keeper) CreateStake(
	ctx sdk.Context,
	owner sdk.AccAddress,
	coins sdk.Coins,
	startTime time.Time,
	startDistEpoch int64,
) (*types.Stake, error)

func (Keeper) Distribute

func (k Keeper) Distribute(ctx sdk.Context, gauges types.Gauges) (types.DistributionSpec, error)

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

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the x/incentives module's exported genesis.

func (Keeper) GetAccountHistory added in v0.3.4

func (k Keeper) GetAccountHistory(
	ctx sdk.Context,
	account string,
) (val *types.AccountHistory, found bool)

GetAccountHistory returns a goodTilRecord from its index

func (Keeper) GetActiveGauges

func (k Keeper) GetActiveGauges(ctx sdk.Context) types.Gauges

GetActiveGauges returns active gauges.

func (Keeper) GetAllAccountHistory added in v0.3.4

func (k Keeper) GetAllAccountHistory(ctx sdk.Context) (list []*types.AccountHistory)

GetAllAccountHistory returns all goodTilRecord

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.Gauges

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) GetGaugeQualifyingValue added in v0.3.4

func (k Keeper) GetGaugeQualifyingValue(ctx sdk.Context, gaugeID uint64) (uint64, error)

GetGaugeQualifyingValue returns gauge qualifying value from gauge ID.

func (Keeper) GetGauges

func (k Keeper) GetGauges(ctx sdk.Context) types.Gauges

GetGauges returns upcoming, active, and finished gauges.

func (Keeper) GetGaugesByPair

func (k Keeper) GetGaugesByPair(ctx sdk.Context, pair *dextypes.PairID) []*types.Gauge

func (Keeper) GetLastGaugeID

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

GetLastGaugeID returns the last used gauge ID.

func (Keeper) GetLastStakeID

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

GetLastStakeID returns ID used last time.

func (Keeper) GetModuleBalance

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

GetModuleBalance returns full balance of the module.

func (Keeper) GetModuleCoinsToBeDistributed

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

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

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

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

GetModuleStakedCoins Returns staked balance of the module.

func (Keeper) GetNotFinishedGauges

func (k Keeper) GetNotFinishedGauges(ctx sdk.Context) types.Gauges

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

func (k Keeper) GetRewardsEstimate(
	ctx sdk.Context,
	addr sdk.AccAddress,
	filterStakes types.Stakes,
	numEpochs int64,
) (sdk.Coins, error)

GetRewardsEstimate returns rewards estimation at a future specific time (by epoch) If stakes are nil, it returns the rewards between now and the end epoch associated with address. If stakes are not nil, it returns all the rewards for the given stakes between now and end epoch.

func (Keeper) GetStakeByID

func (k Keeper) GetStakeByID(ctx sdk.Context, stakeID uint64) (*types.Stake, error)

GetStakeByID Returns stake from stakeID.

func (Keeper) GetStakes

func (k Keeper) GetStakes(ctx sdk.Context) types.Stakes

func (Keeper) GetStakesByAccount

func (k Keeper) GetStakesByAccount(ctx sdk.Context, addr sdk.AccAddress) types.Stakes

GetAccountStakes Returns the period locks associated to an account.

func (Keeper) GetStakesByQueryCondition

func (k Keeper) GetStakesByQueryCondition(
	ctx sdk.Context,
	distrTo *types.QueryCondition,
) types.Stakes

GetAccountStakes Returns the period locks associated to an account.

func (Keeper) GetUpcomingGauges

func (k Keeper) GetUpcomingGauges(ctx sdk.Context) types.Gauges

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

func (k Keeper) InitializeAllGauges(ctx sdk.Context, gauges types.Gauges) error

InitializeAllGauges takes a set of gauges, and initializes state to be storing them all correctly.

func (Keeper) InitializeAllStakes

func (k Keeper) InitializeAllStakes(ctx sdk.Context, stakes types.Stakes) error

InitializeAllStakes takes a set of stakes, and initializes state to be storing them all correctly.

func (Keeper) Logger

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

Logger returns a logger instance for the incentives module.

func (Keeper) RemoveAccountHistory added in v0.3.4

func (k Keeper) RemoveAccountHistory(
	ctx sdk.Context,
	account string,
)

RemoveAccountHistory removes a goodTilRecord from the store

func (Keeper) SetAccountHistory added in v0.3.4

func (k Keeper) SetAccountHistory(
	ctx sdk.Context,
	accountHistory *types.AccountHistory,
) error

SetAccountHistory set a specific goodTilRecord in the store from its index

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

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

SetLastStakeID save ID used by last stake.

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

func (k Keeper) Unstake(ctx sdk.Context, stake *types.Stake, coins sdk.Coins) (uint64, error)

func (Keeper) ValueForShares

func (k Keeper) ValueForShares(ctx sdk.Context, coin sdk.Coin, tick int64) (sdk.Int, error)

type QueryServer

type QueryServer struct {
	*Keeper
}

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

func NewQueryServer

func NewQueryServer(k *Keeper) QueryServer

NewQueryServer creates a new QueryServer struct.

func (QueryServer) GetAccountHistory added in v0.3.4

func (QueryServer) GetGaugeByID

func (QueryServer) GetGaugeQualifyingValue added in v0.3.4

func (QueryServer) GetGauges

func (QueryServer) GetModuleStatus

func (QueryServer) GetStakeByID

func (QueryServer) GetStakes

Jump to

Keyboard shortcuts

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