Documentation ¶
Index ¶
- func MergeInflationParams(partial inflationtypes.MsgEditInflationParams, ...) (inflationtypes.Params, error)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper) types.QueryServer
- type Hooks
- type Keeper
- func (k Keeper) AllocatePolynomialInflation(ctx sdk.Context, mintedCoin sdk.Coin, params types.Params) (staking, strategic, community sdk.Coin, err error)
- func (k Keeper) Burn(ctx sdk.Context, coins sdk.Coins, sender sdk.AccAddress) error
- func (k Keeper) CirculatingSupply(c context.Context, _ *types.QueryCirculatingSupplyRequest) (*types.QueryCirculatingSupplyResponse, error)
- func (k Keeper) EpochMintProvision(c context.Context, _ *types.QueryEpochMintProvisionRequest) (*types.QueryEpochMintProvisionResponse, error)
- func (k Keeper) GetCirculatingSupply(ctx sdk.Context, mintDenom string) sdkmath.Int
- func (k Keeper) GetEpochMintProvision(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetEpochsPerPeriod(ctx sdk.Context) (res uint64)
- func (k Keeper) GetInflationDistribution(ctx sdk.Context) (res types.InflationDistribution)
- func (k Keeper) GetInflationEnabled(ctx sdk.Context) (res bool)
- func (k Keeper) GetInflationRate(ctx sdk.Context, mintDenom string) sdk.Dec
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPeriodsPerYear(ctx sdk.Context) (res uint64)
- func (k Keeper) GetPolynomialFactors(ctx sdk.Context) (res []sdk.Dec)
- func (k Keeper) GetProportions(_ sdk.Context, coin sdk.Coin, proportion sdk.Dec) sdk.Coin
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InflationRate(c context.Context, _ *types.QueryInflationRateRequest) (*types.QueryInflationRateResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintAndAllocateInflation(ctx sdk.Context, coins sdk.Coin, params types.Params) (staking, strategic, community sdk.Coin, err error)
- func (k Keeper) MintCoins(ctx sdk.Context, coin sdk.Coin) error
- func (k Keeper) Period(c context.Context, _ *types.QueryPeriodRequest) (*types.QueryPeriodResponse, error)
- func (k Keeper) SkippedEpochs(c context.Context, _ *types.QuerySkippedEpochsRequest) (*types.QuerySkippedEpochsResponse, error)
- func (k Keeper) Sudo() sudoExtension
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeInflationParams ¶
func MergeInflationParams( partial inflationtypes.MsgEditInflationParams, inflationParams inflationtypes.Params, ) (inflationtypes.Params, error)
MergeInflationParams: Performs a partial struct update using [partial] and merges its params into the existing [inflationParams], keeping any existing values that are not set in the partial. For use with [Keeper.EditInflationParams].
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the inflation MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(keeper Keeper) types.QueryServer
NewQuerier returns an implementation of the types.QueryServer interface for the provided Keeper.
Types ¶
type Hooks ¶
type Hooks struct {
K Keeper
}
Hooks implements module-specific calls (epochstypes.EpochHooks) that will occur at the end of every epoch. Hooks is meant for use with `EpochsKeeper.SetHooks`. These functions run outside the normal body of transactions.
func (Hooks) AfterEpochEnd ¶
AfterEpochEnd is a hook that runs just prior to the first block whose timestamp is after the end of an epoch duration. AfterEpochEnd mints and allocates coins at the end of each epoch. If inflation is disabled as a module parameter, the state for "NumSkippedEpochs" increments.
type Keeper ¶
type Keeper struct { // CurrentPeriod: Strictly increasing counter for the inflation "period". CurrentPeriod collections.Sequence // NumSkippedEpochs: Strictly increasing counter for the number of skipped // epochs. Inflation epochs are skipped when [types.Params.InflationEnabled] // is false so that gaps in the active status of inflation don't mess up the // polynomial computation. It allows inflation to smoothly be toggled on and // off. NumSkippedEpochs collections.Sequence // Params stores module-specific parameters that specify the blockchain token // economics, token release schedule, maximum supply, and whether or not // inflation is enabled on the network. Params collections.Item[types.Params] // contains filtered or unexported fields }
Keeper of the inflation module. Keepers are module-specific "gate keepers" responsible for encapsulating access to the key-value stores (state) of the network. The functions on the Keeper contain all the business logic for reading and modifying state.
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) AllocatePolynomialInflation ¶
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 proportions:
Returns:
- staking: Tokens minted for staking inflation that go to the decentralized validator set and delegators. This is handled by the `auth` module fee collector.
- strategic: Tokens minted to the Strategic Reserve, the root account fo the x/sudo module.
- community: Tokens minted to the Community Pool, which is managed strictly by on-chain governance.
func (Keeper) CirculatingSupply ¶
func (k Keeper) CirculatingSupply( c context.Context, _ *types.QueryCirculatingSupplyRequest, ) (*types.QueryCirculatingSupplyResponse, error)
CirculatingSupply returns the total supply in circulation excluding the team allocation in the first year
func (Keeper) EpochMintProvision ¶
func (k Keeper) EpochMintProvision( c context.Context, _ *types.QueryEpochMintProvisionRequest, ) (*types.QueryEpochMintProvisionResponse, error)
EpochMintProvision returns the EpochMintProvision of the inflation module.
func (Keeper) GetCirculatingSupply ¶
GetCirculatingSupply returns the bank supply of the mintDenom excluding the team allocation in the first year
func (Keeper) GetEpochMintProvision ¶
GetEpochMintProvision retrieves necessary params KV storage and calculate EpochMintProvision
func (Keeper) GetInflationDistribution ¶
func (k Keeper) GetInflationDistribution(ctx sdk.Context) (res types.InflationDistribution)
func (Keeper) GetInflationRate ¶
GetInflationRate returns the inflation rate for the current period.
func (Keeper) GetPolynomialFactors ¶
func (Keeper) GetProportions ¶
GetAllocationProportion calculates the proportion of coins that is to be allocated during inflation for a given distribution.
func (Keeper) Hooks ¶
Hooks implements module-speecific calls that will occur in the ABCI BeginBlock logic.
func (Keeper) InflationRate ¶
func (k Keeper) InflationRate( c context.Context, _ *types.QueryInflationRateRequest, ) (*types.QueryInflationRateResponse, error)
InflationRate returns the inflation rate for the current period.
func (Keeper) MintAndAllocateInflation ¶
func (k Keeper) MintAndAllocateInflation( ctx sdk.Context, coins sdk.Coin, params types.Params, ) ( staking, strategic, community sdk.Coin, err error, )
MintAndAllocateInflation mints and allocates tokens based on the polynomial inflation coefficients and current block height.
Args:
- coins: Tokens to be minted.
- params:
Returns:
- staking: Tokens minted for staking inflation that go to the decentralized validator set and delegators. This is handled by the `auth` module fee collector.
- strategic: Tokens minted to the Strategic Reserve, the root account fo the x/sudo module.
- community: Tokens minted to the Community Pool, which is managed strictly by on-chain governance.
func (Keeper) Period ¶
func (k Keeper) Period( c context.Context, _ *types.QueryPeriodRequest, ) (*types.QueryPeriodResponse, error)
Period returns the current period of the inflation module.
func (Keeper) SkippedEpochs ¶
func (k Keeper) SkippedEpochs( c context.Context, _ *types.QuerySkippedEpochsRequest, ) (*types.QuerySkippedEpochsResponse, error)
SkippedEpochs returns the number of skipped Epochs of the inflation module.
func (Keeper) Sudo ¶
func (k Keeper) Sudo() sudoExtension
Sudo extends the Keeper with sudo functions. See x/sudo.
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. x/sudo: https://pkg.go.dev/github.com/NibiruChain/nibiru@v1.1.0/x/sudo/keeper