keeper

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const StoreKey = types.ModuleName

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the account MsgServer interface for the provided Keeper.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	key storetypes.StoreKey,
	stakingKeeper types.StakingKeeper,
	govKeeper *govkeeper.Keeper,
	bankKeeper bankkeeper.Keeper,
	authKeeper authkeeper.AccountKeeper,
) Keeper

func (Keeper) CalculateParticipantReward

func (k Keeper) CalculateParticipantReward(ctx sdk.Context, shares int64, totalShares int64, claimRewardPool sdk.Coin, maxReward sdk.Coin) sdk.Coin

CalculateParticipantReward for each address/participant

func (Keeper) CalculateRewardClaimPeriodRewards

func (k Keeper) CalculateRewardClaimPeriodRewards(ctx sdk.Context, maxReward sdk.Coin, claimPeriodReward types.ClaimPeriodRewardDistribution) (sum sdk.Coin, err error)

CalculateRewardClaimPeriodRewards calculate reward accrued for a claim period for each participant.

func (Keeper) ClaimAllRewards

func (k Keeper) ClaimAllRewards(ctx sdk.Context, addr string) ([]*types.RewardProgramClaimDetail, sdk.Coins, error)

ClaimAllRewards calls ClaimRewards, however differs from ClaimRewards in that it claims all the rewards that the address is eligible for across all reward programs.

func (Keeper) ClaimPeriodRewardDistributions

ClaimPeriodRewardDistributions returns a list of claim period reward distributions matching the claim_status.

func (Keeper) ClaimPeriodRewardDistributionsByID

ClaimPeriodRewardDistributionsByID returns a claim period reward distribution matching the ID.

func (Keeper) ClaimRewards

func (k Keeper) ClaimRewards(ctx sdk.Context, rewardProgramID uint64, addr string) ([]*types.ClaimedRewardPeriodDetail, sdk.Coin, error)

ClaimRewards for a given address and a given reward program id

func (Keeper) CreateRewardProgram

func (k Keeper) CreateRewardProgram(ctx sdk.Context, rewardProgram types.RewardProgram) (err error)

CreateRewardProgram with the rewards creator funding the creation of the program.

func (Keeper) DetectQualifyingActions

func (k Keeper) DetectQualifyingActions(ctx sdk.Context, program *types.RewardProgram) ([]types.EvaluationResult, error)

DetectQualifyingActions takes in the RewardProgram and checks if any of the qualifying actions is found in the event history

func (Keeper) EndRewardProgram

func (k Keeper) EndRewardProgram(ctx sdk.Context, rewardProgram *types.RewardProgram) error

EndRewardProgram ActualProgramEndTime is updated and program ENDED

func (Keeper) EndRewardProgramClaimPeriod

func (k Keeper) EndRewardProgramClaimPeriod(ctx sdk.Context, rewardProgram *types.RewardProgram) error

EndRewardProgramClaimPeriod end the claim period of a given reward program.

func (Keeper) EndingRewardProgram

func (k Keeper) EndingRewardProgram(ctx sdk.Context, rewardProgram types.RewardProgram)

EndingRewardProgram end reward program preemptively, can only be done by reward program creator.

func (Keeper) ExpireRewardClaimsForRewardProgram

func (k Keeper) ExpireRewardClaimsForRewardProgram(ctx sdk.Context, rewardProgramID uint64) error

Changes the state for all account states in a reward program to be expired if they are not claimed

func (Keeper) ExpireRewardProgram

func (k Keeper) ExpireRewardProgram(ctx sdk.Context, rewardProgram *types.RewardProgram) error

ExpireRewardProgram return unclaimed rewards to reward creator, and expire the reward program.

func (Keeper) ExportGenesis

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

ExportGenesis returns a GenesisState for a given context.

func (Keeper) FindQualifyingActions

func (k Keeper) FindQualifyingActions(ctx sdk.Context, action types.RewardAction) ([]types.EvaluationResult, error)

FindQualifyingActions iterates event history and applies the RewardAction to them, adds them to the result if they qualify.

func (Keeper) GetAccountKeeper

func (k Keeper) GetAccountKeeper() types.AccountKeeper

GetAccountKeeper gets this Keeper's AccountKeeper.

func (Keeper) GetAllActiveRewardPrograms

func (k Keeper) GetAllActiveRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)

GetAllActiveRewardPrograms gets all RewardPrograms that have started

func (Keeper) GetAllClaimPeriodRewardDistributions

func (k Keeper) GetAllClaimPeriodRewardDistributions(sdkCtx sdk.Context) ([]types.ClaimPeriodRewardDistribution, error)

GetAllClaimPeriodRewardDistributions Gets all the Epoch Reward Distributions

func (Keeper) GetAllCompletedRewardPrograms

func (k Keeper) GetAllCompletedRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)

GetAllCompletedRewardPrograms gets all completed the RewardPrograms

func (Keeper) GetAllExpiredRewardPrograms

func (k Keeper) GetAllExpiredRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)

GetAllExpiredRewardPrograms gets all expired RewardPrograms

