Documentation
¶
Index ¶
- Constants
- Variables
- func BuildBlockDistributionKey() []byte
- func BuildCommunityFeePoolKey() []byte
- func BuildCurrentValidatorsAddressKey() []byte
- func BuildDelegationByDelValKey(delAdd btypes.Address, valAdd btypes.Address) []byte
- func BuildDelegationByValDelKey(valAdd btypes.Address, delAdd btypes.Address) []byte
- func BuildDelegatorEarningStartInfoKey(validatorAddr btypes.Address, delegatorAddress btypes.Address) []byte
- func BuildDelegatorPeriodIncomeKey(validatorAddr, delegatorAddress btypes.Address, height uint64) []byte
- func BuildDelegatorPeriodIncomePrefixKey(height uint64) []byte
- func BuildDistributeParamsKey() []byte
- func BuildFirstBlockTimeKey() []byte
- func BuildGetDelegationCustomQueryPath(deleAddr, owner btypes.Address) string
- func BuildInactiveValidatorKey(sec uint64, valAddress btypes.Address) []byte
- func BuildInactiveValidatorKeyByTime(inactiveTime time.Time, valAddress btypes.Address) []byte
- func BuildLastProposerKey() []byte
- func BuildMintParamsKey() []byte
- func BuildOwnerWithValidatorKey(ownerAddress btypes.Address) []byte
- func BuildQueryDelegationsByDelegatorCustomQueryPath(deleAddr btypes.Address) string
- func BuildQueryDelegationsByOwnerCustomQueryPath(owner btypes.Address) string
- func BuildQueryDelegatorIncomeInfoCustomQueryPath(delegator, owner btypes.Address) string
- func BuildQueryValidatorPeriodInfoCustomQueryPath(owner btypes.Address) string
- func BuildStakeParamsKey() []byte
- func BuildUnbondingDelegationByHeightDelKey(height uint64, delAdd btypes.Address) []byte
- func BuildUnbondingDelegationByHeightPrefix(height uint64) []byte
- func BuildValidatorByVotePower(votePower uint64, valAddress btypes.Address) []byte
- func BuildValidatorCurrentPeriodSummaryKey(validatorAddr btypes.Address) []byte
- func BuildValidatorHistoryPeriodSummaryKey(validatorAddr btypes.Address, period uint64) []byte
- func BuildValidatorKey(valAddress btypes.Address) []byte
- func BuildValidatorStoreQueryPath() []byte
- func BuildValidatorVoteInfoInWindowKey(index uint64, valAddress btypes.Address) []byte
- func BuildValidatorVoteInfoInWindowPrefixKey(valAddress btypes.Address) []byte
- func BuildValidatorVoteInfoKey(valAddress btypes.Address) []byte
- func BuildVoteInfoStoreQueryPath() []byte
- func BulidValidatorPrefixKey() []byte
- func GetDelegationValDelKeyAddress(key []byte) (valAddr btypes.Address, deleAddr btypes.Address)
- func GetDelegatorEarningStartInfoAddr(key []byte) (valAddr, deleAddr btypes.Address)
- func GetDelegatorEarningsStartInfoPrefixKey() []byte
- func GetDelegatorPeriodIncomeHeightAddr(key []byte) (valAddr btypes.Address, deleAddr btypes.Address, height uint64)
- func GetDelegatorPeriodIncomePrefixKey() []byte
- func GetUnbondingDelegationHeightAddress(key []byte) (height uint64, deleAddr btypes.Address)
- func GetValidatorByInactiveKey() []byte
- func GetValidatorByVotePowerKey() []byte
- func GetValidatorCurrentPeriodSummaryAddr(key []byte) btypes.Address
- func GetValidatorCurrentPeriodSummaryPrefixKey() []byte
- func GetValidatorHistoryPeriodSummaryAddrPeriod(key []byte) (valAddr btypes.Address, period uint64)
- func GetValidatorHistoryPeriodSummaryPrefixKey() []byte
- func GetValidatorVoteInfoAddr(key []byte) btypes.Address
- func GetValidatorVoteInfoInWindowIndexAddr(key []byte) (uint64, btypes.Address)
- func GetValidatorVoteInfoInWindowKey() []byte
- func GetValidatorVoteInfoKey() []byte
- type DelegationInfo
- type DelegatorEarningsStartInfo
- type DistributionParams
- type InactiveCode
- type InflationPhrase
- type MintParams
- type StakeParams
- type Validator
- type ValidatorCurrentPeriodSummary
- type ValidatorVoteInfo
Constants ¶
View Source
const ( MintMapperName = "mint" MintParamsKey = "mintparams" )
View Source
const ( ValidatorMapperName = "validator" VoteInfoMapperName = "voteInfo" DelegationMapperName = "delegation" //------query------- Stake = "stake" Delegation = "delegation" Delegations = "delegations" Owner = "owner" Delegator = "delegator" Distribution = "distribution" ValidatorPeriodInfo = "validatorPeriodInfo" DelegatorIncomeInfo = "delegatorIncomeInfo" )
View Source
const ( //Active 可获得挖矿奖励状态 Active int8 = iota //Inactive Inactive //Inactive Code Revoke InactiveCode = iota // 2 MissVoteBlock // 3 MaxValidator // 4 )
View Source
const (
AddrLen = 20
)
View Source
const (
DistributionMapperName = "distribution"
)
Variables ¶
View Source
var ( DelegationByDelValKey = []byte{0x31} // key: delegator add + validator owner add, value: delegationInfo DelegationByValDelKey = []byte{0x32} // key: validator owner add + delegator add, value: nil DelegatorUnbondingQOSatHeightKey = []byte{0x41} // key: height + delegator add, value: the amount of qos going to be unbonded on this height )
Functions ¶
func BuildBlockDistributionKey ¶
func BuildBlockDistributionKey() []byte
func BuildCommunityFeePoolKey ¶
func BuildCommunityFeePoolKey() []byte
func BuildCurrentValidatorsAddressKey ¶
func BuildCurrentValidatorsAddressKey() []byte
func BuildDistributeParamsKey ¶
func BuildDistributeParamsKey() []byte
func BuildFirstBlockTimeKey ¶
func BuildFirstBlockTimeKey() []byte
func BuildLastProposerKey ¶
func BuildLastProposerKey() []byte
func BuildMintParamsKey ¶
func BuildMintParamsKey() []byte
func BuildStakeParamsKey ¶
func BuildStakeParamsKey() []byte
func BuildValidatorKey ¶
func BuildValidatorStoreQueryPath ¶
func BuildValidatorStoreQueryPath() []byte
func BuildVoteInfoStoreQueryPath ¶
func BuildVoteInfoStoreQueryPath() []byte
func BulidValidatorPrefixKey ¶
func BulidValidatorPrefixKey() []byte
func GetDelegatorEarningsStartInfoPrefixKey ¶
func GetDelegatorEarningsStartInfoPrefixKey() []byte
func GetDelegatorPeriodIncomePrefixKey ¶
func GetDelegatorPeriodIncomePrefixKey() []byte
func GetValidatorByInactiveKey ¶
func GetValidatorByInactiveKey() []byte
func GetValidatorByVotePowerKey ¶
func GetValidatorByVotePowerKey() []byte
func GetValidatorCurrentPeriodSummaryPrefixKey ¶
func GetValidatorCurrentPeriodSummaryPrefixKey() []byte
func GetValidatorHistoryPeriodSummaryPrefixKey ¶
func GetValidatorHistoryPeriodSummaryPrefixKey() []byte
func GetValidatorVoteInfoInWindowKey ¶
func GetValidatorVoteInfoInWindowKey() []byte
func GetValidatorVoteInfoKey ¶
func GetValidatorVoteInfoKey() []byte
Types ¶
type DelegationInfo ¶
type DelegationInfo struct {
DelegatorAddr btypes.Address `json:"delegator_addr"`
ValidatorAddr btypes.Address `json:"validator_addr"`
Amount uint64 `json:"delegate_amount"` // 委托数量。TODO 注意溢出处理
IsCompound bool `json:"is_compound"` // 是否复投
}
func NewDelegationInfo ¶
type DelegatorEarningsStartInfo ¶
type DelegatorEarningsStartInfo struct {
PreviousPeriod uint64 `json:"previous_period"`
BondToken uint64 `json:"bond_token"`
CurrentStartingHeight uint64 `json:"earns_starting_height"`
FirstDelegateHeight uint64 `json:"first_delegate_height"`
HistoricalRewardFees btypes.BigInt `json:"historical_rewards"`
LastIncomeCalHeight uint64 `json:"last_income_calHeight"`
LastIncomeCalFees btypes.BigInt `json:"last_income_calFees"`
}
DelegatorEarningsStartInfo delegator计算收益信息
type DistributionParams ¶
type DistributionParams struct {
ProposerRewardRate qtypes.Fraction `json:"proposer_reward_rate"`
CommunityRewardRate qtypes.Fraction `json:"community_reward_rate"`
ValidatorCommissionRate qtypes.Fraction `json:"validator_commission_rate"`
DelegatorsIncomePeriodHeight uint64 `json:"delegator_income_period_height"`
GasPerUnitCost uint64 `json:"gas_per_unit_cost"` // how much gas = 1 QOS
}
func DefaultDistributionParams ¶
func DefaultDistributionParams() DistributionParams
type InactiveCode ¶
type InactiveCode int8
type InflationPhrase ¶
type MintParams ¶
type MintParams struct {
Phrases []InflationPhrase `json:"inflation_phrases"`
}
func DefaultMintParams ¶
func DefaultMintParams() MintParams
func NewMintParams ¶
func NewMintParams(phrases []InflationPhrase) MintParams
type StakeParams ¶
type StakeParams struct {
MaxValidatorCnt uint32 `json:"max_validator_cnt"`
ValidatorVotingStatusLen uint32 `json:"voting_status_len"`
ValidatorVotingStatusLeast uint32 `json:"voting_status_least"`
ValidatorSurvivalSecs uint32 `json:"survival_secs"`
DelegatorUnbondReturnHeight uint32 `json:"unbond_return_height"`
}
func DefaultStakeParams ¶
func DefaultStakeParams() StakeParams
func NewStakeParams ¶
func NewStakeParams(maxValidatorCnt, validatorVotingStatusLen, validatorVotingStatusLeast, validatorSurvivalSecs, delegatorUnbondReturnHeight uint32) StakeParams
type Validator ¶
type Validator struct {
Name string `json:"name"`
Owner btypes.Address `json:"owner"`
ValidatorPubKey crypto.PubKey `json:"pub_key"`
BondTokens uint64 `json:"bond_tokens"` //不能超过int64最大值
Description string `json:"description"`
Status int8 `json:"status"`
InactiveCode InactiveCode `json:"inactive_code"`
InactiveTime time.Time `json:"inactive_time"`
InactiveHeight uint64 `json:"inactive_height"`
MinPeriod uint64 `json:"min_period"`
BondHeight uint64 `json:"bond_height"`
}
func (Validator) GetValidatorAddress ¶
func (Validator) ToABCIValidator ¶
func (Validator) ToABCIValidatorUpdate ¶
func (val Validator) ToABCIValidatorUpdate(isRemoved bool) (abciVal abci.ValidatorUpdate)
type ValidatorCurrentPeriodSummary ¶
type ValidatorCurrentPeriodSummary struct {
Fees btypes.BigInt `json:"fees"`
Period uint64 `json:"period"`
}
ValidatorCurrentPeriodSummary validator当前周期收益信息
type ValidatorVoteInfo ¶
type ValidatorVoteInfo struct {
StartHeight uint64 `json:"startHeight"`
IndexOffset uint64 `json:"indexOffset"` //统计截止高度=StartHeight+IndexOffset-1
MissedBlocksCounter uint64 `json:"missedBlocksCounter"`
}
func NewValidatorVoteInfo ¶
func NewValidatorVoteInfo(startHeight, indexOffset, missedBlocksCounter uint64) ValidatorVoteInfo
Click to show internal directories.
Click to hide internal directories.