store

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IncentiveStore

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

IncentiveStore provides methods for interacting with the incentive store.

func NewIncentiveStore

func NewIncentiveStore(cdc codec.Codec, key sdk.StoreKey) IncentiveStore

NewIncentiveStore creates a new IncentiveStore

func (IncentiveStore) DeleteClaim

func (k IncentiveStore) DeleteClaim(
	ctx sdk.Context,
	claimType types.ClaimType,
	owner sdk.AccAddress,
)

DeleteClaim deletes the claim in the store corresponding to the owner and claimType

func (IncentiveStore) GetAllClaims

func (k IncentiveStore) GetAllClaims(ctx sdk.Context) types.Claims

GetAllClaims returns all Claim objects in the store of any claimType

func (IncentiveStore) GetAllRewardAccrualTimes

func (k IncentiveStore) GetAllRewardAccrualTimes(ctx sdk.Context) types.AccrualTimes

GetAllRewardAccrualTimes returns all reward accrual times of any claimType.

func (IncentiveStore) GetClaim

func (k IncentiveStore) GetClaim(
	ctx sdk.Context,
	claimType types.ClaimType,
	addr sdk.AccAddress,
) (types.Claim, bool)

GetClaim returns the claim in the store corresponding the the owner and claimType, and a boolean for if the claim was found

func (IncentiveStore) GetClaims

func (k IncentiveStore) GetClaims(
	ctx sdk.Context,
	claimType types.ClaimType,
) types.Claims

GetClaims returns all Claim objects in the store of a given claimType

func (IncentiveStore) GetRewardAccrualTime

func (k IncentiveStore) GetRewardAccrualTime(
	ctx sdk.Context,
	claimType types.ClaimType,
	sourceID string,
) (time.Time, bool)

GetRewardAccrualTime fetches the last time rewards were accrued for the specified ClaimType and sourceID.

func (IncentiveStore) GetRewardIndexes

func (k IncentiveStore) GetRewardIndexes(ctx sdk.Context) types.TypedRewardIndexesList

GetRewardIndexes returns all reward indexes of any claimType.

func (IncentiveStore) GetRewardIndexesOfClaimType

func (k IncentiveStore) GetRewardIndexesOfClaimType(
	ctx sdk.Context,
	claimType types.ClaimType,
	collateralType string,
) (types.RewardIndexes, bool)

GetRewardIndexesOfClaimType fetches the global reward indexes that track total rewards of a given claimType and collateralType.

func (IncentiveStore) IterateClaims

func (k IncentiveStore) IterateClaims(
	ctx sdk.Context,
	cb func(c types.Claim) (stop bool),
)

IterateClaims iterates over all claim objects of any claimType in the store and preforms a callback function

func (IncentiveStore) IterateClaimsByClaimType

func (k IncentiveStore) IterateClaimsByClaimType(
	ctx sdk.Context,
	claimType types.ClaimType,
	cb func(c types.Claim) (stop bool),
)

IterateClaimsByClaimType iterates over all claim objects in the store of a given claimType and preforms a callback function

func (IncentiveStore) IterateRewardAccrualTimes

func (k IncentiveStore) IterateRewardAccrualTimes(
	ctx sdk.Context,
	cb func(types.AccrualTime) (stop bool),
)

IterateRewardAccrualTimes iterates over all reward accrual times of any claimType and performs a callback function.

func (IncentiveStore) IterateRewardAccrualTimesByClaimType

func (k IncentiveStore) IterateRewardAccrualTimesByClaimType(
	ctx sdk.Context,
	claimType types.ClaimType,
	cb func(string, time.Time) (stop bool),
)

IterateRewardAccrualTimesByClaimType iterates over all reward accrual times of a given claimType and performs a callback function.

func (IncentiveStore) IterateRewardIndexes

func (k IncentiveStore) IterateRewardIndexes(
	ctx sdk.Context,
	cb func(types.TypedRewardIndexes) (stop bool),
)

IterateRewardIndexes iterates over all reward index objects in the store of all ClaimTypes and performs a callback function.

func (IncentiveStore) IterateRewardIndexesByClaimType

func (k IncentiveStore) IterateRewardIndexesByClaimType(
	ctx sdk.Context,
	claimType types.ClaimType,
	cb func(types.TypedRewardIndexes) (stop bool),
)

IterateRewardIndexesByClaimType iterates over all reward index objects in the store of a given ClaimType and performs a callback function.

func (IncentiveStore) SetClaim

func (k IncentiveStore) SetClaim(
	ctx sdk.Context,
	c types.Claim,
)

SetClaim sets the claim in the store corresponding to the owner and claimType

func (IncentiveStore) SetRewardAccrualTime

func (k IncentiveStore) SetRewardAccrualTime(
	ctx sdk.Context,
	claimType types.ClaimType,
	sourceID string,
	blockTime time.Time,
)

SetRewardAccrualTime stores the last time rewards were accrued for the specified ClaimType and sourceID.

func (IncentiveStore) SetRewardIndexes

func (k IncentiveStore) SetRewardIndexes(
	ctx sdk.Context,
	claimType types.ClaimType,
	collateralType string,
	indexes types.RewardIndexes,
)

SetRewardIndexes stores the global reward indexes that track total rewards of a given claim type and collateralType.

Jump to

Keyboard shortcuts

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