keeper

package
v0.0.0-...-018c514 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k *Keeper) sdk.Invariant

AllInvariants runs all invariants of the module.

func HandleAddProtocolDataProposal

func HandleAddProtocolDataProposal(ctx sdk.Context, k *Keeper, p *types.AddProtocolDataProposal) error

HandleAddProtocolDataProposal is a handler for executing a passed add protocol data proposal.

func LoadSubmodules

func LoadSubmodules() map[cmtypes.ClaimType]Submodule

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

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

func OsmosisPoolUpdateCallback

func OsmosisPoolUpdateCallback(ctx sdk.Context, k *Keeper, response []byte, query icqtypes.Query) error

func ParamsInvariant

func ParamsInvariant(k *Keeper) sdk.Invariant

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k *Keeper)

RegisterInvariants registers all participtationrewards invariants.

func SetEpochBlockCallback

func SetEpochBlockCallback(ctx sdk.Context, k *Keeper, args []byte, query icqtypes.Query) error

SetEpochBlockCallback records the block height of the registered zone at the epoch boundary.

func ValidatorSelectionRewardsCallback

func ValidatorSelectionRewardsCallback(ctx sdk.Context, k *Keeper, response []byte, query icqtypes.Query) error

Types

type Callback

type Callback func(sdk.Context, *Keeper, []byte, icqtypes.Query) error

Callback wrapper struct for interchainstaking keeper.

type Callbacks

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

func (Callbacks) AddCallback

func (c Callbacks) AddCallback(id string, fn interface{}) icqtypes.QueryCallbacks

func (Callbacks) Call

func (c Callbacks) Call(ctx sdk.Context, id string, args []byte, query icqtypes.Query) error

Call calls callback handler.

func (Callbacks) Has

func (c Callbacks) Has(id string) bool

func (Callbacks) RegisterCallbacks

func (c Callbacks) RegisterCallbacks() icqtypes.QueryCallbacks

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

func (Hooks) BeforeEpochStart

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

type Keeper

type Keeper struct {
	IcqKeeper icqkeeper.Keeper

	ValidateProofOps     utils.ProofOpsFn
	ValidateSelfProofOps utils.SelfProofOpsFn
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	key storetypes.StoreKey,
	ps paramtypes.Subspace,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	sk types.StakingKeeper,
	icqk icqkeeper.Keeper,
	icsk icskeeper.Keeper,
	feeCollectorName string,
	proofValidationFn utils.ProofOpsFn,
	selfProofValidationFn utils.SelfProofOpsFn,
) *Keeper

NewKeeper returns a new instance of participationrewards Keeper. This function will panic on failure.

func (*Keeper) AfterEpochEnd

func (k *Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ int64) error

func (*Keeper) AllKeyedProtocolDatas

func (k *Keeper) AllKeyedProtocolDatas(ctx sdk.Context) []*types.KeyedProtocolData

AllKeyedProtocolDatas returns a slice containing all protocol datas and their keys from the store.

func (Keeper) AllocateHoldingsRewards

func (k Keeper) AllocateHoldingsRewards(ctx sdk.Context) error

func (Keeper) AllocateLockupRewards

func (k Keeper) AllocateLockupRewards(ctx sdk.Context, allocation math.Int) error

func (Keeper) AllocateValidatorSelectionRewards

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

AllocateValidatorSelectionRewards utilizes IBC to query the performance rewards account for each zone to determine validator performance and corresponding rewards allocations. Each zone's response is dealt with individually in a callback.

func (*Keeper) AllocateZoneRewards

func (k *Keeper) AllocateZoneRewards(ctx sdk.Context, tvs TokenValues, allocation types.RewardsAllocation) error

AllocateZoneRewards executes zone based rewards allocation. This entails rewards that are proportionally distributed to zones based on the tvl for each zone relative to the tvl of the QS protocol.

func (*Keeper) BeforeEpochStart

func (k *Keeper) BeforeEpochStart(_ sdk.Context, _ string, _ int64) error

func (*Keeper) BeginBlocker

func (k *Keeper) BeginBlocker(_ sdk.Context)

BeginBlocker of participationrewards module.

func (Keeper) CalcDistributionScores

func (k Keeper) CalcDistributionScores(ctx sdk.Context, zone icstypes.Zone, zs *types.ZoneScore) error

CalcDistributionScores calculates the validator distribution scores for the given zone based on the normalized voting power of the validators; scoring favours smaller validators for decentraliztion purposes.

func (Keeper) CalcOverallScores

func (k Keeper) CalcOverallScores(
	ctx sdk.Context,
	zone icstypes.Zone,
	delegatorRewards distrtypes.QueryDelegationTotalRewardsResponse,
	zs *types.ZoneScore,
) error

CalcOverallScores calculates the overall validator scores for the given zone based on the combination of performance score and distribution score.

The performance score is first calculated based on validator rewards earned from the zone performance account that delegates an exact amount to each validator. The total rewards earned by the performance account is divided by the number of active validators to obtain the expected rewards. The performance score for each validator is then simply the percentage of actual rewards compared to the expected rewards (capped at 100%).

On completion a msg is submitted to withdraw the zone performance rewards, resetting zone performance scoring for the next epoch.

func (*Keeper) CalcTokenValues

func (k *Keeper) CalcTokenValues(ctx sdk.Context) (TokenValues, error)

func (Keeper) CalcUserHoldingsAllocations

