keeper

package
v12.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks

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

Hooks wrapper struct for incentives keeper

func (Hooks) AfterEpochEnd

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

func (Hooks) BeforeEpochStart

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

epochs hooks

type Keeper

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

Keeper of the inflation store

func NewKeeper

func NewKeeper(
	storeKey storetypes.StoreKey,
	cdc codec.BinaryCodec,
	authority sdk.AccAddress,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	dk types.DistrKeeper,
	sk types.StakingKeeper,
	feeCollectorName string,
) Keeper

NewKeeper creates a new mint Keeper instance

func (Keeper) AfterEpochEnd

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

AfterEpochEnd mints and allocates coins at the end of each epoch end

func (Keeper) AllocateExponentialInflation

func (k Keeper) AllocateExponentialInflation(
	ctx sdk.Context,
	mintedCoin sdk.Coin,
	params types.Params,
) (
	staking, incentives, communityPool sdk.Coins,
	err error,
)

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

  • staking rewards -> sdk `auth` module fee collector
  • usage incentives -> `x/incentives` module
  • community pool -> `sdk `distr` module community pool

func (Keeper) BeforeEpochStart

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

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

func (Keeper) BondedRatio

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

BondedRatio the fraction of the staking tokens which are currently bonded It doesn't consider team allocation for inflation

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) sdk.Dec

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

func (Keeper) GetEpochIdentifier

func (k Keeper) GetEpochIdentifier(ctx sdk.Context) string

GetEpochIdentifier gets the epoch identifier

func (Keeper) GetEpochMintProvision

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

GetEpochMintProvision retrieves necessary params KV storage and calculate EpochMintProvision

func (Keeper) GetEpochsPerPeriod

func (k Keeper) GetEpochsPerPeriod(ctx sdk.Context) int64

GetEpochsPerPeriod gets the epochs per period

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) (params types.Params)

GetParams returns the total set of inflation parameters.

func (Keeper) GetPeriod

func (k Keeper) GetPeriod(ctx sdk.Context) uint64

GetPeriod gets current period

func (Keeper) GetProportions

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

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

func (Keeper) GetSkippedEpochs

func (k Keeper) GetSkippedEpochs(ctx sdk.Context) uint64

GetSkippedEpochs gets the number of skipped epochs

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,
	coin sdk.Coin,
	params types.Params,
) (
	staking, incentives, communityPool sdk.Coins,
	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) Params

Params returns params of the mint module.

func (Keeper) Period

Period returns the current period of the inflation module.

func (Keeper) SetEpochIdentifier

func (k Keeper) SetEpochIdentifier(ctx sdk.Context, epochIdentifier string)

SetEpochsPerPeriod stores the epoch identifier

func (Keeper) SetEpochsPerPeriod

func (k Keeper) SetEpochsPerPeriod(ctx sdk.Context, epochsPerPeriod int64)

SetEpochsPerPeriod stores the epochs per period

func (Keeper) SetParams

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

SetParams sets the inflation params in a single key

func (Keeper) SetPeriod

func (k Keeper) SetPeriod(ctx sdk.Context, period uint64)

SetPeriod stores the current period

func (Keeper) SetSkippedEpochs

func (k Keeper) SetSkippedEpochs(ctx sdk.Context, skippedEpochs uint64)

SetSkippedEpochs stores the number of skipped epochs

func (Keeper) SkippedEpochs

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

func (Keeper) UpdateParams

UpdateParams defines a method for updating inflation params

type Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper, legacySubspace types.Subspace) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates the store from consensus version 1 to 2

func (Migrator) Migrate2to3

func (m Migrator) Migrate2to3(ctx sdk.Context) error

Migrate2to3 migrates the store from consensus version 2 to 3

Jump to

Keyboard shortcuts

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