Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQueryServerImpl(k Keeper) types.QueryServer
- type Keeper
- func (k Keeper) BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) (sdk.Dec, error)
- func (k Keeper) CalculateDerivativeSharesFromTokens(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, ...) (sdk.Int, sdk.Dec, error)
- func (k Keeper) CollectStakingRewards(ctx sdk.Context, validator sdk.ValAddress, destinationModAccount string) (sdk.Coins, error)
- func (k Keeper) CollectStakingRewardsByDenom(ctx sdk.Context, derivativeDenom string, destinationModAccount string) (sdk.Coins, error)
- func (k Keeper) DerivativeFromTokens(ctx sdk.Context, valAddr sdk.ValAddress, tokens sdk.Coin) (sdk.Coin, error)
- func (k Keeper) GetDerivativeValue(ctx sdk.Context, denom string) (sdk.Coin, error)
- func (k Keeper) GetLiquidStakingTokenDenom(valAddr sdk.ValAddress) string
- func (k Keeper) GetStakedTokensForDerivatives(ctx sdk.Context, coins sdk.Coins) (sdk.Coin, error)
- func (k Keeper) GetTotalDerivativeValue(ctx sdk.Context) (sdk.Coin, error)
- func (k Keeper) IsDerivativeDenom(ctx sdk.Context, denom string) bool
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) (sdk.Coin, error)
- func (k Keeper) TransferDelegation(ctx sdk.Context, valAddr sdk.ValAddress, ...) (sdk.Dec, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the liquid MsgServer interface for the provided Keeper.
func NewQueryServerImpl ¶
func NewQueryServerImpl(k Keeper) types.QueryServer
NewQueryServerImpl creates a new server for handling gRPC queries.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper struct for the liquid module.
func NewDefaultKeeper ¶
func NewDefaultKeeper( cdc codec.Codec, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, dk types.DistributionKeeper, ) Keeper
NewDefaultKeeper returns a new keeper for the liquid module with default values.
func NewKeeper ¶
func NewKeeper( cdc codec.Codec, ak types.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, dk types.DistributionKeeper, derivativeDenom string, ) Keeper
NewKeeper returns a new keeper for the liquid module.
func (Keeper) BurnDerivative ¶
func (k Keeper) BurnDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Dec, error)
BurnDerivative burns an user's staking derivative coins and returns them an equivalent staking delegation.
The derivative coins are burned, and an equivalent number of shares in the module's staking delegation are transferred back to the user.
func (Keeper) CalculateDerivativeSharesFromTokens ¶
func (k Keeper) CalculateDerivativeSharesFromTokens(ctx sdk.Context, delegator sdk.AccAddress, validator sdk.ValAddress, tokens sdk.Int) (sdk.Int, sdk.Dec, error)
CalculateDerivativeSharesFromTokens converts a staking token amount into its equivalent delegation shares, and staking derivative amount. This combines the code for calculating the shares to be transferred, and the derivative coins to be minted.
func (Keeper) CollectStakingRewards ¶
func (Keeper) CollectStakingRewardsByDenom ¶
func (Keeper) DerivativeFromTokens ¶
func (k Keeper) DerivativeFromTokens(ctx sdk.Context, valAddr sdk.ValAddress, tokens sdk.Coin) (sdk.Coin, error)
DerivativeFromTokens calculates the approximate amount of derivative coins that would be minted for a given amount of staking tokens.
func (Keeper) GetDerivativeValue ¶
GetDerivativeValue returns the total underlying value of the provided derivative denominated by the bond token (ufury).
func (Keeper) GetLiquidStakingTokenDenom ¶
func (k Keeper) GetLiquidStakingTokenDenom(valAddr sdk.ValAddress) string
func (Keeper) GetStakedTokensForDerivatives ¶
GetStakedTokensForDerivatives returns the total value of the provided derivatives in staked tokens, accounting for the specific share prices.
func (Keeper) GetTotalDerivativeValue ¶
GetTotalDerivativeValue returns the total sum value of all derivative coins for all validators denominated by the bond token (ufury).
func (Keeper) IsDerivativeDenom ¶
IsDerivativeDenom returns true if the denom is a valid derivative denom and corresponds to a valid validator.
func (Keeper) MintDerivative ¶
func (k Keeper) MintDerivative(ctx sdk.Context, delegatorAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) (sdk.Coin, error)
MintDerivative removes a user's staking delegation and mints them equivalent staking derivative coins.
The input staking token amount is used to calculate shares in the user's delegation, which are transferred to a delegation owned by the module. Derivative coins are them minted and transferred to the user.
func (Keeper) TransferDelegation ¶
func (k Keeper) TransferDelegation(ctx sdk.Context, valAddr sdk.ValAddress, fromDelegator, toDelegator sdk.AccAddress, shares sdk.Dec) (sdk.Dec, error)
TransferDelegation moves some delegation shares between addresses, while keeping the same validator.
Internally shares are unbonded, tokens moved then bonded again. This limits only vested tokens from being transferred. The sending delegation must not have any active redelegations. A validator cannot reduce self delegated shares below its min self delegation. Attempting to transfer zero shares will error.