Documentation ¶
Index ¶
- Constants
- Variables
- func ParamKeyTable() params.KeyTable
- func ValidateGenesis(data GenesisState) error
- func ValidateMinter(minter Minter) error
- type GenesisState
- type Minter
- func (m Minter) BlockProvision(params Params) sdk.Coin
- func (*Minter) Descriptor() ([]byte, []int)
- func (m *Minter) Marshal() (dAtA []byte, err error)
- func (m *Minter) MarshalTo(dAtA []byte) (int, error)
- func (m *Minter) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (m Minter) NextAnnualProvisions(_ Params, totalSupply sdk.Int) sdk.Dec
- func (m Minter) NextInflationRate(params Params, bondedRatio sdk.Dec) sdk.Dec
- func (*Minter) ProtoMessage()
- func (m *Minter) Reset()
- func (m *Minter) Size() (n int)
- func (m *Minter) String() string
- func (m *Minter) Unmarshal(dAtA []byte) error
- func (m *Minter) XXX_DiscardUnknown()
- func (m *Minter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Minter) XXX_Merge(src proto.Message)
- func (m *Minter) XXX_Size() int
- func (m *Minter) XXX_Unmarshal(b []byte) error
- type Params
- func (*Params) Descriptor() ([]byte, []int)
- func (m *Params) GetBlocksPerYear() uint64
- func (m *Params) GetMintDenom() string
- func (m *Params) Marshal() (dAtA []byte, err error)
- func (m *Params) MarshalTo(dAtA []byte) (int, error)
- func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (p *Params) ParamSetPairs() params.ParamSetPairs
- func (*Params) ProtoMessage()
- func (m *Params) Reset()
- func (m *Params) Size() (n int)
- func (p Params) String() string
- func (m *Params) Unmarshal(dAtA []byte) error
- func (p Params) Validate() error
- func (m *Params) XXX_DiscardUnknown()
- func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Params) XXX_Merge(src proto.Message)
- func (m *Params) XXX_Size() int
- func (m *Params) XXX_Unmarshal(b []byte) error
- type StakingKeeper
- type SupplyKeeper
Constants ¶
const ( EventTypeMint = ModuleName AttributeKeyBondedRatio = "bonded_ratio" AttributeKeyInflation = "inflation" AttributeKeyAnnualProvisions = "annual_provisions" )
Minting module event types
const ( // module name ModuleName = "mint" // default paramspace for params keeper DefaultParamspace = ModuleName // StoreKey is the default store key for mint StoreKey = ModuleName // QuerierRoute is the querier route for the minting store. QuerierRoute = StoreKey // Query endpoints supported by the minting querier QueryParameters = "parameters" QueryInflation = "inflation" QueryAnnualProvisions = "annual_provisions" )
nolint
Variables ¶
var ( KeyMintDenom = []byte("MintDenom") KeyInflationRateChange = []byte("InflationRateChange") KeyInflationMax = []byte("InflationMax") KeyInflationMin = []byte("InflationMin") KeyGoalBonded = []byte("GoalBonded") KeyBlocksPerYear = []byte("BlocksPerYear") )
Parameter store keys
var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") )
var MinterKey = []byte{0x00}
the one key to use for the keeper store
var ( // ModuleCdc references the global x/mint module codec. Note, the codec // should ONLY be used in certain instances of tests and for JSON encoding as // Amino is still used for that purpose. // // The actual codec used for serialization should be provided to x/mint and // defined at the application level. ModuleCdc = codec.NewHybridCodec(amino) )
Functions ¶
func ParamKeyTable ¶
ParamKeyTable ParamTable for minting module.
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the provided genesis state to ensure the expected invariants holds.
Types ¶
type GenesisState ¶
type GenesisState struct { Minter Minter `json:"minter" yaml:"minter"` // minter object Params Params `json:"params" yaml:"params"` // inflation params }
GenesisState - minter state
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState creates a default GenesisState object
func NewGenesisState ¶
func NewGenesisState(minter Minter, params Params) GenesisState
NewGenesisState creates a new GenesisState object
type Minter ¶
type Minter struct { // current annual inflation rate Inflation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=inflation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation"` // current annual expected provisions AnnualProvisions github_com_cosmos_cosmos_sdk_types.Dec `` /* 174-byte string literal not displayed */ }
Minter represents the minting state.
func DefaultInitialMinter ¶
func DefaultInitialMinter() Minter
DefaultInitialMinter returns a default initial Minter object for a new chain which uses an inflation rate of 13%.
func InitialMinter ¶
InitialMinter returns an initial Minter object with a given inflation value.
func NewMinter ¶
NewMinter returns a new Minter object with the given inflation and annual provisions values.
func (Minter) BlockProvision ¶
BlockProvision returns the provisions for a block based on the annual provisions rate.
func (*Minter) Descriptor ¶
func (*Minter) MarshalToSizedBuffer ¶
func (Minter) NextAnnualProvisions ¶
NextAnnualProvisions returns the annual provisions based on current total kusupply and inflation rate.
func (Minter) NextInflationRate ¶
NextInflationRate returns the new inflation rate for the next hour.
func (*Minter) ProtoMessage ¶
func (*Minter) ProtoMessage()
func (*Minter) XXX_DiscardUnknown ¶
func (m *Minter) XXX_DiscardUnknown()
func (*Minter) XXX_Marshal ¶
func (*Minter) XXX_Unmarshal ¶
type Params ¶
type Params struct { // type of coin to mint MintDenom string `protobuf:"bytes,1,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` // maximum annual change in inflation rate InflationRateChange github_com_cosmos_cosmos_sdk_types.Dec `` /* 189-byte string literal not displayed */ // maximum inflation rate InflationMax github_com_cosmos_cosmos_sdk_types.Dec `` /* 158-byte string literal not displayed */ // minimum inflation rate InflationMin github_com_cosmos_cosmos_sdk_types.Dec `` /* 158-byte string literal not displayed */ // goal of percent bonded atoms GoalBonded github_com_cosmos_cosmos_sdk_types.Dec `` /* 150-byte string literal not displayed */ // expected blocks per year BlocksPerYear uint64 `` /* 126-byte string literal not displayed */ }
mint parameters
func NewParams ¶
func NewParams( mintDenom string, inflationRateChange, inflationMax, inflationMin, goalBonded sdk.Dec, blocksPerYear uint64, ) Params
NewParams new params for minting module
func (*Params) Descriptor ¶
func (*Params) GetBlocksPerYear ¶
func (*Params) GetMintDenom ¶
func (*Params) MarshalToSizedBuffer ¶
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs Implements params.ParamSet
func (*Params) ProtoMessage ¶
func (*Params) ProtoMessage()
func (*Params) XXX_DiscardUnknown ¶
func (m *Params) XXX_DiscardUnknown()
func (*Params) XXX_Marshal ¶
func (*Params) XXX_Unmarshal ¶
type StakingKeeper ¶
type StakingKeeper interface { StakingTokenSupply(ctx sdk.Context) sdk.Int BondedRatio(ctx sdk.Context) sdk.Dec }
StakingKeeper defines the expected staking keeper
type SupplyKeeper ¶
type SupplyKeeper interface { GetModuleAddress(name string) sdk.AccAddress // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, supplyExported.ModuleAccountI) GetModuleAccount(ctx sdk.Context, moduleName string) supplyExported.ModuleAccountI SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr types.AccountID, amt sdk.Coins) error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error MintCoins(ctx sdk.Context, name string, amt *sdk.Coins) error }
SupplyKeeper defines the expected kusupply keeper