Documentation
¶
Index ¶
- func BuildDistributionStoreQueryPath() []byte
- func FeepoolInvariant(module string) qtypes.Invariant
- func PreDistributionInvariant(module string) qtypes.Invariant
- func Query(ctx context.Context, route []string, req abci.RequestQuery) (res []byte, err btypes.Error)
- func ValidatorFeePoolInvariant(module string) qtypes.Invariant
- type DelegatorIncomeInfoQueryResult
- type Mapper
- func (mapper *Mapper) AddPreDistributionQOS(amount btypes.BigInt)
- func (mapper *Mapper) AddToCommunityFeePool(fee btypes.BigInt)
- func (mapper *Mapper) AddValidatorEcoFeePool(validatorAddr btypes.Address, ...)
- func (mapper *Mapper) CalculateDelegatorPeriodRewards(valAddr, deleAddr btypes.Address, endPeriod, blockHeight uint64) (btypes.BigInt, error)
- func (mapper *Mapper) CalculateRewardsBetweenPeriod(valAddr btypes.Address, startPeriod, endPeriod, bondTokens uint64) btypes.BigInt
- func (mapper *Mapper) ClearPreDistributionQOS()
- func (mapper *Mapper) ClearValidatorHistoryPeroid(valAddr btypes.Address, minPeroid uint64)
- func (mapper *Mapper) Copy() mapper.IMapper
- func (mapper *Mapper) DelDelegatorEarningStartInfo(valAddr, deleAddr btypes.Address)
- func (mapper *Mapper) DeleteDelegatorIncomeInfo(valAddr, deleAddr btypes.Address)
- func (mapper *Mapper) DeleteDelegatorsEarningStartInfo()
- func (mapper *Mapper) DeleteDelegatorsIncomeHeight()
- func (mapper *Mapper) DeleteValidatorEcoFeePool(validatorAddr btypes.Address)
- func (mapper *Mapper) DeleteValidatorPeriodSummaryInfo(valAddr btypes.Address)
- func (mapper *Mapper) GetCommunityFeePool() btypes.BigInt
- func (mapper *Mapper) GetDelegatorEarningStartInfo(valAddr, deleAddr btypes.Address) (info types.DelegatorEarningsStartInfo, exists bool)
- func (mapper *Mapper) GetLastBlockProposer() btypes.Address
- func (mapper *Mapper) GetParams(ctx context.Context) (p types.Params)
- func (mapper *Mapper) GetPreDistributionQOS() btypes.BigInt
- func (mapper *Mapper) GetValidatorCurrentPeriodSummary(valAddr btypes.Address) (vcps types.ValidatorCurrentPeriodSummary, exists bool)
- func (mapper *Mapper) GetValidatorEcoFeePool(validatorAddr btypes.Address) (pool types.ValidatorEcoFeePool)
- func (mapper *Mapper) GetValidatorHistoryPeriodSummary(valAddr btypes.Address, period uint64) (frac qtypes.Fraction)
- func (mapper *Mapper) GetValidatorMinPeriodFromDelegators(valAddr btypes.Address) uint64
- func (mapper *Mapper) IncrementValidatorPeriod(validator stake.Validator) uint64
- func (mapper *Mapper) InitDelegatorIncomeInfo(ctx context.Context, valAddr, deleAddr btypes.Address, ...)
- func (mapper *Mapper) InitValidatorPeriodSummaryInfo(valAddr btypes.Address) types.ValidatorCurrentPeriodSummary
- func (mapper *Mapper) IteratorDelegatorEarningStartInfo(fn func(btypes.Address, btypes.Address, types.DelegatorEarningsStartInfo))
- func (mapper *Mapper) IteratorDelegatorsIncomeHeight(fn func(btypes.Address, btypes.Address, uint64))
- func (mapper *Mapper) IteratorValidatorEcoFeePools(fn func(validatorAddr btypes.Address, pool types.ValidatorEcoFeePool))
- func (mapper *Mapper) IteratorValidatorsCurrentPeriod(fn func(btypes.Address, types.ValidatorCurrentPeriodSummary))
- func (mapper *Mapper) IteratorValidatorsHistoryPeriod(fn func(valAddr btypes.Address, period uint64, frac qtypes.Fraction))
- func (mapper *Mapper) MinusValidatorEcoFeePool(validatorAddr btypes.Address, bonusReward btypes.BigInt)
- func (mapper *Mapper) ModifyDelegatorTokens(validator stake.Validator, deleAddr btypes.Address, ...) error
- func (mapper *Mapper) SaveValidatorEcoFeePool(validatorAddr btypes.Address, pool types.ValidatorEcoFeePool)
- func (mapper *Mapper) SetCommunityFeePool(communityFee btypes.BigInt)
- func (mapper *Mapper) SetLastBlockProposer(proposer btypes.Address)
- func (mapper *Mapper) SetParams(ctx context.Context, p types.Params)
- func (mapper *Mapper) SetPreDistributionQOS(amount btypes.BigInt)
- type StakingHooks
- func (hooks *StakingHooks) AfterDelegationCreated(ctx context.Context, val btypes.Address, del btypes.Address)
- func (hooks *StakingHooks) AfterValidatorCreated(ctx context.Context, val btypes.Address)
- func (hooks *StakingHooks) AfterValidatorSlashed(ctx context.Context, slashedTokens uint64)
- func (hooks *StakingHooks) BeforeDelegationModified(ctx context.Context, val btypes.Address, del btypes.Address, ...)
- func (hooks *StakingHooks) BeforeValidatorRemoved(ctx context.Context, val btypes.Address)
- func (hooks *StakingHooks) HookMapper() string
- type ValidatorPeriodInfoQueryResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDistributionStoreQueryPath ¶
func BuildDistributionStoreQueryPath() []byte
func FeepoolInvariant ¶
Types ¶
type DelegatorIncomeInfoQueryResult ¶
type DelegatorIncomeInfoQueryResult struct {
OwnerAddr btypes.Address `json:"owner_address"`
ValidatorPubKey crypto.PubKey `json:"validator_pub_key"`
PreviousPeriod uint64 `json:"previous_validator_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"`
}
type Mapper ¶
type Mapper struct {
*mapper.BaseMapper
}
Distribution Mapper 收益分配相关Mapper:
keys:
Validator: 1. 历史计费点汇总收益信息: validatorHistoryPeriodSummaryPrefixKey 2. 当前计费点收益信息: validatorCurrentPeriodSummaryPrefixKey Delegator: 1. Delegator收益计算信息: delegatorEarningsStartInfoPrefixKey 2. Delegator某高度下是否发放收益信息: delegatorPeriodIncomePrefixKey: 仅在对delegator发放收益时删除
func (*Mapper) AddPreDistributionQOS ¶
func (*Mapper) AddToCommunityFeePool ¶
func (*Mapper) AddValidatorEcoFeePool ¶
func (*Mapper) CalculateDelegatorPeriodRewards ¶
func (mapper *Mapper) CalculateDelegatorPeriodRewards(valAddr, deleAddr btypes.Address, endPeriod, blockHeight uint64) (btypes.BigInt, error)
计算delegator在计费点区间的收益
func (*Mapper) CalculateRewardsBetweenPeriod ¶
func (mapper *Mapper) CalculateRewardsBetweenPeriod(valAddr btypes.Address, startPeriod, endPeriod, bondTokens uint64) btypes.BigInt
计算bondTokens在validator的两个计费点区间的收益
func (*Mapper) ClearPreDistributionQOS ¶
func (mapper *Mapper) ClearPreDistributionQOS()
func (*Mapper) ClearValidatorHistoryPeroid ¶
删除validator历史计费点信息,额外保留2个历史数据
func (*Mapper) DelDelegatorEarningStartInfo ¶
func (*Mapper) DeleteDelegatorIncomeInfo ¶
删除delegator收益计算信息 todo: 某高度下发放收益信息没有删除
func (*Mapper) DeleteDelegatorsEarningStartInfo ¶
func (mapper *Mapper) DeleteDelegatorsEarningStartInfo()
func (*Mapper) DeleteDelegatorsIncomeHeight ¶
func (mapper *Mapper) DeleteDelegatorsIncomeHeight()
func (*Mapper) DeleteValidatorEcoFeePool ¶
func (*Mapper) DeleteValidatorPeriodSummaryInfo ¶
清空validator收益分配相关信息
func (*Mapper) GetCommunityFeePool ¶
func (*Mapper) GetDelegatorEarningStartInfo ¶
func (*Mapper) GetLastBlockProposer ¶
func (*Mapper) GetPreDistributionQOS ¶
func (*Mapper) GetValidatorCurrentPeriodSummary ¶
func (*Mapper) GetValidatorEcoFeePool ¶
func (mapper *Mapper) GetValidatorEcoFeePool(validatorAddr btypes.Address) (pool types.ValidatorEcoFeePool)
func (*Mapper) GetValidatorHistoryPeriodSummary ¶
func (*Mapper) GetValidatorMinPeriodFromDelegators ¶
func (*Mapper) IncrementValidatorPeriod ¶
增加validator收益计费点 1. 保存历史计费点收益汇总信息 2. 更新当前计费点收益信息,返回上一计费点数值
func (*Mapper) InitDelegatorIncomeInfo ¶
func (mapper *Mapper) InitDelegatorIncomeInfo(ctx context.Context, valAddr, deleAddr btypes.Address, bondTokens, currHeight uint64)
首次Delegate: 1. first delegate 2. unbond all , then delegate
func (*Mapper) InitValidatorPeriodSummaryInfo ¶
func (mapper *Mapper) InitValidatorPeriodSummaryInfo(valAddr btypes.Address) types.ValidatorCurrentPeriodSummary
初始化validator历史计费点汇总收益,当前计费点收益信息.
func (*Mapper) IteratorDelegatorEarningStartInfo ¶
func (*Mapper) IteratorDelegatorsIncomeHeight ¶
func (*Mapper) IteratorValidatorEcoFeePools ¶
func (mapper *Mapper) IteratorValidatorEcoFeePools(fn func(validatorAddr btypes.Address, pool types.ValidatorEcoFeePool))
func (*Mapper) IteratorValidatorsCurrentPeriod ¶
func (mapper *Mapper) IteratorValidatorsCurrentPeriod(fn func(btypes.Address, types.ValidatorCurrentPeriodSummary))
func (*Mapper) IteratorValidatorsHistoryPeriod ¶
func (*Mapper) MinusValidatorEcoFeePool ¶
func (*Mapper) ModifyDelegatorTokens ¶
func (mapper *Mapper) ModifyDelegatorTokens(validator stake.Validator, deleAddr btypes.Address, updatedToken, blockHeight uint64) error
修改delegator绑定的token: 1. 增加validator的计费点 2. 计算delegator在两次计费点间的收益 3. 追加该收益到delegator 收益计算信息中
func (*Mapper) SaveValidatorEcoFeePool ¶
func (mapper *Mapper) SaveValidatorEcoFeePool(validatorAddr btypes.Address, pool types.ValidatorEcoFeePool)
func (*Mapper) SetCommunityFeePool ¶
func (*Mapper) SetLastBlockProposer ¶
func (*Mapper) SetPreDistributionQOS ¶
type StakingHooks ¶
type StakingHooks struct{}
func NewStakingHooks ¶
func NewStakingHooks() *StakingHooks
func (*StakingHooks) AfterDelegationCreated ¶
func (hooks *StakingHooks) AfterDelegationCreated(ctx context.Context, val btypes.Address, del btypes.Address)
创建delegation时初始化分配信息
func (*StakingHooks) AfterValidatorCreated ¶
func (hooks *StakingHooks) AfterValidatorCreated(ctx context.Context, val btypes.Address)
创建validator时初始化分配信息
func (*StakingHooks) AfterValidatorSlashed ¶
func (hooks *StakingHooks) AfterValidatorSlashed(ctx context.Context, slashedTokens uint64)
validator惩罚后操作
func (*StakingHooks) BeforeDelegationModified ¶
func (hooks *StakingHooks) BeforeDelegationModified(ctx context.Context, val btypes.Address, del btypes.Address, updateAmount uint64)
更新绑定tokens时分配处理逻辑
func (*StakingHooks) BeforeValidatorRemoved ¶
func (hooks *StakingHooks) BeforeValidatorRemoved(ctx context.Context, val btypes.Address)
删除validator时分配处理逻辑
func (*StakingHooks) HookMapper ¶
func (hooks *StakingHooks) HookMapper() string
type ValidatorPeriodInfoQueryResult ¶
type ValidatorPeriodInfoQueryResult struct {
OwnerAddr btypes.Address `json:"owner_address"`
ValidatorPubKey crypto.PubKey `json:"validator_pub_key"`
Fees btypes.BigInt `json:"fees"`
CurrentTokens uint64 `json:"current_tokens"`
CurrentPeriod uint64 `json:"current_period"`
LastPeriod uint64 `json:"last_period"`
LastPeriodFraction qtypes.Fraction `json:"last_period_fraction"`
}
Click to show internal directories.
Click to hide internal directories.