types

package
v0.0.0-...-8551cdf Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeMint = ModuleName

	AttributeKeyBondedRatio      = "bonded_ratio"
	AttributeKeyInflation        = "inflation"
	AttributeKeyAnnualProvisions = "annual_provisions"
)

Minting module event types

View Source
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

View Source
var (
	KeyMintDenom           = []byte("MintDenom")
	KeyInflationRateChange = []byte("InflationRateChange")
	KeyInflationMax        = []byte("InflationMax")
	KeyInflationMin        = []byte("InflationMin")
	KeyGoalBonded          = []byte("GoalBonded")
	KeyBlocksPerYear       = []byte("BlocksPerYear")
)

Parameter store keys

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var MinterKey = []byte{0x00}

the one key to use for the keeper store

View Source
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

func ParamKeyTable() params.KeyTable

ParamKeyTable ParamTable for minting module.

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the provided genesis state to ensure the expected invariants holds.

func ValidateMinter

func ValidateMinter(minter Minter) error

validate minter

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

func InitialMinter(inflation sdk.Dec) Minter

InitialMinter returns an initial Minter object with a given inflation value.

func NewMinter

func NewMinter(inflation, annualProvisions sdk.Dec) Minter

NewMinter returns a new Minter object with the given inflation and annual provisions values.

func (Minter) BlockProvision

func (m Minter) BlockProvision(params Params) sdk.Coin

BlockProvision returns the provisions for a block based on the annual provisions rate.

func (*Minter) Descriptor

func (*Minter) Descriptor() ([]byte, []int)

func (*Minter) Marshal

func (m *Minter) Marshal() (dAtA []byte, err error)

func (*Minter) MarshalTo

func (m *Minter) MarshalTo(dAtA []byte) (int, error)

func (*Minter) MarshalToSizedBuffer

func (m *Minter) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Minter) NextAnnualProvisions

func (m Minter) NextAnnualProvisions(_ Params, totalSupply sdk.Int) sdk.Dec

NextAnnualProvisions returns the annual provisions based on current total kusupply and inflation rate.

func (Minter) NextInflationRate

func (m Minter) NextInflationRate(params Params, bondedRatio sdk.Dec) sdk.Dec

NextInflationRate returns the new inflation rate for the next hour.

func (*Minter) ProtoMessage

func (*Minter) ProtoMessage()

func (*Minter) Reset

func (m *Minter) Reset()

func (*Minter) Size

func (m *Minter) Size() (n int)

func (*Minter) String

func (m *Minter) String() string

func (*Minter) Unmarshal

func (m *Minter) Unmarshal(dAtA []byte) error

func (*Minter) XXX_DiscardUnknown

func (m *Minter) XXX_DiscardUnknown()

func (*Minter) XXX_Marshal

func (m *Minter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Minter) XXX_Merge

func (m *Minter) XXX_Merge(src proto.Message)

func (*Minter) XXX_Size

func (m *Minter) XXX_Size() int

func (*Minter) XXX_Unmarshal

func (m *Minter) XXX_Unmarshal(b []byte) error

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 DefaultParams

func DefaultParams() Params

DefaultParams default minting module 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) Descriptor() ([]byte, []int)

func (*Params) GetBlocksPerYear

func (m *Params) GetBlocksPerYear() uint64

func (*Params) GetMintDenom

func (m *Params) GetMintDenom() string

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs Implements params.ParamSet

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (Params) String

func (p Params) String() string

String implements the Stringer interface.

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

validate params

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

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

Jump to

Keyboard shortcuts

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