func (k Keeper) CalcUserHoldingsAllocations(ctx sdk.Context, zone *icstypes.Zone) ([]types.UserAllocation, math.Int)

CalcUserHoldingsAllocations calculates allocations per user for a given zone, based upon claims submitted and zone.

func (Keeper) CalcUserValidatorSelectionAllocations

func (k Keeper) CalcUserValidatorSelectionAllocations(
	ctx sdk.Context,
	zone *icstypes.Zone,
	zs types.ZoneScore,
) []types.UserAllocation

CalcUserValidatorSelectionAllocations returns a slice of userAllocation. It calculates individual user scores relative to overall zone score and then proportionally allocates rewards based on the individual zone allocation.

func (*Keeper) CallbackHandler

func (k *Keeper) CallbackHandler() Callbacks

func (*Keeper) DeleteProtocolData

func (k *Keeper) DeleteProtocolData(ctx sdk.Context, key []byte)

DeleteProtocolData deletes protocol data info.

func (*Keeper) DistributeToUsers

func (k *Keeper) DistributeToUsers(ctx sdk.Context, userAllocations []types.UserAllocation) error

DistributeToUsers sends the allocated user rewards to the user address.

func (*Keeper) GetClaimsEnabled

func (k *Keeper) GetClaimsEnabled(ctx sdk.Context) bool

func (*Keeper) GetCodec

func (k *Keeper) GetCodec() codec.BinaryCodec

func (*Keeper) GetModuleBalance

func (k *Keeper) GetModuleBalance(ctx sdk.Context) sdkmath.Int

func (*Keeper) GetParams

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

GetParams returns the total set of participationrewards parameters.

func (*Keeper) GetProtocolData

func (k *Keeper) GetProtocolData(ctx sdk.Context, pdType types.ProtocolDataType, key string) (types.ProtocolData, bool)

GetProtocolData returns protocol data.

func (*Keeper) Hooks

func (k *Keeper) Hooks() Hooks

func (*Keeper) IterateAllProtocolDatas

func (k *Keeper) IterateAllProtocolDatas(ctx sdk.Context, fn func(index int64, key string, data types.ProtocolData) (stop bool))

IterateAllProtocolDatas iterates through protocol data and perform the provided function.

func (*Keeper) IteratePrefixedProtocolDatas

func (k *Keeper) IteratePrefixedProtocolDatas(ctx sdk.Context, key []byte, fn func(index int64, key []byte, data types.ProtocolData) (stop bool))

IteratePrefixedProtocolDatas iterate through protocol data with the given prefix and perform the provided function.

func (*Keeper) Logger

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

Logger returns a module-specific logger.

func (*Keeper) Params

Params returns params of the participationrewards module.

func (*Keeper) SetEpochsKeeper

func (k *Keeper) SetEpochsKeeper(epochsKeeper epochskeeper.Keeper)

func (*Keeper) SetParams

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

SetParams sets the total set of participationrewards parameters.

func (Keeper) SetProtocolData

func (k Keeper) SetProtocolData(ctx sdk.Context, key []byte, data *types.ProtocolData)

SetProtocolData set protocol data info.

func (*Keeper) SetZoneAllocations

func (k *Keeper) SetZoneAllocations(ctx sdk.Context, tvs TokenValues, allocation types.RewardsAllocation) error

SetZoneAllocations returns the proportional zone rewards allocations as a map indexed by the zone id.

func (*Keeper) UpdateSelfConnectionData

func (k *Keeper) UpdateSelfConnectionData(ctx sdk.Context) error

type LiquidTokensModule

type LiquidTokensModule struct{}

func (*LiquidTokensModule) Hooks

func (m *LiquidTokensModule) Hooks(_ sdk.Context, _ *Keeper)

func (*LiquidTokensModule) IsActive

func (m *LiquidTokensModule) IsActive() bool

func (*LiquidTokensModule) IsReady

func (m *LiquidTokensModule) IsReady() bool

func (*LiquidTokensModule) ValidateClaim

func (m *LiquidTokensModule) ValidateClaim(ctx sdk.Context, k *Keeper, msg *types.MsgSubmitClaim) (uint64, error)

type OsmosisModule

type OsmosisModule struct{}

func (*OsmosisModule) GetKeyPrefixPools

func (m *OsmosisModule) GetKeyPrefixPools(poolID uint64) []byte

func (*OsmosisModule) Hooks

func (m *OsmosisModule) Hooks(ctx sdk.Context, k *Keeper)

func (*OsmosisModule) IsActive

func (m *OsmosisModule) IsActive() bool

func (*OsmosisModule) IsReady

func (m *OsmosisModule) IsReady() bool

func (*OsmosisModule) ValidateClaim

func (m *OsmosisModule) ValidateClaim(ctx sdk.Context, k *Keeper, msg *types.MsgSubmitClaim) (uint64, error)

type Submodule

type Submodule interface {
	Hooks(ctx sdk.Context, keeper *Keeper)
	IsActive() bool
	IsReady() bool
	ValidateClaim(ctx sdk.Context, k *Keeper, msg *types.MsgSubmitClaim) (uint64, error)
}

Submodule defines the interface for for tracking off-chain qAssets with regards to participation rewards claims.

type TokenValues

type TokenValues map[string]sdk.Dec

type UserAllocation

type UserAllocation struct {
	Address string
	Amount  sdkmath.Int
}

UserAllocation is an internal keeper struct to track transient state for rewards distribution. It contains the user address and the coins that are allocated to it.

Jump to

Keyboard shortcuts

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