Documentation ¶
Index ¶
- Constants
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) CalculateParticipantReward(ctx sdk.Context, shares int64, totalShares int64, claimRewardPool sdk.Coin, ...) sdk.Coin
- func (k Keeper) CalculateRewardClaimPeriodRewards(ctx sdk.Context, maxReward sdk.Coin, ...) (sum sdk.Coin, err error)
- func (k Keeper) ClaimAllRewards(ctx sdk.Context, addr string) ([]*types.RewardProgramClaimDetail, sdk.Coins, error)
- func (k Keeper) ClaimPeriodRewardDistributions(ctx context.Context, req *types.QueryClaimPeriodRewardDistributionsRequest) (*types.QueryClaimPeriodRewardDistributionsResponse, error)
- func (k Keeper) ClaimPeriodRewardDistributionsByID(ctx context.Context, req *types.QueryClaimPeriodRewardDistributionsByIDRequest) (*types.QueryClaimPeriodRewardDistributionsByIDResponse, error)
- func (k Keeper) ClaimRewards(ctx sdk.Context, rewardProgramID uint64, addr string) ([]*types.ClaimedRewardPeriodDetail, sdk.Coin, error)
- func (k Keeper) CreateRewardProgram(ctx sdk.Context, rewardProgram types.RewardProgram) (err error)
- func (k Keeper) DetectQualifyingActions(ctx sdk.Context, program *types.RewardProgram) ([]types.EvaluationResult, error)
- func (k Keeper) EndRewardProgram(ctx sdk.Context, rewardProgram *types.RewardProgram) error
- func (k Keeper) EndRewardProgramClaimPeriod(ctx sdk.Context, rewardProgram *types.RewardProgram) error
- func (k Keeper) EndingRewardProgram(ctx sdk.Context, rewardProgram types.RewardProgram)
- func (k Keeper) ExpireRewardClaimsForRewardProgram(ctx sdk.Context, rewardProgramID uint64) error
- func (k Keeper) ExpireRewardProgram(ctx sdk.Context, rewardProgram *types.RewardProgram) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) FindQualifyingActions(ctx sdk.Context, action types.RewardAction) ([]types.EvaluationResult, error)
- func (k Keeper) GetAccountKeeper() types.AccountKeeper
- func (k Keeper) GetAllActiveRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)
- func (k Keeper) GetAllClaimPeriodRewardDistributions(sdkCtx sdk.Context) ([]types.ClaimPeriodRewardDistribution, error)
- func (k Keeper) GetAllCompletedRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)
- func (k Keeper) GetAllExpiredRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)
- func (k Keeper) GetAllOutstandingRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)
- func (k Keeper) GetAllPendingRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)
- func (k Keeper) GetAllRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)
- func (k Keeper) GetAllUnexpiredRewardPrograms(ctx sdk.Context) ([]types.RewardProgram, error)
- func (k Keeper) GetClaimPeriodRewardDistribution(ctx sdk.Context, claimPeriodID uint64, rewardID uint64) (claimPeriodRewardDistribution types.ClaimPeriodRewardDistribution, err error)
- func (k Keeper) GetNextRewardProgramID(ctx sdk.Context) (rewardProgramID uint64, err error)
- func (k Keeper) GetRewardAccountState(ctx sdk.Context, rewardProgramID, rewardClaimPeriodID uint64, addr string) (state types.RewardAccountState, err error)
- func (k Keeper) GetRewardAccountStatesForClaimPeriod(ctx sdk.Context, rewardProgramID, claimPeriodID uint64) ([]types.RewardAccountState, error)
- func (k Keeper) GetRewardAccountStatesForRewardProgram(ctx sdk.Context, rewardProgramID uint64) ([]types.RewardAccountState, error)
- func (k Keeper) GetRewardProgram(ctx sdk.Context, id uint64) (rewardProgram types.RewardProgram, err error)
- func (k Keeper) GetRewardProgramID(ctx sdk.Context) (rewardprogramID uint64, err error)
- func (k Keeper) GetStakingKeeper() types.StakingKeeper
- func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState)
- func (k Keeper) IterateABCIEvents(ctx sdk.Context, criteria *types.EventCriteria, ...) error
- func (k Keeper) IterateAllRewardAccountStates(ctx sdk.Context, handle func(state types.RewardAccountState) (stop bool)) error
- func (k Keeper) IterateClaimPeriodRewardDistributions(ctx sdk.Context, ...) error
- func (k Keeper) IterateRewardAccountStates(ctx sdk.Context, rewardProgramID, rewardClaimPeriodID uint64, ...) error
- func (k Keeper) IterateRewardAccountStatesByAddress(ctx sdk.Context, addr sdk.AccAddress, ...) error
- func (k Keeper) IterateRewardAccountStatesByAddressAndRewardsID(ctx sdk.Context, addr sdk.AccAddress, rewardsID uint64, ...) error
- func (k Keeper) IterateRewardAccountStatesByLookUpIndex(ctx sdk.Context, addr sdk.AccAddress, iterator sdk.Iterator, ...) error
- func (k Keeper) IterateRewardAccountStatesForRewardProgram(ctx sdk.Context, rewardProgramID uint64, ...) error
- func (k Keeper) IterateRewardPrograms(ctx sdk.Context, ...) error
- func (k Keeper) MakeRewardClaimsClaimableForPeriod(ctx sdk.Context, rewardProgramID, claimPeriodID uint64) error
- func (k Keeper) ProcessQualifyingActions(ctx sdk.Context, program *types.RewardProgram, processor types.RewardAction, ...) []types.EvaluationResult
- func (k Keeper) ProcessTransactions(ctx sdk.Context)
- func (k Keeper) RefundRemainingBalance(ctx sdk.Context, rewardProgram *types.RewardProgram) error
- func (k Keeper) RefundRewardClaims(ctx sdk.Context, rewardProgram types.RewardProgram) error
- func (k Keeper) RemoveClaimPeriodRewardDistribution(ctx sdk.Context, claimPeriodID uint64, rewardID uint64) bool
- func (k Keeper) RemoveRewardProgram(ctx sdk.Context, id uint64) bool
- func (k Keeper) RewardDistributionsByAddress(ctx context.Context, request *types.QueryRewardDistributionsByAddressRequest) (*types.QueryRewardDistributionsByAddressResponse, error)
- func (k Keeper) RewardProgramByID(ctx context.Context, req *types.QueryRewardProgramByIDRequest) (*types.QueryRewardProgramByIDResponse, error)
- func (k Keeper) RewardPrograms(ctx context.Context, req *types.QueryRewardProgramsRequest) (*types.QueryRewardProgramsResponse, error)
- func (k Keeper) RewardShares(ctx sdk.Context, rewardProgram *types.RewardProgram, ...) error
- func (k *Keeper) SetAccountKeeper(newKeeper authkeeper.AccountKeeper)
- func (k Keeper) SetClaimPeriodRewardDistribution(ctx sdk.Context, ...)
- func (k Keeper) SetRewardAccountState(ctx sdk.Context, state types.RewardAccountState)
- func (k Keeper) SetRewardProgram(ctx sdk.Context, rewardProgram types.RewardProgram)
- func (k *Keeper) SetStakingKeeper(newKeeper types.StakingKeeper)
- func (k Keeper) StartRewardProgram(ctx sdk.Context, rewardProgram *types.RewardProgram) error
- func (k Keeper) StartRewardProgramClaimPeriod(ctx sdk.Context, rewardProgram *types.RewardProgram) error
- func (k Keeper) UpdateUnexpiredRewardsProgram(ctx sdk.Context)
Constants ¶
const StoreKey = types.ModuleName
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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 ¶
func (k Keeper) ClaimPeriodRewardDistributions(ctx context.Context, req *types.QueryClaimPeriodRewardDistributionsRequest) (*types.QueryClaimPeriodRewardDistributionsResponse, error)
ClaimPeriodRewardDistributions returns a list of claim period reward distributions matching the claim_status.
func (Keeper) ClaimPeriodRewardDistributionsByID ¶
func (k Keeper) ClaimPeriodRewardDistributionsByID(ctx context.Context, req *types.QueryClaimPeriodRewardDistributionsByIDRequest) (*types.QueryClaimPeriodRewardDistributionsByIDResponse, error)
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 ¶
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 ¶
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 ¶
Changes the state for all account states in a reward program to be expired if they are not claimed
func (Keeper) ExpireRewardProgram ¶
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 ¶
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 ¶
GetAllCompletedRewardPrograms gets all completed the RewardPrograms
func (Keeper) GetAllExpiredRewardPrograms ¶
GetAllExpiredRewardPrograms gets all expired RewardPrograms
func (Keeper) GetAllOutstandingRewardPrograms ¶
GetAllOutstandingRewardPrograms Gets all RewardPrograms that have not expired
func (Keeper) GetAllPendingRewardPrograms ¶
GetAllPendingRewardPrograms gets all pending the RewardPrograms
func (Keeper) GetAllRewardPrograms ¶
GetAllRewardPrograms Gets all the RewardPrograms
func (Keeper) GetAllUnexpiredRewardPrograms ¶
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 ¶
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 ¶
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 ¶
ProcessTransactions in the endblock
func (Keeper) RefundRemainingBalance ¶
RefundRemainingBalance returns the remaining pool balance to the reward program creator
func (Keeper) RefundRewardClaims ¶
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 ¶
RemoveRewardProgram Removes a reward program in the keeper
func (Keeper) RewardDistributionsByAddress ¶
func (k Keeper) RewardDistributionsByAddress(ctx context.Context, request *types.QueryRewardDistributionsByAddressRequest) (*types.QueryRewardDistributionsByAddressResponse, error)
RewardDistributionsByAddress returns a list of reward claims belonging to the account and matching the claim status.
func (Keeper) RewardProgramByID ¶
func (k Keeper) RewardProgramByID(ctx context.Context, req *types.QueryRewardProgramByIDRequest) (*types.QueryRewardProgramByIDResponse, error)
RewardProgramByID returns a reward program matching the ID.
func (Keeper) RewardPrograms ¶
func (k Keeper) RewardPrograms(ctx context.Context, req *types.QueryRewardProgramsRequest) (*types.QueryRewardProgramsResponse, error)
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 ¶
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 ¶
UpdateUnexpiredRewardsProgram called from begin blocker, starts/ends or expires rewards programs.