types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AddrLen = 20

	MapperName = "distribution"

	Distribution        = "distribution"
	ValidatorPeriodInfo = "validatorPeriodInfo"
	DelegatorIncomeInfo = "delegatorIncomeInfo"
)

Variables

View Source
var (
	// 事件类型
	EventTypeProposerReward   = "proposer_reward"   // 提议奖励
	EventTypeDelegatorRewards = "delegator_rewards" // 所有委托奖励
	EventTypeCommunity        = "community"         // 社区费池
	EventTypeCommission       = "commission"        // 佣金
	EventTypeDelegatorReward  = "delegator_reward"  // 委托奖励
	EventTypeDelegate         = "delegate"          // 委托

	// 事件参数
	AttributeKeyTokens    = "tokens"    // tokens数量
	AttributeKeyValidator = "validator" // 验证节点
	AttributeKeyDelegator = "delegator" // 委托账户
)

Distribution module event types

View Source
var (
	ParamSpace = "distribution"

	// keys for distribution p
	KeyProposerRewardRate           = []byte("proposer_reward_rate")
	KeyCommunityRewardRate          = []byte("community_reward_rate")
	KeyDelegatorsIncomePeriodHeight = []byte("delegator_income_period_height")
	KeyGasPerUnitCost               = []byte("gas_per_unit_cost")
)

Functions

func BuildBlockDistributionKey

func BuildBlockDistributionKey() []byte

func BuildCommunityFeePoolKey

func BuildCommunityFeePoolKey() []byte

func BuildDelegatorEarningStartInfoKey

func BuildDelegatorEarningStartInfoKey(validatorAddr btypes.ValAddress, delegatorAddress btypes.AccAddress) []byte

func BuildDelegatorPeriodIncomeKey

func BuildDelegatorPeriodIncomeKey(validatorAddr btypes.ValAddress, delegatorAddress btypes.AccAddress, height int64) []byte

func BuildDelegatorPeriodIncomePrefixKey

func BuildDelegatorPeriodIncomePrefixKey(height int64) []byte

func BuildLastProposerKey

func BuildLastProposerKey() []byte

func BuildQueryDelegatorIncomeInfoCustomQueryPath

func BuildQueryDelegatorIncomeInfoCustomQueryPath(delegator btypes.AccAddress, valAddr btypes.ValAddress) string

func BuildQueryValidatorPeriodInfoCustomQueryPath

func BuildQueryValidatorPeriodInfoCustomQueryPath(valAddr btypes.ValAddress) string

func BuildValidatorCurrentPeriodSummaryKey

func BuildValidatorCurrentPeriodSummaryKey(validatorAddr btypes.ValAddress) []byte

func BuildValidatorEcoFeePoolKey

func BuildValidatorEcoFeePoolKey(validatorAddr btypes.ValAddress) []byte

func BuildValidatorHistoryPeriodSummaryKey

func BuildValidatorHistoryPeriodSummaryKey(validatorAddr btypes.ValAddress, period int64) []byte

func BuildValidatorHistoryPeriodSummaryPrefixKey

func BuildValidatorHistoryPeriodSummaryPrefixKey(validatorAddr btypes.ValAddress) []byte

func GetDelegatorEarningStartInfoAddr

func GetDelegatorEarningStartInfoAddr(key []byte) (valAddr btypes.ValAddress, deleAddr btypes.AccAddress)

func GetDelegatorEarningsStartInfoPrefixKey

func GetDelegatorEarningsStartInfoPrefixKey() []byte

func GetDelegatorPeriodIncomeHeightAddr

func GetDelegatorPeriodIncomeHeightAddr(key []byte) (valAddr btypes.ValAddress, deleAddr btypes.AccAddress, height int64)

func GetDelegatorPeriodIncomePrefixKey

func GetDelegatorPeriodIncomePrefixKey() []byte

func GetValidatorCurrentPeriodSummaryAddr

func GetValidatorCurrentPeriodSummaryAddr(key []byte) btypes.ValAddress

func GetValidatorCurrentPeriodSummaryPrefixKey

func GetValidatorCurrentPeriodSummaryPrefixKey() []byte

func GetValidatorEcoFeePoolPrefixKey

func GetValidatorEcoFeePoolPrefixKey() []byte

func GetValidatorEcoPoolAddress

func GetValidatorEcoPoolAddress(key []byte) btypes.ValAddress

func GetValidatorHistoryPeriodSummaryAddrPeriod

func GetValidatorHistoryPeriodSummaryAddrPeriod(key []byte) (valAddr btypes.ValAddress, period int64)

func GetValidatorHistoryPeriodSummaryPrefixKey

func GetValidatorHistoryPeriodSummaryPrefixKey() []byte

func RegisterCodec

func RegisterCodec(cdc *amino.Codec)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

Types

type DelegatorEarningStartState

type DelegatorEarningStartState struct {
	OperatorAddress            btypes.ValAddress          `json:"validator_address"`
	ConsPubKey                 string                     `json:"consensus_pubkey"`
	DeleAddress                btypes.AccAddress          `json:"delegator_address"`
	DelegatorEarningsStartInfo DelegatorEarningsStartInfo `json:"earning_start_info"`
}

type DelegatorEarningsStartInfo

type DelegatorEarningsStartInfo struct {
	PreviousPeriod        int64         `json:"previous_period"`       // 前收益计算点
	BondToken             btypes.BigInt `json:"bond_token"`            // 绑定tokens
	CurrentStartingHeight int64         `json:"earns_starting_height"` // 当前计算周期起始高度
	FirstDelegateHeight   int64         `json:"first_delegate_height"` // 首次委托高度
	HistoricalRewardFees  btypes.BigInt `json:"historical_rewards"`    // 累计未发放奖励
	LastIncomeCalHeight   int64         `json:"last_income_calHeight"` // 最后收益计算高度
	LastIncomeCalFees     btypes.BigInt `json:"last_income_calFees"`   // 最后一次发放收益
}

