Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func LiquidDelegationInvariant(k Keeper) sdk.Invariant
- func NetAmountInvariant(k Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func RandomActiveLiquidValidator(r *rand.Rand, ctx sdk.Context, k Keeper, sk types.StakingKeeper) (val stakingtypes.Validator, ok bool)
- func RandomValidator(r *rand.Rand, keeper types.StakingKeeper, ctx sdk.Context) (val stakingtypes.Validator, ok bool)
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func TotalLiquidTokensInvariant(k Keeper) sdk.Invariant
- type Hooks
- func (h Hooks) AfterProposalDeposit(_ sdk.Context, _ uint64, _ sdk.AccAddress)
- func (h Hooks) AfterProposalFailedMinDeposit(_ sdk.Context, _ uint64)
- func (h Hooks) AfterProposalSubmission(_ sdk.Context, _ uint64)
- func (h Hooks) AfterProposalVote(_ sdk.Context, _ uint64, _ sdk.AccAddress)
- func (h Hooks) AfterProposalVotingPeriodEnded(_ sdk.Context, _ uint64)
- func (h Hooks) SetAdditionalVotingPowers(ctx sdk.Context, votes govtypes.Votes, ...)
- type Keeper
- func (k Keeper) BTokenSharePerPublicPositionShare(ctx sdk.Context, publicPosition liquidammtypes.PublicPosition, ...) sdk.Dec
- func (k Keeper) CalcLiquidStakingVotingPower(ctx sdk.Context, addr sdk.AccAddress) sdk.Int
- func (k Keeper) CalcStakingVotingPower(ctx sdk.Context, addr sdk.AccAddress) sdk.Int
- func (k Keeper) CheckDelegationStates(ctx sdk.Context, proxyAcc sdk.AccAddress) (sdk.Dec, sdk.Dec, sdk.Int)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetActiveLiquidValidators(ctx sdk.Context, whitelistedValsMap types.WhitelistedValsMap) (vals types.ActiveLiquidValidators)
- func (k Keeper) GetAllLiquidValidatorStates(ctx sdk.Context) (liquidValidatorStates []types.LiquidValidatorState)
- func (k Keeper) GetAllLiquidValidators(ctx sdk.Context) (vals types.LiquidValidators)
- func (k Keeper) GetBTokenSharePerPublicPositionShareMap(ctx sdk.Context, targetDenom string) map[string]sdk.Dec
- func (k Keeper) GetCodec() codec.BinaryCodec
- func (k Keeper) GetLiquidValidator(ctx sdk.Context, addr sdk.ValAddress) (val types.LiquidValidator, found bool)
- func (k Keeper) GetLiquidValidatorState(ctx sdk.Context, addr sdk.ValAddress) (liquidValidatorState types.LiquidValidatorState, found bool)
- func (k Keeper) GetNetAmountState(ctx sdk.Context) (nas types.NetAmountState)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetProxyAccBalance(ctx sdk.Context, proxyAcc sdk.AccAddress) (balance sdk.Coin)
- func (k Keeper) GetVoterBalanceByDenom(ctx sdk.Context, votes govtypes.Votes) map[string]map[string]sdk.Int
- func (k Keeper) GetVotingPower(ctx sdk.Context, addr sdk.AccAddress) types.VotingPower
- func (k Keeper) GetWeightMap(ctx sdk.Context, liquidVals types.LiquidValidators, ...) (map[string]sdk.Int, sdk.Int)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) IsActiveLiquidValidator(ctx sdk.Context, lv types.LiquidValidator, ...) bool
- func (k Keeper) IsTombstoned(ctx sdk.Context, val stakingtypes.Validator) bool
- func (k Keeper) LiquidBondDenom(ctx sdk.Context) (res string)
- func (k Keeper) LiquidDelegate(ctx sdk.Context, proxyAcc sdk.AccAddress, ...) (newShares sdk.Dec, err error)
- func (k Keeper) LiquidStake(ctx sdk.Context, proxyAcc, liquidStaker sdk.AccAddress, stakingCoin sdk.Coin) (newShares sdk.Dec, bTokenMintAmount sdk.Int, err error)
- func (k Keeper) LiquidUnbond(ctx sdk.Context, proxyAcc, liquidStaker sdk.AccAddress, valAddr sdk.ValAddress, ...) (time.Time, sdk.Int, stakingtypes.UnbondingDelegation, error)
- func (k Keeper) LiquidUnstake(ctx sdk.Context, proxyAcc, liquidStaker sdk.AccAddress, ...) (time.Time, sdk.Int, []stakingtypes.UnbondingDelegation, sdk.Int, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Rebalance(ctx sdk.Context, proxyAcc sdk.AccAddress, liquidVals types.LiquidValidators, ...) (redelegations []types.Redelegation)
- func (k Keeper) RemoveLiquidValidator(ctx sdk.Context, val types.LiquidValidator)
- func (k Keeper) SetLiquidStakingVotingPowers(ctx sdk.Context, votes govtypes.Votes, ...)
- func (k Keeper) SetLiquidValidator(ctx sdk.Context, val types.LiquidValidator)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) TokenAmountFromAMMPositions(ctx sdk.Context, addr sdk.AccAddress, targetDenom string) sdk.Int
- func (k Keeper) TokenAmountFromFarmingPositions(ctx sdk.Context, addr sdk.AccAddress, targetDenom string, ...) sdk.Int
- func (k Keeper) TryRedelegation(ctx sdk.Context, re types.Redelegation) (completionTime time.Time, err error)
- func (k Keeper) UpdateLiquidValidatorSet(ctx sdk.Context) []types.Redelegation
- func (k Keeper) WithdrawLiquidRewards(ctx sdk.Context, proxyAcc sdk.AccAddress) sdk.Int
- func (k Keeper) WithdrawRewardsAndReStake(ctx sdk.Context, whitelistedValsMap types.WhitelistedValsMap)
- type Querier
- func (k Querier) LiquidValidators(c context.Context, req *types.QueryLiquidValidatorsRequest) (*types.QueryLiquidValidatorsResponse, error)
- func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) States(c context.Context, req *types.QueryStatesRequest) (*types.QueryStatesResponse, error)
- func (k Querier) VotingPower(c context.Context, req *types.QueryVotingPowerRequest) (*types.QueryVotingPowerResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the liquidstaking module.
func LiquidDelegationInvariant ¶
LiquidDelegationInvariant checks all delegation of proxy account involved liquid validators.
func NetAmountInvariant ¶
NetAmountInvariant checks that the amount of btoken supply with NetAmount.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the liquidstaking MsgServer interface for the provided Keeper.
func RandomActiveLiquidValidator ¶
func RandomActiveLiquidValidator(r *rand.Rand, ctx sdk.Context, k Keeper, sk types.StakingKeeper) (val stakingtypes.Validator, ok bool)
RandomActiveLiquidValidator returns a random validator given access to the keeper and ctx
func RandomValidator ¶
func RandomValidator(r *rand.Rand, keeper types.StakingKeeper, ctx sdk.Context) (val stakingtypes.Validator, ok bool)
RandomValidator returns a random validator given access to the keeper and ctx
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all liquidstaking invariants.
func TotalLiquidTokensInvariant ¶
TotalLiquidTokensInvariant checks equal total liquid tokens of proxy account with total liquid tokens of liquid validators.
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Wrapper struct
func (Hooks) AfterProposalDeposit ¶
func (Hooks) AfterProposalFailedMinDeposit ¶
func (Hooks) AfterProposalSubmission ¶
func (Hooks) AfterProposalVote ¶
func (Hooks) AfterProposalVotingPeriodEnded ¶
func (Hooks) SetAdditionalVotingPowers ¶
func (h Hooks) SetAdditionalVotingPowers(ctx sdk.Context, votes govtypes.Votes, votingPowers *govtypes.AdditionalVotingPowers)
SetAdditionalVotingPowers calculates and sets voting powers of the person who participated in liquid staking voters in votes.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the liquidstaking store
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, distrKeeper types.DistrKeeper, ammKeeper types.AMMKeeper, liquidAMMKeeper types.LiquidAMMKeeper, lpfarmKeeper types.LPFarmKeeper, slashingKeeper types.SlashingKeeper, ) Keeper
NewKeeper returns a liquidstaking keeper. It handles: - creating new ModuleAccounts for each pool ReserveAccount - sending to and from ModuleAccounts - minting, burning PoolCoins
func (Keeper) BTokenSharePerPublicPositionShare ¶
func (k Keeper) BTokenSharePerPublicPositionShare(ctx sdk.Context, publicPosition liquidammtypes.PublicPosition, targetDenom string) sdk.Dec
func (Keeper) CalcLiquidStakingVotingPower ¶
CalcLiquidStakingVotingPower returns voting power of the addr by liquid bond denom
func (Keeper) CalcStakingVotingPower ¶
CalcStakingVotingPower returns voting power of the addr by normal delegations except self-delegation
func (Keeper) CheckDelegationStates ¶
func (k Keeper) CheckDelegationStates(ctx sdk.Context, proxyAcc sdk.AccAddress) (sdk.Dec, sdk.Dec, sdk.Int)
CheckDelegationStates returns total remaining rewards, delshares, liquid tokens of delegations by proxy account
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the liquidstaking 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 get the set of all liquid validators with no limits, used during genesis dump
func (Keeper) GetBTokenSharePerPublicPositionShareMap ¶
func (k Keeper) GetBTokenSharePerPublicPositionShareMap(ctx sdk.Context, targetDenom string) map[string]sdk.Dec
GetBTokenSharePerPublicPositionShareMap creates a map of public position share which contains targetDenom to calculate target denom value of public positions
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.LiquidStakingProxyAcc During liquid unstaking, btoken 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) GetProxyAccBalance ¶
func (Keeper) GetVoterBalanceByDenom ¶
func (k Keeper) GetVoterBalanceByDenom(ctx sdk.Context, votes govtypes.Votes) map[string]map[string]sdk.Int
GetVoterBalanceByDenom return map of balance amount of voter by denom
func (Keeper) GetVotingPower ¶
func (k Keeper) GetVotingPower(ctx sdk.Context, addr sdk.AccAddress) types.VotingPower
func (Keeper) GetWeightMap ¶
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
InitGenesis initializes the liquidstaking 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
func (Keeper) IsTombstoned ¶
func (Keeper) LiquidDelegate ¶
func (k Keeper) LiquidDelegate(ctx sdk.Context, proxyAcc sdk.AccAddress, activeVals types.ActiveLiquidValidators, stakingAmt sdk.Int, whitelistedValsMap types.WhitelistedValsMap) (newShares sdk.Dec, 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) (newShares sdk.Dec, bTokenMintAmount sdk.Int, err error)
LiquidStake mints bToken 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 sdk.Dec, checkMaxEntries bool, ) (time.Time, sdk.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, unstakingBtoken sdk.Coin, ) (time.Time, sdk.Int, []stakingtypes.UnbondingDelegation, sdk.Int, error)
LiquidUnstake burns unstakingBtoken and performs LiquidUnbond to active liquid validators with del shares worth of shares according to NetAmount with each validators current weight.
func (Keeper) Rebalance ¶
func (k Keeper) Rebalance(ctx sdk.Context, proxyAcc sdk.AccAddress, liquidVals types.LiquidValidators, whitelistedValsMap types.WhitelistedValsMap, rebalancingTrigger sdk.Dec) (redelegations []types.Redelegation)
Rebalance argument liquidVals containing ValidatorStatusActive which is containing just added on whitelist(liquidToken 0) and ValidatorStatusInactive to delist
func (Keeper) RemoveLiquidValidator ¶
func (k Keeper) RemoveLiquidValidator(ctx sdk.Context, val types.LiquidValidator)
RemoveLiquidValidator remove a liquid validator on kv store
func (Keeper) SetLiquidStakingVotingPowers ¶
func (Keeper) SetLiquidValidator ¶
func (k Keeper) SetLiquidValidator(ctx sdk.Context, val types.LiquidValidator)
SetLiquidValidator set the main record holding liquid validator details
func (Keeper) TokenAmountFromAMMPositions ¶
func (Keeper) TokenAmountFromFarmingPositions ¶
func (k Keeper) TokenAmountFromFarmingPositions(ctx sdk.Context, addr sdk.AccAddress, targetDenom string, tokenSharePerPoolCoinMap map[string]sdk.Dec) sdk.Int
TokenAmountFromFarmingPositions returns worth of staked tokens amount of exist farming positions including queued of the addr
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) UpdateLiquidValidatorSet ¶
func (k Keeper) UpdateLiquidValidatorSet(ctx sdk.Context) []types.Redelegation
func (Keeper) WithdrawLiquidRewards ¶
func (Keeper) WithdrawRewardsAndReStake ¶
func (k Keeper) WithdrawRewardsAndReStake(ctx sdk.Context, whitelistedValsMap types.WhitelistedValsMap)
WithdrawRewardsAndReStake withdraw rewards and re-staking when over threshold
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 ¶
func (k Querier) LiquidValidators(c context.Context, req *types.QueryLiquidValidatorsRequest) (*types.QueryLiquidValidatorsResponse, error)
LiquidValidators queries all liquid validators.
func (Querier) Params ¶
func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the parameters of the liquidstaking module.
func (Querier) States ¶
func (k Querier) States(c context.Context, req *types.QueryStatesRequest) (*types.QueryStatesResponse, error)
States queries states of liquid staking module.
func (Querier) VotingPower ¶
func (k Querier) VotingPower(c context.Context, req *types.QueryVotingPowerRequest) (*types.QueryVotingPowerResponse, error)
VotingPower queries voting power of staking, liquid staking module's for the voter.