types

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MapperName          = "mint"
	InflationPhrasesKey = "phrases"
)

Variables

View Source
var (
	EventTypeMint = "mint"

	AttributeKeyHeight = "height"
	AttributeKeyTokens = "tokens"
)

Functions

func BuildAllTotalMintQOSKey

func BuildAllTotalMintQOSKey() []byte

func BuildFirstBlockTimeKey

func BuildFirstBlockTimeKey() []byte

func BuildInflationPhrasesKey

func BuildInflationPhrasesKey() []byte

func BuildTotalQOSKey

func BuildTotalQOSKey() []byte

func RegisterCodec

func RegisterCodec(cdc *amino.Codec)

func ValidateGenesis

func ValidateGenesis(gs GenesisState) error

Types

type GenesisState

type GenesisState struct {
	InflationPhrases InflationPhrases `json:"inflation_phrases"`
	FirstBlockTime   int64            `json:"first_block_time"` //UTC().UNIX()
	AppliedQOSAmount uint64           `json:"applied_qos_amount"`
	TotalQOSAmount   uint64           `json:"total_qos_amount"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(inflationPhrases InflationPhrases, firstBlockTime int64, appliedQOSAmount uint64, totalQOSAmount uint64) GenesisState

type InflationPhrase

type InflationPhrase struct {
	EndTime       time.Time `json:"end_time"`
	TotalAmount   uint64    `json:"total_amount"`
	AppliedAmount uint64    `json:"applied_amount"`
}

func (InflationPhrase) Equals

func (phrase InflationPhrase) Equals(p InflationPhrase) bool

type InflationPhrases

type InflationPhrases []InflationPhrase

func DefaultInflationPhrases

func DefaultInflationPhrases() InflationPhrases

func (InflationPhrases) Adapt

func (phrases InflationPhrases) Adapt(oldPhrases InflationPhrases) (newPhrase InflationPhrases)

适配旧通胀阶段,填充已发行

func (InflationPhrases) ApplyQOS

func (phrases InflationPhrases) ApplyQOS(phraseEndTime time.Time, amount uint64) (newPhrase InflationPhrases)

释放通胀

func (InflationPhrases) Equals

func (phrases InflationPhrases) Equals(ips InflationPhrases) bool

func (InflationPhrases) GetPhrase

func (phrases InflationPhrases) GetPhrase(time time.Time) (phrase *InflationPhrase, exists bool)

获取时间点对应通胀阶段

func (InflationPhrases) GetPrePhrase

func (phrases InflationPhrases) GetPrePhrase(time time.Time) (phrase *InflationPhrase, exists bool)

获取前一通胀阶段

func (InflationPhrases) Valid

func (phrases InflationPhrases) Valid() error

校验

func (InflationPhrases) ValidNewPhrases

func (phrases InflationPhrases) ValidNewPhrases(newTotal, totalApplied uint64, newPhrases InflationPhrases) error

校验新通胀

Jump to

Keyboard shortcuts

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