func (Keeper) GetAllOutstandingRewardPrograms

func (k Keeper) GetAllOutstandingRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)

GetAllOutstandingRewardPrograms Gets all RewardPrograms that have not expired

func (Keeper) GetAllPendingRewardPrograms

func (k Keeper) GetAllPendingRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)

GetAllPendingRewardPrograms gets all pending the RewardPrograms

func (Keeper) GetAllRewardPrograms

func (k Keeper) GetAllRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)

GetAllRewardPrograms Gets all the RewardPrograms

func (Keeper) GetAllUnexpiredRewardPrograms

func (k Keeper) GetAllUnexpiredRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)

GetAllUnexpiredRewardPrograms gets all RewardPrograms that are not expired

func (Keeper) GetClaimPeriodRewardDistribution

func (k Keeper) GetClaimPeriodRewardDistribution(ctx sdk.Context, claimPeriodID uint64, rewardID uint64) (claimPeriodRewardDistribution types.ClaimPeriodRewardDistribution, err error)

GetClaimPeriodRewardDistribution returns a ClaimPeriodRewardDistribution by epoch id and reward id

func (Keeper) GetNextRewardProgramID

func (k Keeper) GetNextRewardProgramID(ctx sdk.Context) (rewardProgramID uint64, err error)

GetNextRewardProgramID returns the next available reward program ID and increments keeper with next reward program ID

func (Keeper) GetRewardAccountState

func (k Keeper) GetRewardAccountState(ctx sdk.Context, rewardProgramID, rewardClaimPeriodID uint64, addr string) (state types.RewardAccountState, err error)

GetRewardAccountState gets a RewardAccountState. If the desired RewardAccountState doesn't exist, an empty RewardAccountState is returned (without error).

func (Keeper) GetRewardAccountStatesForClaimPeriod

func (k Keeper) GetRewardAccountStatesForClaimPeriod(ctx sdk.Context, rewardProgramID, claimPeriodID uint64) ([]types.RewardAccountState, error)

Returns a list of account states for the reward program's claim period

func (Keeper) GetRewardAccountStatesForRewardProgram

func (k Keeper) GetRewardAccountStatesForRewardProgram(ctx sdk.Context, rewardProgramID uint64) ([]types.RewardAccountState, error)

Returns a list of account states for the reward program

func (Keeper) GetRewardProgram

func (k Keeper) GetRewardProgram(ctx sdk.Context, id uint64) (rewardProgram types.RewardProgram, err error)

GetRewardProgram returns a RewardProgram by id

func (Keeper) GetRewardProgramID

func (k Keeper) GetRewardProgramID(ctx sdk.Context) (rewardprogramID uint64, err error)

GetRewardProgramID gets the highest rewardprogram ID

func (Keeper) GetStakingKeeper

func (k Keeper) GetStakingKeeper() types.StakingKeeper

GetStakingKeeper gets this Keeper's StakingKeeper.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState)

InitGenesis new reward genesis

func (Keeper) IterateABCIEvents

func (k Keeper) IterateABCIEvents(ctx sdk.Context, criteria *types.EventCriteria, action func(string, *map[string][]byte) error) error

IterateABCIEvents Iterates through all the ABCIEvents that match the eventCriteria. Nil criteria means to iterate over everything.

func (Keeper) IterateAllRewardAccountStates

func (k Keeper) IterateAllRewardAccountStates(ctx sdk.Context, handle func(state types.RewardAccountState) (stop bool)) error

IterateAllRewardAccountStates Iterates over the account states for every reward program

func (Keeper) IterateClaimPeriodRewardDistributions

func (k Keeper) IterateClaimPeriodRewardDistributions(ctx sdk.Context, handle func(ClaimPeriodRewardDistribution types.ClaimPeriodRewardDistribution) (stop bool)) error

IterateClaimPeriodRewardDistributions iterates all epoch reward distributions with the given handler function.

func (Keeper) IterateRewardAccountStates

func (k Keeper) IterateRewardAccountStates(ctx sdk.Context, rewardProgramID, rewardClaimPeriodID uint64, handle func(state types.RewardAccountState) (stop bool)) error

IterateRewardAccountStates Iterates over the account states for a reward program's claim period

func (Keeper) IterateRewardAccountStatesByAddress

func (k Keeper) IterateRewardAccountStatesByAddress(ctx sdk.Context, addr sdk.AccAddress, handle func(state types.RewardAccountState) (stop bool)) error

IterateRewardAccountStatesByAddress Iterates over the account states by address iterator

func (Keeper) IterateRewardAccountStatesByAddressAndRewardsID

func (k Keeper) IterateRewardAccountStatesByAddressAndRewardsID(ctx sdk.Context, addr sdk.AccAddress, rewardsID uint64, handle func(state types.RewardAccountState) (stop bool)) error

IterateRewardAccountStatesByAddressAndRewardsID Iterates over the account states by address iterator and reward id

func (Keeper) IterateRewardAccountStatesByLookUpIndex