DelegatorEarningsStartInfo delegator计算收益信息

type DelegatorIncomeHeightState

type DelegatorIncomeHeightState struct {
	OperatorAddress btypes.ValAddress `json:"validator_address"`
	ConsPubKey      string            `json:"consensus_pubkey"`
	DeleAddress     btypes.AccAddress `json:"delegator_address"`
	Height          int64             `json:"height"`
}

type GenesisState

type GenesisState struct {
	CommunityFeePool         btypes.BigInt                 `json:"community_fee_pool"`        // 社区费池
	LastBlockProposer        btypes.ConsAddress            `json:"last_block_proposer"`       // 最新区块提议验证节点共识地址
	PreDistributionQOSAmount btypes.BigInt                 `json:"pre_distribute_amount"`     // 代分发奖励
	ValidatorHistoryPeriods  []ValidatorHistoryPeriodState `json:"validators_history_period"` // 验证节点收益历史节点信息
	ValidatorCurrentPeriods  []ValidatorCurrentPeriodState `json:"validators_current_period"` // 验证节点当前收益信息
	DelegatorEarningInfos    []DelegatorEarningStartState  `json:"delegator_earning_info"`    // 委托收益信息
	DelegatorIncomeHeights   []DelegatorIncomeHeightState  `json:"delegator_income_height"`   // 委托收益发放高度
	ValidatorEcoFeePools     []ValidatorEcoFeePoolState    `json:"validator_eco_fee_pools"`   // 验证节点委托共享费池
	Params                   Params                        `json:"params"`                    // 参数
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(communityFeePool btypes.BigInt,
	lastBlockProposer btypes.ConsAddress,
	preDistributionQOSAmount btypes.BigInt,
	validatorHistoryPeriods []ValidatorHistoryPeriodState,
	validatorCurrentPeriods []ValidatorCurrentPeriodState,
	delegatorEarningInfos []DelegatorEarningStartState,
	delegatorIncomeHeights []DelegatorIncomeHeightState,
	validatorEcoFeePools []ValidatorEcoFeePoolState,
	params Params) GenesisState

type Params

type Params struct {
	ProposerRewardRate           qtypes.Dec `json:"proposer_reward_rate"`           // 块提议者奖励比例
	CommunityRewardRate          qtypes.Dec `json:"community_reward_rate"`          // 社区奖励比例
	DelegatorsIncomePeriodHeight int64      `json:"delegator_income_period_height"` // 奖励发放周期
	GasPerUnitCost               int64      `json:"gas_per_unit_cost"`              // 1QOS折算Gas量
}

func DefaultParams

func DefaultParams() Params

func (*Params) GetParamSpace

func (p *Params) GetParamSpace() string

参数所属模块名

func (*Params) KeyValuePairs

func (p *Params) KeyValuePairs() qtypes.KeyValuePairs

返回参数键值对

func (*Params) SetKeyValue added in v0.0.8

func (p *Params) SetKeyValue(key string, value interface{}) btypes.Error

设置单个参数,不同数据类型对应不同处理

func (*Params) Validate

func (p *Params) Validate() btypes.Error

参数校验

func (*Params) ValidateKeyValue added in v0.0.8

func (p *Params) ValidateKeyValue(key string, value string) (interface{}, btypes.Error)

校验单个参数,返回参数值

type ValidatorCurrentPeriodState

type ValidatorCurrentPeriodState struct {
	OperatorAddress      btypes.ValAddress             `json:"validator_address"`
	ConsPubKey           string                        `json:"consensus_pubkey"`
	CurrentPeriodSummary ValidatorCurrentPeriodSummary `json:"current_period_summary"`
}

type ValidatorCurrentPeriodSummary

type ValidatorCurrentPeriodSummary struct {
	Fees   btypes.BigInt `json:"fees"`
	Period int64         `json:"period"`
}

ValidatorCurrentPeriodSummary validator当前周期收益信息

type ValidatorEcoFeePool

type ValidatorEcoFeePool struct {
	ProposerTotalRewardFee      btypes.BigInt `json:"proposerTotalRewardFee"`      //validator 通过proposer获取的总收益
	CommissionTotalRewardFee    btypes.BigInt `json:"commissionTotalRewardFee"`    //validator 通过投票获取的佣金总收益
	PreDistributeTotalRewardFee btypes.BigInt `json:"preDistributeTotalRewardFee"` //validator 通过投票获取的待分配金额总收益
	PreDistributeRemainTotalFee btypes.BigInt `json:"preDistributeRemainTotalFee"` //validator 待分配金额中剩余的收益
}

ValidatorEcoFeePool validator收益信息

func NewValidatorEcoFeePool

func NewValidatorEcoFeePool() ValidatorEcoFeePool

type ValidatorEcoFeePoolState

type ValidatorEcoFeePoolState struct {
	OperatorAddress btypes.ValAddress   `json:"validator_address"`
	EcoFeePool      ValidatorEcoFeePool `json:"eco_fee_pool"`
}

type ValidatorHistoryPeriodState

type ValidatorHistoryPeriodState struct {
	OperatorAddress btypes.ValAddress `json:"validator_address"`
	ConsPubKey      string            `json:"consensus_pubkey"`
	Period          int64             `json:"period"`
	Summary         qtypes.Fraction   `json:"summary"`
}

Jump to

Keyboard shortcuts

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