Documentation ¶
Index ¶
- func GetCappedTargetEmissionPerUnitStakedToken(targetRewardEmissionPerUnitStakedToken math.LegacyDec, ...) math.LegacyDec
- func GetCirculatingSupply(ctx context.Context, k types.MintKeeper, params types.Params, ...) (circulatingSupply, totalSupply, lockedVestingTokens, ecosystemLocked math.Int, ...)
- func GetEmissionPerMonth(ctx sdk.Context, k Keeper, blockHeight uint64, blocksPerMonth uint64, ...) (emissionPerMonth math.Int, emissionPerUnitStakedToken math.LegacyDec, ...)
- func GetExponentialMovingAverage(targetRewardEmissionPerUnitStakedToken math.LegacyDec, ...) math.LegacyDec
- func GetLockedVestingTokens(blocksPerMonth uint64, blockHeight math.Int, params types.Params) (total, preseedInvestors, investors, team math.Int)
- func GetMaximumMonthlyEmissionPerUnitStakedToken(maximumMonthlyPercentageYield math.LegacyDec, ...) math.LegacyDec
- func GetNumStakedTokens(ctx context.Context, k types.MintKeeper) (math.Int, error)
- func GetTargetRewardEmissionPerUnitStakedToken(fEmission math.LegacyDec, ecosystemLocked math.Int, networkStaked math.Int, ...) (math.LegacyDec, error)
- func GetTotalEmissionPerMonth(rewardEmissionPerUnitStakedToken math.LegacyDec, numStakedTokens math.Int) math.Int
- func NewMsgServerImpl(k Keeper) types.MsgServiceServer
- func NewQueryServerImpl(k Keeper) types.QueryServer
- func RecalculateTargetEmission(ctx sdk.Context, k Keeper, blockHeight uint64, blocksPerMonth uint64, ...) (blockEmission math.Int, emissionPerUnitStakedToke math.LegacyDec, err error)
- type Keeper
- func (k Keeper) AddEcosystemTokensMinted(ctx context.Context, minted math.Int) error
- func (k Keeper) CosmosValidatorStakedSupply(ctx context.Context) (math.Int, error)
- func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState
- func (k Keeper) GetBinaryCodec() codec.BinaryCodec
- func (k Keeper) GetEcosystemBalance(ctx context.Context, mintDenom string) (math.Int, error)
- func (k Keeper) GetEcosystemMintSupplyRemaining(ctx context.Context, params types.Params) (math.Int, error)
- func (k Keeper) GetEmissionsKeeperTotalStake(ctx context.Context) (math.Int, error)
- func (k Keeper) GetParams(ctx context.Context) (types.Params, error)
- func (k Keeper) GetParamsBlocksPerMonth(ctx context.Context) (uint64, error)
- func (k Keeper) GetPreviousPercentageRewardToStakedReputers(ctx context.Context) (math.LegacyDec, error)
- func (k Keeper) GetPreviousRewardEmissionPerUnitStakedToken(ctx context.Context) (math.LegacyDec, error)
- func (k Keeper) GetStorageService() storetypes.KVStoreService
- func (k Keeper) GetTotalCurrTokenSupply(ctx context.Context) sdk.Coin
- func (k Keeper) GetValidatorsVsAlloraPercentReward(ctx context.Context) (alloraMath.Dec, error)
- func (k Keeper) InitGenesis(ctx context.Context, ak types.AccountKeeper, data *types.GenesisState)
- func (k Keeper) IsWhitelistAdmin(ctx context.Context, admin string) (bool, error)
- func (k Keeper) Logger(ctx context.Context) log.Logger
- func (k Keeper) MintCoins(ctx context.Context, newCoins sdk.Coins) error
- func (k Keeper) MoveCoinsFromMintToEcosystem(ctx context.Context, mintedCoins sdk.Coins) error
- func (k Keeper) PayAlloraRewardsFromEcosystem(ctx context.Context, rewards sdk.Coins) error
- func (k Keeper) PayValidatorsFromEcosystem(ctx context.Context, rewards sdk.Coins) error
- func (k Keeper) SetEmissionsParamsBlocksPerMonth(ctx context.Context, blocksPerMonth uint64) error
- func (k Keeper) SetRewardCurrentBlockEmission(ctx context.Context, emission math.Int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCappedTargetEmissionPerUnitStakedToken ¶ added in v0.2.6
func GetCappedTargetEmissionPerUnitStakedToken( targetRewardEmissionPerUnitStakedToken math.LegacyDec, maximumMonthlyEmissionPerUnitStakedToken math.LegacyDec, ) math.LegacyDec
Target Monthly Emission Per Unit Staked Token is the capped value of either the computed target for this timestep, or simply the maximum allowable emission per unit staked token ^e_i = min(^e_{target,i}, ^e_{max,i})
func GetCirculatingSupply ¶ added in v0.4.0
func GetCirculatingSupply( ctx context.Context, k types.MintKeeper, params types.Params, blockHeight uint64, blocksPerMonth uint64, ) ( circulatingSupply, totalSupply, lockedVestingTokens, ecosystemLocked math.Int, err error, )
return the circulating supply of tokens
func GetEmissionPerMonth ¶ added in v0.5.0
func GetEmissionPerMonth( ctx sdk.Context, k Keeper, blockHeight uint64, blocksPerMonth uint64, params types.Params, ecosystemBalance math.Int, ecosystemMintSupplyRemaining math.Int, validatorsPercent math.LegacyDec, ) ( emissionPerMonth math.Int, emissionPerUnitStakedToken math.LegacyDec, err error, )
GetEmissionPerMonth calculates the emission per month for the network
func GetExponentialMovingAverage ¶ added in v0.2.6
func GetExponentialMovingAverage( targetRewardEmissionPerUnitStakedToken math.LegacyDec, alphaEmission math.LegacyDec, previousRewardEmissionPerUnitStakedToken math.LegacyDec, ) math.LegacyDec
Reward Emission Per Unit Staked Token is an exponential moving average over the Target Reward Emission Per Unit Staked Token e_i = α_e * ^e_i + (1 − α_e)*e_{i−1}
func GetLockedVestingTokens ¶ added in v0.3.0
func GetLockedVestingTokens( blocksPerMonth uint64, blockHeight math.Int, params types.Params, ) (total, preseedInvestors, investors, team math.Int)
return the uncirculating supply, i.e. tokens on a vesting schedule these tokens will be custodied by a centralized actor off chain. this function returns the circulating supply based off of what the agreements off chain say were supposed to happen for token lockup
func GetMaximumMonthlyEmissionPerUnitStakedToken ¶ added in v0.2.6
func GetMaximumMonthlyEmissionPerUnitStakedToken( maximumMonthlyPercentageYield math.LegacyDec, reputersPercentOfTopicRewards math.LegacyDec, validatorsPercent math.LegacyDec, ) math.LegacyDec
maximum monthly emission per unit staked token given a maximum monthly percentage yield ^e_{max,i} = Xi_max / f_{stakers} where Xi_{max} is the maximum MPY, and f_{stakers} is the fraction of the total token emission during the previous epoch that was paid to reward staking network participants, i.e. reputers and network validators
func GetNumStakedTokens ¶ added in v0.2.6
helper function to get the number of staked tokens on the network includes both tokens staked by cosmos validators (cosmos staking) and tokens staked by reputers (allora staking)
func GetTargetRewardEmissionPerUnitStakedToken ¶ added in v0.2.6
func GetTargetRewardEmissionPerUnitStakedToken( fEmission math.LegacyDec, ecosystemLocked math.Int, networkStaked math.Int, circulatingSupply math.Int, maxSupply math.Int, ) (math.LegacyDec, error)
Target Reward Emission Per Unit Staked Token controls the inflation rate of the token issuance
^e_i = ((f_e*T_{total,i}) / N_{staked,i}) * (N_{circ,i} / N_{total,i})
f_e is a global tuning constant, by default f_e = 0.015 month^{−1} represents the fraction of the ecosystem treasury that would ideally be emitted per unit time. T_{total,i} = number of tokens that the ecosystem bucket can still mint PLUS the current balance of the bucket. The ecosystem bucket is capped to be able to mint by default 36.75% of the max supply, but as more tokens are minted the amount the ecosystem is permitted to mint decreases. N_{staked,i} is the total number of tokens staked on the network at timestep i N_{circ,i} is the number of tokens in circulation at timestep i N_{total,i} is the total number of tokens ever allowed to exist
func GetTotalEmissionPerMonth ¶ added in v0.2.6
func GetTotalEmissionPerMonth( rewardEmissionPerUnitStakedToken math.LegacyDec, numStakedTokens math.Int, ) math.Int
The total amount of tokens emitted for a full month \cal E_i = e_i*N_{staked,i} where e_i is the emission per unit staked token and N_{staked,i} is the total amount of tokens staked at timestep i THIS FUNCTION TRUNCATES THE RESULT DIVISION TO AN INTEGER
func NewMsgServerImpl ¶
func NewMsgServerImpl(k Keeper) types.MsgServiceServer
NewMsgServerImpl returns an implementation of the x/mint MsgServer interface.
func NewQueryServerImpl ¶
func NewQueryServerImpl(k Keeper) types.QueryServer
func RecalculateTargetEmission ¶ added in v0.5.0
func RecalculateTargetEmission( ctx sdk.Context, k Keeper, blockHeight uint64, blocksPerMonth uint64, moduleParams types.Params, ecosystemBalance math.Int, ecosystemMintSupplyRemaining math.Int, validatorsPercent math.LegacyDec, ) ( blockEmission math.Int, emissionPerUnitStakedToke math.LegacyDec, err error, )
RecalculateTargetEmission recalculates the target emission for the network It writes the old emission rates to the store for PreviousRewardEmissionPerUnitStakedToken and PreviousBlockEmission Then it calculates the new target emission rate returns that, and the block emission we should mint/send for this block
Types ¶
type Keeper ¶
type Keeper struct { Schema collections.Schema Params collections.Item[types.Params] PreviousRewardEmissionPerUnitStakedToken collections.Item[math.LegacyDec] PreviousBlockEmission collections.Item[math.Int] EcosystemTokensMinted collections.Item[math.Int] // contains filtered or unexported fields }
Keeper of the mint store
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService storetypes.KVStoreService, sk types.StakingKeeper, ak types.AccountKeeper, bk types.BankKeeper, ek types.EmissionsKeeper, feeCollectorName string, ) Keeper
NewKeeper creates a new mint Keeper instance
func (Keeper) AddEcosystemTokensMinted ¶ added in v0.2.6
This function increases the ledger that tracks the total tokens minted by the ecosystem treasury over the life of the blockchain.
func (Keeper) CosmosValidatorStakedSupply ¶ added in v0.2.6
StakingTokenSupply implements an alias call to the underlying staking keeper's StakingTokenSupply to be used in BeginBlocker.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx context.Context) *types.GenesisState
ExportGenesis returns a GenesisState for a given context and keeper.
func (Keeper) GetBinaryCodec ¶ added in v0.3.0
func (k Keeper) GetBinaryCodec() codec.BinaryCodec
getter for the binary codec
func (Keeper) GetEcosystemBalance ¶ added in v0.2.6
returns the quantity of tokens currently stored in the "ecosystem" module account this module account is paid by inference requests and is drained by this mint module when forwarding rewards to fee collector and allorarewards accounts
func (Keeper) GetEcosystemMintSupplyRemaining ¶ added in v0.4.0
func (k Keeper) GetEcosystemMintSupplyRemaining( ctx context.Context, params types.Params, ) (math.Int, error)
How many tokens are left that the ecosystem bucket is allowed to mint?
func (Keeper) GetEmissionsKeeperTotalStake ¶ added in v0.3.0
wrapper for interface compatibility for unit testing
func (Keeper) GetParamsBlocksPerMonth ¶ added in v0.2.6
wrapper around emissions keeper call to get the number of blocks expected in a month
func (Keeper) GetPreviousPercentageRewardToStakedReputers ¶ added in v0.2.6
func (k Keeper) GetPreviousPercentageRewardToStakedReputers(ctx context.Context) (math.LegacyDec, error)
The last time we paid out rewards, what was the percentage of those rewards that went to staked reputers (as opposed to forecaster workers and inferrer workers)
func (Keeper) GetPreviousRewardEmissionPerUnitStakedToken ¶ added in v0.3.0
func (k Keeper) GetPreviousRewardEmissionPerUnitStakedToken(ctx context.Context) (math.LegacyDec, error)
wrapper for interface compatibility for unit testing
func (Keeper) GetStorageService ¶ added in v0.3.0
func (k Keeper) GetStorageService() storetypes.KVStoreService
getter for the storage service
func (Keeper) GetTotalCurrTokenSupply ¶ added in v0.2.6
GetTotalCurrTokenSupply implements an alias call to the underlying supply keeper's GetTotalCurrTokenSupply to be used in BeginBlocker.
func (Keeper) GetValidatorsVsAlloraPercentReward ¶ added in v0.2.6
What split of the rewards should be given to cosmos validators vs allora participants (reputers, forecaster workers, inferrer workers)
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx context.Context, ak types.AccountKeeper, data *types.GenesisState)
InitGenesis new mint genesis
func (Keeper) IsWhitelistAdmin ¶ added in v0.2.6
wrapper around emissions keeper call to get if whitelist admin
func (Keeper) MintCoins ¶
MintCoins implements an alias call to the underlying supply keeper's MintCoins to be used in BeginBlocker.
func (Keeper) MoveCoinsFromMintToEcosystem ¶ added in v0.2.6
MoveCoinsFromMintToEcosystem moves freshly minted tokens from the mint module which has permissions to create new tokens, to the ecosystem account which only has permissions to hold tokens.
func (Keeper) PayAlloraRewardsFromEcosystem ¶ added in v0.2.6
PayAlloraRewardsFromEcosystem sends funds from the ecosystem treasury account to the allora reward payout account used in the emissions module PayAlloraRewardsFromEcosystem to be used in BeginBlocker.
func (Keeper) PayValidatorsFromEcosystem ¶ added in v0.2.6
PayValidatorsFromEcosystem sends funds from the ecosystem treasury account to the cosmos network validators rewards account (fee collector) PayValidatorsFromEcosystem to be used in BeginBlocker.
func (Keeper) SetEmissionsParamsBlocksPerMonth ¶ added in v0.5.0
wrapper around emissions keeper call to set the number of blocks expected in a month