keeper

package
v4.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type Hooks

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

Hooks wrapper struct for liquidstake 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

func (Hooks) GetModuleName

func (Hooks) GetModuleName() string

GetModuleName implements types.EpochHooks.

type Keeper

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

Keeper of the liquidstake store

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	stakingKeeper types.StakingKeeper,
	distrKeeper types.DistrKeeper,
	slashingKeeper types.SlashingKeeper,
	router *baseapp.MsgServiceRouter,
	authority string,
) Keeper

NewKeeper returns a liquidstake keeper.

func (Keeper) AfterEpochEnd

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

AfterEpochEnd is a hook which is executed after the end of an epoch. It is a no-op for liquidstake module.

func (Keeper) AutocompoundStakingRewards

func (k Keeper) AutocompoundStakingRewards(ctx sdk.Context, whitelistedValsMap types.WhitelistedValsMap)

AutocompoundStakingRewards withdraws staking rewards and re-stakes when over threshold.

func (Keeper) BeforeEpochStart

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

BeforeEpochStart is a hook which is executed before the start of an epoch.

func (Keeper) CheckDelegationStates

func (k Keeper) CheckDelegationStates(ctx sdk.Context, proxyAcc sdk.AccAddress) (math.LegacyDec, math.LegacyDec, math.Int)

CheckDelegationStates returns total remaining rewards, delshares, liquid tokens of delegations by proxy account

func (Keeper) DelegateWithCap

func (k Keeper) DelegateWithCap(
	ctx sdk.Context,
	delegatorAddress sdk.AccAddress,
	validator stakingtypes.Validator,
	bondAmt math.Int,
) error

DelegateWithCap is a wrapper to invoke stakingKeeper.Delegate but account for the amount of liquid staked shares and check against liquid staking cap.

func (Keeper) DistributeWeightedRewards

func (k Keeper) DistributeWeightedRewards(ctx sdk.Context, rewardsCoin sdk.Coin, weightedRewardsReceivers []types.WeightedAddress) (ixomath.Int, error)

DistributeWeightedRewards distributes the staking rewards to the given list of weightedRewardsReceivers based on their weights, if there are any. Returns the total amount distributed.

func (Keeper) ExportGenesis

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

ExportGenesis returns the liquidstake module's genesis state.

func (Keeper) GetActiveLiquidValidators

func (k Keeper) GetActiveLiquidValidators(ctx sdk.Context, whitelistedValsMap types.WhitelistedValsMap) (vals types.ActiveLiquidValidators)

GetActiveLiquidValidators get the set of active liquid validators.

func (Keeper) GetAllLiquidValidatorStates

func (k Keeper) GetAllLiquidValidatorStates(ctx sdk.Context) (liquidValidatorStates []types.LiquidValidatorState)

func (Keeper) GetAllLiquidValidators

func (k Keeper) GetAllLiquidValidators(ctx sdk.Context) (vals types.LiquidValidators)

GetAllLiquidValidators gets the set of all liquid validators, with no pagination limits.

func (Keeper) GetCodec

func (k Keeper) GetCodec() codec.BinaryCodec

GetCodec return codec.Codec object used by the keeper

func (Keeper) GetLiquidValidator

func (k Keeper) GetLiquidValidator(ctx sdk.Context, addr sdk.ValAddress) (val types.LiquidValidator, found bool)

GetLiquidValidator get a single liquid validator

func (Keeper) GetLiquidValidatorState

func (k Keeper) GetLiquidValidatorState(ctx sdk.Context, addr sdk.ValAddress) (liquidValidatorState types.LiquidValidatorState, found bool)

func (Keeper) GetNetAmountState

func (k Keeper) GetNetAmountState(ctx sdk.Context) (nas types.NetAmountState)

GetNetAmountState calculates the sum of bondedDenom balance, total delegation tokens(slash applied LiquidTokens), total remaining reward of types.LiquidStakeProxyAcc During liquid unstaking, stkixo immediately burns and the unbonding queue belongs to the requester, so the liquid staker's unbonding values are excluded on netAmount It is used only for calculation and query and is not stored in kv.

func (Keeper) GetParams

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

GetParams gets the auth module's parameters.

func (Keeper) GetProxyAccBalance

func (k Keeper) GetProxyAccBalance(ctx sdk.Context, proxyAcc sdk.AccAddress) (balance sdk.Coin)

GetProxyAccBalance returns the available spendable balance of the proxy account for the native token.

func (Keeper) GetWeightMap

func (k Keeper) GetWeightMap(ctx sdk.Context, liquidVals types.LiquidValidators, whitelistedValsMap types.WhitelistedValsMap) (map[string]math.Int, math.Int)

GetWeightMap returns a map of active operator address to weight(from whitelisted validators), and the total weight of the active liquid validators

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

func (Keeper) InitGenesis

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

InitGenesis initializes the liquidstake module's state from a given genesis state.

func (Keeper) IsActiveLiquidValidator

func (k Keeper) IsActiveLiquidValidator(ctx sdk.Context, lv types.LiquidValidator, whitelistedValsMap types.WhitelistedValsMap) bool

IsActiveLiquidValidator checks if a liquid validator is active based on the ActiveCondition function

func (Keeper) IsTombstoned

