keeper

package
v0.0.3-testnet.mage Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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 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) AccumulateAndMintInflation

func (k Keeper) AccumulateAndMintInflation(ctx sdk.Context) error

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) CumulativeInflation

func (k Keeper) CumulativeInflation(ctx sdk.Context) sdk.Dec

func (Keeper) GetParams

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

GetParams returns the total set of minting parameters.

func (Keeper) GetPreviousBlockTime

func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time)

GetPreviousBlockTime get the blocktime for the previous block

func (Keeper) GetStakingApy

func (k Keeper) GetStakingApy(ctx sdk.Context) sdk.Dec

GetStakingApy returns the APY minted for staking rewards

func (Keeper) Inflation

Inflation returns minter.Inflation of the mint module.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) Params

Params returns params of the mint module.

func (Keeper) SetParams

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

SetParams sets the total set of minting parameters.

func (Keeper) SetPreviousBlockTime

func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time)

SetPreviousBlockTime set the time of the previous block

type KeeperI

type KeeperI interface {
	AccumulateAndMintInflation(ctx sdk.Context) error
}

KeeperI is the required keeper interface for x/Magemint's begin blocker

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

AnnualProvisions is not implemented.

func (MintQueryServer) Inflation

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

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

func (m Minter) AccumulateInflation(secondsPassed uint64) (sdk.Coin, 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 `secondsPassed` seconds. `basis` is the base amount of coins that is inflated.

func (Minter) CalculateInflationRate

func (m Minter) CalculateInflationRate(secondsPassed uint64) (sdk.Dec, error)

CalculateInflationRate converts an APY into the factor corresponding with that APY's accumulation over a period of secondsPassed seconds.

Jump to

Keyboard shortcuts

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