func (k Keeper) IterateRewardAccountStatesByLookUpIndex(ctx sdk.Context, addr sdk.AccAddress, iterator sdk.Iterator, handle func(state types.RewardAccountState) (stop bool)) error

IterateRewardAccountStatesByLookUpIndex iterates reward account states by secondary index // [0x8] :: [addr-bytes::reward program id bytes]::[claim period id bytes] {}

func (Keeper) IterateRewardAccountStatesForRewardProgram

func (k Keeper) IterateRewardAccountStatesForRewardProgram(ctx sdk.Context, rewardProgramID uint64, handle func(state types.RewardAccountState) (stop bool)) error

IterateRewardAccountStatesForRewardProgram Iterates over the account states for a reward program

func (Keeper) IterateRewardPrograms

func (k Keeper) IterateRewardPrograms(ctx sdk.Context, handle func(rewardProgram types.RewardProgram) (stop bool, err error)) error

IterateRewardPrograms iterates all reward programs with the given handler function.

func (Keeper) MakeRewardClaimsClaimableForPeriod

func (k Keeper) MakeRewardClaimsClaimableForPeriod(ctx sdk.Context, rewardProgramID, claimPeriodID uint64) error

Changes the state for all account states in a reward program's claim period to be claimable

func (Keeper) ProcessQualifyingActions

func (k Keeper) ProcessQualifyingActions(ctx sdk.Context, program *types.RewardProgram, processor types.RewardAction, actions []types.EvaluationResult) []types.EvaluationResult

ProcessQualifyingActions process the detected qualifying actions.

func (Keeper) ProcessTransactions

func (k Keeper) ProcessTransactions(ctx sdk.Context)

ProcessTransactions in the endblock

func (Keeper) RefundRemainingBalance

func (k Keeper) RefundRemainingBalance(ctx sdk.Context, rewardProgram *types.RewardProgram) error

RefundRemainingBalance returns the remaining pool balance to the reward program creator

func (Keeper) RefundRewardClaims

func (k Keeper) RefundRewardClaims(ctx sdk.Context, rewardProgram types.RewardProgram) error

RefundRewardClaims refund all unclaimed rewards to the reward program creator

func (Keeper) RemoveClaimPeriodRewardDistribution

func (k Keeper) RemoveClaimPeriodRewardDistribution(ctx sdk.Context, claimPeriodID uint64, rewardID uint64) bool

RemoveClaimPeriodRewardDistribution Removes an ClaimPeriodRewardDistribution

func (Keeper) RemoveRewardProgram

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

RemoveRewardProgram Removes a reward program in the keeper

func (Keeper) RewardDistributionsByAddress

RewardDistributionsByAddress returns a list of reward claims belonging to the account and matching the claim status.

func (Keeper) RewardProgramByID

RewardProgramByID returns a reward program matching the ID.

func (Keeper) RewardPrograms

RewardPrograms returns a list of reward programs matching the query type.

func (Keeper) RewardShares

func (k Keeper) RewardShares(ctx sdk.Context, rewardProgram *types.RewardProgram, evaluateRes []types.EvaluationResult) error

RewardShares Sets shares for an account(i.e address) based on EvaluationResult

func (*Keeper) SetAccountKeeper

func (k *Keeper) SetAccountKeeper(newKeeper authkeeper.AccountKeeper)

SetAccountKeeper only used in tests

func (Keeper) SetClaimPeriodRewardDistribution

func (k Keeper) SetClaimPeriodRewardDistribution(ctx sdk.Context, claimPeriodRewardDistribution types.ClaimPeriodRewardDistribution)

SetClaimPeriodRewardDistribution sets the ClaimPeriodRewardDistribution in the keeper

func (Keeper) SetRewardAccountState

func (k Keeper) SetRewardAccountState(ctx sdk.Context, state types.RewardAccountState)

SetRewardAccountState stores the provided RewardAccountState in the state store and indexes it.

func (Keeper) SetRewardProgram

func (k Keeper) SetRewardProgram(ctx sdk.Context, rewardProgram types.RewardProgram)

SetRewardProgram sets the reward program in the keeper

func (*Keeper) SetStakingKeeper

func (k *Keeper) SetStakingKeeper(newKeeper types.StakingKeeper)

SetStakingKeeper only used in tests

func (Keeper) StartRewardProgram

func (k Keeper) StartRewardProgram(ctx sdk.Context, rewardProgram *types.RewardProgram) error

StartRewardProgram transition reward program to STARTED

func (Keeper) StartRewardProgramClaimPeriod

func (k Keeper) StartRewardProgramClaimPeriod(ctx sdk.Context, rewardProgram *types.RewardProgram) error

StartRewardProgramClaimPeriod Start ClaimPeriod on a given reward program.

func (Keeper) UpdateUnexpiredRewardsProgram

func (k Keeper) UpdateUnexpiredRewardsProgram(ctx sdk.Context)

UpdateUnexpiredRewardsProgram called from begin blocker, starts/ends or expires rewards programs.

Jump to

Keyboard shortcuts

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