keeper

package
v1.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeInflationParams added in v1.2.0

func MergeInflationParams(
	partial inflationtypes.MsgEditInflationParams,
	inflationParams inflationtypes.Params,
) (inflationtypes.Params, error)

MergeInflationParams: Takes the given Inflation params and merges them into the existing partial params, keeping any existing values that are not set in the partial.

func NewMsgServerImpl added in v1.2.0

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the inflation MsgServer interface for the provided Keeper.

func NewQuerier added in v1.2.0

func NewQuerier(keeper Keeper) types.QueryServer

NewQuerier returns an implementation of the oracle QueryServer interface for the provided Keeper.

Types

type Hooks

type Hooks struct {
	// contains filtered or unexported fields
}

Hooks wrapper struct for inflation keeper

func (Hooks) AfterEpochEnd

func (h Hooks) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber uint64)

func (Hooks) BeforeEpochStart

func (h Hooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber uint64)

epochs hooks

type Keeper

type Keeper struct {
	CurrentPeriod    collections.Sequence
	NumSkippedEpochs collections.Sequence
	Params           collections.Item[types.Params]
	// contains filtered or unexported fields
}

Keeper of the inflation store

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	paramspace paramstypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	distributionKeeper types.DistrKeeper,
	stakingKeeper types.StakingKeeper,
	sudoKeeper types.SudoKeeper,
	feeCollectorName string,
) Keeper

NewKeeper creates a new mint Keeper instance

func (Keeper) AfterEpochEnd

func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber uint64)

AfterEpochEnd mints and allocates coins at the end of each epoch. If inflation is disabled as a module parameter, the state for "NumSkippedEpochs" increments.

func (Keeper) AllocatePolynomialInflation added in v1.1.0

func (k Keeper) AllocatePolynomialInflation(
	ctx sdk.Context,
	mintedCoin sdk.Coin,
	params types.Params,
) (
	staking, strategic, community sdk.Coin,
	err error,
)

AllocatePolynomialInflation allocates coins from the inflation to external modules according to allocation proportions:

  • staking rewards -> sdk `auth` module fee collector
  • strategic reserves -> root account of x/sudo module
  • community pool -> `sdk `distr` module community pool

func (Keeper) BeforeEpochStart

func (k Keeper) BeforeEpochStart(_ sdk.Context, _ string, _ uint64)

BeforeEpochStart noop, We don't need to do anything here

func (Keeper) CirculatingSupply

CirculatingSupply returns the total supply in circulation excluding the team allocation in the first year

func (Keeper) EpochMintProvision

EpochMintProvision returns the EpochMintProvision of the inflation module.

func (Keeper) GetCirculatingSupply

func (k Keeper) GetCirculatingSupply(ctx sdk.Context, mintDenom string) sdkmath.Int

GetCirculatingSupply returns the bank supply of the mintDenom excluding the team allocation in the first year

func (Keeper) GetEpochMintProvision

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

GetEpochMintProvision retrieves necessary params KV storage and calculate EpochMintProvision

func (Keeper) GetEpochsPerPeriod added in v1.2.0

func (k Keeper) GetEpochsPerPeriod(ctx sdk.Context) (res uint64)

func (Keeper) GetInflationDistribution added in v1.2.0

func (k Keeper) GetInflationDistribution(ctx sdk.Context) (res types.InflationDistribution)

func (Keeper) GetInflationEnabled added in v1.2.0

func (k Keeper) GetInflationEnabled(ctx sdk.Context) (res bool)

func (Keeper) GetInflationRate

func (k Keeper) GetInflationRate(ctx sdk.Context, mintDenom string) sdk.Dec

GetInflationRate returns the inflation rate for the current period.

func (Keeper) GetParams

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

func (Keeper) GetPeriodsPerYear added in v1.2.0

func (k Keeper) GetPeriodsPerYear(ctx sdk.Context) (res uint64)

func (Keeper) GetPolynomialFactors added in v1.2.0

func (k Keeper) GetPolynomialFactors(ctx sdk.Context) (res []sdk.Dec)

func (Keeper) GetProportions

func (k Keeper) GetProportions(
	_ sdk.Context,
	coin sdk.Coin,
	proportion sdk.Dec,
) sdk.Coin

GetAllocationProportion calculates the proportion of coins that is to be allocated during inflation for a given distribution.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) InflationRate

InflationRate returns the inflation rate for the current period.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MintAndAllocateInflation

func (k Keeper) MintAndAllocateInflation(
	ctx sdk.Context,
	coins sdk.Coin,
	params types.Params,
) (
	staking, strategic, community sdk.Coin,
	err error,
)

MintAndAllocateInflation performs inflation minting and allocation

func (Keeper) MintCoins

func (k Keeper) MintCoins(ctx sdk.Context, coin sdk.Coin) error

MintCoins implements an alias call to the underlying supply keeper's MintCoins to be used in BeginBlocker.

func (Keeper) Period

Period returns the current period of the inflation module.

func (Keeper) SkippedEpochs

SkippedEpochs returns the number of skipped Epochs of the inflation module.

func (Keeper) Sudo added in v1.2.0

func (k Keeper) Sudo() sudoExtension

Sudo extends the Keeper with sudo functions. See sudo.go.

These Sudo functions should: 1. Not be called in other methods in the module. 2. Only be callable by the x/sudo root or sudo contracts.

The intention behind "Keeper.Sudo()" is to make it more obvious to the developer that an unsafe function is being used when it's called.

Jump to

Keyboard shortcuts

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