Documentation ¶
Index ¶
- Constants
- type Keeper
- func (k Keeper) AccumulateAndMintInflation(ctx sdk.Context) error
- func (k Keeper) CumulativeInflation(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time)
- func (k Keeper) GetStakingApy(ctx sdk.Context) sdk.Dec
- func (k Keeper) Inflation(c context.Context, _ *types.QueryInflationRequest) (*types.QueryInflationResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time)
- type KeeperI
- type MintQueryServer
- func (MintQueryServer) AnnualProvisions(_ context.Context, _ *minttypes.QueryAnnualProvisionsRequest) (*minttypes.QueryAnnualProvisionsResponse, error)
- func (mq MintQueryServer) Inflation(c context.Context, _ *minttypes.QueryInflationRequest) (*minttypes.QueryInflationResponse, error)
- func (MintQueryServer) Params(_ context.Context, _ *minttypes.QueryParamsRequest) (*minttypes.QueryParamsResponse, error)
- type Minter
Constants ¶
const (
SecondsPerYear = uint64(31536000)
)
this is the same value used in the x/hard
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the kavamint store
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace, sk types.StakingKeeper, ak types.AccountKeeper, bk types.BankKeeper, stakingRewardsFeeCollectorName string, communityPoolModuleAccountName string, ) Keeper
NewKeeper creates a new kavamint Keeper instance
func (Keeper) AccumulateAndMintInflation ¶
AccumulateAndMintInflation defines the sources of inflation, determines the seconds passed since the last mint, and then mints each source of inflation to the defined destination.
func (Keeper) GetPreviousBlockTime ¶
GetPreviousBlockTime get the blocktime for the previous block
func (Keeper) GetStakingApy ¶
GetStakingApy returns the APY minted for staking rewards
func (Keeper) Inflation ¶
func (k Keeper) Inflation(c context.Context, _ *types.QueryInflationRequest) (*types.QueryInflationResponse, error)
Inflation returns minter.Inflation of the mint module.
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params returns params of the mint module.
type MintQueryServer ¶
type MintQueryServer struct {
// contains filtered or unexported fields
}
MintQueryServer implements cosmos sdk's x/mint querier. x/mint was removed from kava, but the standard inflation endpoint is still registered for easier third party integration and backwards compatibility.
func NewMintQueryServer ¶
func NewMintQueryServer(kavamintKeeper Keeper) MintQueryServer
NewMintQueryServer returns a service that implements x/mint's QueryServer
func (MintQueryServer) AnnualProvisions ¶
func (MintQueryServer) AnnualProvisions( _ context.Context, _ *minttypes.QueryAnnualProvisionsRequest, ) (*minttypes.QueryAnnualProvisionsResponse, error)
AnnualProvisions is not implemented.
func (MintQueryServer) Inflation ¶
func (mq MintQueryServer) Inflation( c context.Context, _ *minttypes.QueryInflationRequest, ) (*minttypes.QueryInflationResponse, error)
Inflation returns an adjusted inflation rate. The `/cosmos/mint/v1beta1/inflation` endpoint is used by third parties to calculate staking APY. The usual staking APY calculation takes the inflation and determines the portion of it devoted to staking rewards after adjusting for the bonded ratio and x/distribution community_tax. staking_apy = (inflation - community_tax) * total_supply / total_bonded Staking APY is not set directly via the x/kavamint staking_rewards_apy param. This endpoint returns the inflation that makes the above calculation equal to the param: inflation = staking_apy * total_bonded / total_supply NOTE: assumes x/distribution community_tax = 0
func (MintQueryServer) Params ¶
func (MintQueryServer) Params( _ context.Context, _ *minttypes.QueryParamsRequest, ) (*minttypes.QueryParamsResponse, error)
Params is not implemented. There is no mint module.
type Minter ¶
type Minter struct {
// contains filtered or unexported fields
}
Minter wraps the logic of a single source of inflation. It calculates the amount of coins to be minted to match a yearly `rate` of inflating the `basis`.
func NewMinter ¶
func NewMinter( name string, rate sdk.Dec, basis sdk.Int, mintDenom string, destMaccName string, ) Minter
NewMinter returns creates a new source of minting inflation
func (Minter) AccumulateInflation ¶
AccumulateInflation calculates the number of coins that should be minted to match a yearly `rate` for interest compounded each second of the year over `secondsPassed` seconds. `basis` is the base amount of coins that is inflated.