Documentation ¶
Index ¶
- Constants
- func CalculateInflationRate(apy sdk.Dec, secondsPassed uint64) (sdk.Dec, error)
- type Keeper
- func (k Keeper) AccumulateInflation(ctx sdk.Context, rate sdk.Dec, basis sdk.Int, secondsSinceLastMint float64) (sdk.Coins, error)
- func (k Keeper) AddCollectedFees(ctx sdk.Context, fees sdk.Coins) error
- func (k Keeper) BondDenom(ctx sdk.Context) string
- func (k Keeper) CumulativeInflation(ctx sdk.Context) sdk.Dec
- func (k Keeper) FundCommunityPool(ctx sdk.Context, funds sdk.Coins) error
- 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) MintCoins(ctx sdk.Context, newCoins sdk.Coins) error
- 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)
- func (k Keeper) TotalBondedTokens(ctx sdk.Context) sdk.Int
- func (k Keeper) TotalSupply(ctx sdk.Context) sdk.Int
- 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)
Constants ¶
const (
SecondsPerYear = uint64(31536000)
)
this is the same value used in the x/hard
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the magemint 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 magemint Keeper instance
func (Keeper) AccumulateInflation ¶
func (k Keeper) AccumulateInflation( ctx sdk.Context, rate sdk.Dec, basis sdk.Int, secondsSinceLastMint float64, ) (sdk.Coins, error)
AccumulateInflation calculates the number of coins that should be minted to match a yearly `rate` for interest compounded each second of the year over `secondsSinceLastMint` seconds. `basis` is the base amount of coins that is inflated.
func (Keeper) AddCollectedFees ¶
AddCollectedFees implements an alias call to the underlying supply keeper's AddCollectedFees to be used in BeginBlocker.
func (Keeper) BondDenom ¶
BondDenom implements an alias call to the underlying staking keeper's BondDenom.
func (Keeper) FundCommunityPool ¶
FundCommunityPool implements an alias call to the underlying supply keeper's FundCommunityPool to be used in BeginBlocker.
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) MintCoins ¶
MintCoins implements an alias call to the underlying supply keeper's MintCoins to be used in BeginBlocker.
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params returns params of the mint module.
func (Keeper) SetPreviousBlockTime ¶
SetPreviousBlockTime set the time of the previous block
func (Keeper) TotalBondedTokens ¶
TotalBondedTokens implements an alias call to the underlying staking keeper's TotalBondedTokens to be used in BeginBlocker.
type KeeperI ¶
type KeeperI interface { GetParams(ctx sdk.Context) (params types.Params) SetParams(ctx sdk.Context, params types.Params) BondDenom(ctx sdk.Context) string TotalSupply(ctx sdk.Context) sdk.Int TotalBondedTokens(ctx sdk.Context) sdk.Int MintCoins(ctx sdk.Context, newCoins sdk.Coins) error AddCollectedFees(ctx sdk.Context, fees sdk.Coins) error FundCommunityPool(ctx sdk.Context, funds sdk.Coins) error GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time) CumulativeInflation(ctx sdk.Context) sdk.Dec AccumulateInflation( ctx sdk.Context, rate sdk.Dec, basis sdk.Int, secondsSinceLastMint float64, ) (sdk.Coins, error) }
type MintQueryServer ¶
type MintQueryServer struct {
// contains filtered or unexported fields
}
MintQueryServer implements cosmos sdk's x/mint querier. x/mint was removed from mage, but the standard inflation endpoint is still registered for easier third party integration and backwards compatibility.
func NewMintQueryServer ¶
func NewMintQueryServer(magemintKeeper 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/magemint 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.