func (k Keeper) IsTombstoned(ctx sdk.Context, val stakingtypes.Validator) bool

func (Keeper) LiquidBondDenom

func (k Keeper) LiquidBondDenom(ctx sdk.Context) string

func (Keeper) LiquidDelegate

func (k Keeper) LiquidDelegate(ctx sdk.Context, proxyAcc sdk.AccAddress, activeVals types.ActiveLiquidValidators, stakingAmt math.Int, whitelistedValsMap types.WhitelistedValsMap) (err error)

LiquidDelegate delegates staking amount to active validators by proxy account.

func (Keeper) LiquidStake

func (k Keeper) LiquidStake(
	ctx sdk.Context, proxyAcc, liquidStaker sdk.AccAddress, stakingCoin sdk.Coin,
) (stkIXOMintAmount math.Int, err error)

LiquidStake mints stkIXO worth of staking coin value according to NetAmount and performs LiquidDelegate.

func (Keeper) LiquidUnbond

func (k Keeper) LiquidUnbond(
	ctx sdk.Context, proxyAcc, liquidStaker sdk.AccAddress, valAddr sdk.ValAddress, shares math.LegacyDec, checkMaxEntries bool, unbondAmount sdk.Coin,
) (time.Time, math.Int, stakingtypes.UnbondingDelegation, error)

LiquidUnbond unbond delegation shares to active validators by proxy account.

func (Keeper) LiquidUnstake

func (k Keeper) LiquidUnstake(
	ctx sdk.Context, proxyAcc, liquidStaker sdk.AccAddress, unstakingStkIXO sdk.Coin,
) (time.Time, math.Int, []stakingtypes.UnbondingDelegation, math.Int, error)

LiquidUnstake burns unstakingStkIXO and performs LiquidUnbond to active liquid validators with del shares worth of shares according to NetAmount with each validators current weight.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) PrioritiseInactiveLiquidValidators

func (k Keeper) PrioritiseInactiveLiquidValidators(
	ctx sdk.Context,
	vs types.LiquidValidators,
) types.LiquidValidators

PrioritiseInactiveLiquidValidators sorts LiquidValidators array to have inactive validators first. Used for the case when unbonding should begin from the inactive validators first.

func (Keeper) Rebalance

func (k Keeper) Rebalance(
	ctx sdk.Context,
	proxyAcc sdk.AccAddress,
	liquidVals types.LiquidValidators,
	whitelistedValsMap types.WhitelistedValsMap,
	rebalancingTrigger math.LegacyDec,
) (redelegations []types.Redelegation)

Rebalance argument liquidVals containing ValidatorStatusActive which is containing just added on whitelist(liquidToken 0) and ValidatorStatusInactive to delist

func (Keeper) RedelegateWithCap

func (k Keeper) RedelegateWithCap(
	ctx sdk.Context,
	delegatorAddress sdk.AccAddress,
	validatorSrc sdk.ValAddress,
	validatorDst sdk.ValAddress,
	bondAmt math.Int,
) (time.Time, error)

RedelegateWithCap is a wrapper to invoke stakingKeeper.Redelegate but account for the amount of liquid staked shares and check against liquid staking cap.

func (Keeper) RemoveLiquidValidator

func (k Keeper) RemoveLiquidValidator(ctx sdk.Context, val types.LiquidValidator)

RemoveLiquidValidator remove a liquid validator on kv store

func (Keeper) Router

func (k Keeper) Router() *baseapp.MsgServiceRouter

Router returns the keeper's msg router

func (Keeper) SetLiquidValidator

func (k Keeper) SetLiquidValidator(ctx sdk.Context, val types.LiquidValidator)

SetLiquidValidator set the main record holding liquid validator details

func (Keeper) SetParams

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

SetParams sets the auth module's parameters.

func (Keeper) TryRedelegation

func (k Keeper) TryRedelegation(ctx sdk.Context, re types.Redelegation) (completionTime time.Time, err error)

TryRedelegation attempts redelegation, which is applied only when successful through cached context because there is a constraint that fails if already receiving redelegation.

func (Keeper) UnbondWithCap

func (k Keeper) UnbondWithCap(
	ctx sdk.Context,
	delegatorAddress sdk.AccAddress,
	validatorAddress sdk.ValAddress,
	amount sdk.Coin,
	userAddress sdk.AccAddress,
) (math.Int, error)

UnbondWithCap is a wrapper to invoke stakingKeeper.Unbond but updates the total liquid staked tokens.

func (Keeper) UpdateLiquidValidatorSet

func (k Keeper) UpdateLiquidValidatorSet(ctx sdk.Context, redelegate bool) (redelegations []types.Redelegation)

func (Keeper) WithdrawLiquidRewards

func (k Keeper) WithdrawLiquidRewards(ctx sdk.Context, proxyAcc sdk.AccAddress)

WithdrawLiquidRewards iterate over all the delegations (even those out of the active set) and withdraw rewards

type Querier

type Querier struct {
	Keeper
}

Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper.

func (Querier) LiquidValidators

LiquidValidators queries all liquid validators.

func (Querier) Params

Params queries the parameters of the liquidstake module.

func (Querier) States

States queries states of liquid stake module.

Jump to

Keyboard shortcuts

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