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.ValAddress, ...)
- func (mapper *Mapper) CalculateDelegatorPeriodRewards(valAddr btypes.ValAddress, deleAddr btypes.AccAddress, ...) (btypes.BigInt, error)
- func (mapper *Mapper) CalculateRewardsBetweenPeriod(valAddr btypes.ValAddress, startPeriod, endPeriod int64, ...) btypes.BigInt
- func (mapper *Mapper) ClearPreDistributionQOS()
- func (mapper *Mapper) ClearValidatorHistoryPeroid(valAddr btypes.ValAddress, minPeroid int64)
- func (mapper *Mapper) Copy() mapper.IMapper
- func (mapper *Mapper) DelDelegatorEarningStartInfo(valAddr btypes.ValAddress, deleAddr btypes.AccAddress)
- func (mapper *Mapper) DeleteDelegatorIncomeInfo(valAddr btypes.ValAddress, deleAddr btypes.AccAddress)
- func (mapper *Mapper) DeleteDelegatorsEarningStartInfo()
- func (mapper *Mapper) DeleteDelegatorsIncomeHeight()
- func (mapper *Mapper) DeleteValidatorEcoFeePool(validatorAddr btypes.ValAddress)
- func (mapper *Mapper) DeleteValidatorPeriodSummaryInfo(valAddr btypes.ValAddress)
- func (mapper *Mapper) GetCommunityFeePool() btypes.BigInt
- func (mapper *Mapper) GetDelegatorEarningStartInfo(valAddr btypes.ValAddress, deleAddr btypes.AccAddress) (info types.DelegatorEarningsStartInfo, exists bool)
- func (mapper *Mapper) GetLastBlockProposer() btypes.ConsAddress
- func (mapper *Mapper) GetParams(ctx context.Context) (p types.Params)
- func (mapper *Mapper) GetPreDistributionQOS() btypes.BigInt
- func (mapper *Mapper) GetValidatorCurrentPeriodSummary(valAddr btypes.ValAddress) (vcps types.ValidatorCurrentPeriodSummary, exists bool)
- func (mapper *Mapper) GetValidatorEcoFeePool(validatorAddr btypes.ValAddress) (pool types.ValidatorEcoFeePool)
- func (mapper *Mapper) GetValidatorHistoryPeriodSummary(valAddr btypes.ValAddress, period int64) (frac qtypes.Fraction)
- func (mapper *Mapper) GetValidatorMinPeriodFromDelegators(valAddr btypes.ValAddress) int64
- func (mapper *Mapper) IncrementValidatorPeriod(validator stake.Validator) int64
- func (mapper *Mapper) InitDelegatorIncomeInfo(ctx context.Context, valAddr btypes.ValAddress, deleAddr btypes.AccAddress, ...)
- func (mapper *Mapper) InitValidatorPeriodSummaryInfo(valAddr btypes.ValAddress) types.ValidatorCurrentPeriodSummary
- func (mapper *Mapper) IteratorDelegatorEarningStartInfo(...)
- func (mapper *Mapper) IteratorDelegatorsIncomeHeight(fn func(btypes.ValAddress, btypes.AccAddress, int64))
- func (mapper *Mapper) IteratorValidatorEcoFeePools(fn func(validatorAddr btypes.ValAddress, pool types.ValidatorEcoFeePool))
- func (mapper *Mapper) IteratorValidatorsCurrentPeriod(fn func(btypes.ValAddress, types.ValidatorCurrentPeriodSummary))
- func (mapper *Mapper) IteratorValidatorsHistoryPeriod(fn func(valAddr btypes.ValAddress, period int64, frac qtypes.Fraction))
- func (mapper *Mapper) MinusValidatorEcoFeePool(validatorAddr btypes.ValAddress, bonusReward btypes.BigInt)
- func (mapper *Mapper) ModifyDelegatorTokens(validator stake.Validator, deleAddr btypes.AccAddress, ...) error
- func (mapper *Mapper) SaveValidatorEcoFeePool(validatorAddr btypes.ValAddress, pool types.ValidatorEcoFeePool)
- func (mapper *Mapper) SetCommunityFeePool(communityFee btypes.BigInt)
- func (mapper *Mapper) SetLastBlockProposer(proposer btypes.ConsAddress)
- 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.ValAddress, del btypes.AccAddress)
- func (hooks *StakingHooks) AfterValidatorCreated(ctx context.Context, val btypes.ValAddress)
- func (hooks *StakingHooks) AfterValidatorSlashed(ctx context.Context, slashedTokens btypes.BigInt)
- func (hooks *StakingHooks) BeforeDelegationModified(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress, ...)
- func (hooks *StakingHooks) BeforeValidatorRemoved(ctx context.Context, val btypes.ValAddress)
- 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 ¶ added in v0.0.8
社区费池数据检查
func PreDistributionInvariant ¶
待分发奖励检查
func ValidatorFeePoolInvariant ¶
验证节点共享费池检查
Types ¶
type DelegatorIncomeInfoQueryResult ¶
type DelegatorIncomeInfoQueryResult struct { OperatorAddress btypes.ValAddress `json:"validator_address"` ConsPubKey string `json:"consensus_pubkey"` PreviousPeriod int64 `json:"previous_validator_period"` BondToken btypes.BigInt `json:"bond_token"` 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"` }
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 *Mapper) AddValidatorEcoFeePool(validatorAddr btypes.ValAddress, proposerReward, commissionReward, preDistributionReward btypes.BigInt)
func (*Mapper) CalculateDelegatorPeriodRewards ¶
func (mapper *Mapper) CalculateDelegatorPeriodRewards(valAddr btypes.ValAddress, deleAddr btypes.AccAddress, endPeriod, blockHeight int64) (btypes.BigInt, error)
计算delegator在计费点区间的收益
func (*Mapper) CalculateRewardsBetweenPeriod ¶
func (mapper *Mapper) CalculateRewardsBetweenPeriod(valAddr btypes.ValAddress, startPeriod, endPeriod int64, bondTokens btypes.BigInt) btypes.BigInt
计算bondTokens在validator的两个计费点区间的收益
func (*Mapper) ClearPreDistributionQOS ¶
func (mapper *Mapper) ClearPreDistributionQOS()
func (*Mapper) ClearValidatorHistoryPeroid ¶
func (mapper *Mapper) ClearValidatorHistoryPeroid(valAddr btypes.ValAddress, minPeroid int64)
删除validator历史计费点信息,额外保留2个历史数据
func (*Mapper) DelDelegatorEarningStartInfo ¶
func (mapper *Mapper) DelDelegatorEarningStartInfo(valAddr btypes.ValAddress, deleAddr btypes.AccAddress)
func (*Mapper) DeleteDelegatorIncomeInfo ¶
func (mapper *Mapper) DeleteDelegatorIncomeInfo(valAddr btypes.ValAddress, deleAddr btypes.AccAddress)
删除delegator收益计算信息 todo: 某高度下发放收益信息没有删除
func (*Mapper) DeleteDelegatorsEarningStartInfo ¶
func (mapper *Mapper) DeleteDelegatorsEarningStartInfo()
func (*Mapper) DeleteDelegatorsIncomeHeight ¶
func (mapper *Mapper) DeleteDelegatorsIncomeHeight()
func (*Mapper) DeleteValidatorEcoFeePool ¶
func (mapper *Mapper) DeleteValidatorEcoFeePool(validatorAddr btypes.ValAddress)
func (*Mapper) DeleteValidatorPeriodSummaryInfo ¶
func (mapper *Mapper) DeleteValidatorPeriodSummaryInfo(valAddr btypes.ValAddress)
清空validator收益分配相关信息
func (*Mapper) GetCommunityFeePool ¶
func (*Mapper) GetDelegatorEarningStartInfo ¶
func (mapper *Mapper) GetDelegatorEarningStartInfo(valAddr btypes.ValAddress, deleAddr btypes.AccAddress) (info types.DelegatorEarningsStartInfo, exists bool)
func (*Mapper) GetLastBlockProposer ¶
func (mapper *Mapper) GetLastBlockProposer() btypes.ConsAddress
func (*Mapper) GetPreDistributionQOS ¶
func (*Mapper) GetValidatorCurrentPeriodSummary ¶
func (mapper *Mapper) GetValidatorCurrentPeriodSummary(valAddr btypes.ValAddress) (vcps types.ValidatorCurrentPeriodSummary, exists bool)
func (*Mapper) GetValidatorEcoFeePool ¶
func (mapper *Mapper) GetValidatorEcoFeePool(validatorAddr btypes.ValAddress) (pool types.ValidatorEcoFeePool)
func (*Mapper) GetValidatorHistoryPeriodSummary ¶
func (*Mapper) GetValidatorMinPeriodFromDelegators ¶
func (mapper *Mapper) GetValidatorMinPeriodFromDelegators(valAddr btypes.ValAddress) int64
获取validator委托人的最小计费点周期
func (*Mapper) IncrementValidatorPeriod ¶
增加validator收益计费点 1. 保存历史计费点收益汇总信息 2. 更新当前计费点收益信息,返回上一计费点数值
func (*Mapper) InitDelegatorIncomeInfo ¶
func (mapper *Mapper) InitDelegatorIncomeInfo(ctx context.Context, valAddr btypes.ValAddress, deleAddr btypes.AccAddress, bondTokens btypes.BigInt, currHeight int64)
首次Delegate: 1. first delegate 2. unbond all , then delegate
func (*Mapper) InitValidatorPeriodSummaryInfo ¶
func (mapper *Mapper) InitValidatorPeriodSummaryInfo(valAddr btypes.ValAddress) types.ValidatorCurrentPeriodSummary
初始化validator历史计费点汇总收益,当前计费点收益信息.
func (*Mapper) IteratorDelegatorEarningStartInfo ¶
func (mapper *Mapper) IteratorDelegatorEarningStartInfo(fn func(btypes.ValAddress, btypes.AccAddress, types.DelegatorEarningsStartInfo))
func (*Mapper) IteratorDelegatorsIncomeHeight ¶
func (mapper *Mapper) IteratorDelegatorsIncomeHeight(fn func(btypes.ValAddress, btypes.AccAddress, int64))
func (*Mapper) IteratorValidatorEcoFeePools ¶
func (mapper *Mapper) IteratorValidatorEcoFeePools(fn func(validatorAddr btypes.ValAddress, pool types.ValidatorEcoFeePool))
func (*Mapper) IteratorValidatorsCurrentPeriod ¶
func (mapper *Mapper) IteratorValidatorsCurrentPeriod(fn func(btypes.ValAddress, types.ValidatorCurrentPeriodSummary))
func (*Mapper) IteratorValidatorsHistoryPeriod ¶
func (*Mapper) MinusValidatorEcoFeePool ¶
func (mapper *Mapper) MinusValidatorEcoFeePool(validatorAddr btypes.ValAddress, bonusReward btypes.BigInt)
func (*Mapper) ModifyDelegatorTokens ¶
func (mapper *Mapper) ModifyDelegatorTokens(validator stake.Validator, deleAddr btypes.AccAddress, updatedToken btypes.BigInt, blockHeight int64) error
修改delegator绑定的token: 1. 增加validator的计费点 2. 计算delegator在两次计费点间的收益 3. 追加该收益到delegator 收益计算信息中
func (*Mapper) SaveValidatorEcoFeePool ¶
func (mapper *Mapper) SaveValidatorEcoFeePool(validatorAddr btypes.ValAddress, pool types.ValidatorEcoFeePool)
func (*Mapper) SetCommunityFeePool ¶
func (*Mapper) SetLastBlockProposer ¶
func (mapper *Mapper) SetLastBlockProposer(proposer btypes.ConsAddress)
func (*Mapper) SetPreDistributionQOS ¶
type StakingHooks ¶
type StakingHooks struct{}
stake.Hooks接口实现,stake模块mapper初始化时设置StakingHooks
func NewStakingHooks ¶
func NewStakingHooks() *StakingHooks
func (*StakingHooks) AfterDelegationCreated ¶
func (hooks *StakingHooks) AfterDelegationCreated(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress)
创建delegation时初始化分配信息
func (*StakingHooks) AfterValidatorCreated ¶
func (hooks *StakingHooks) AfterValidatorCreated(ctx context.Context, val btypes.ValAddress)
创建validator时初始化分配信息
func (*StakingHooks) AfterValidatorSlashed ¶
func (hooks *StakingHooks) AfterValidatorSlashed(ctx context.Context, slashedTokens btypes.BigInt)
validator惩罚后操作
func (*StakingHooks) BeforeDelegationModified ¶
func (hooks *StakingHooks) BeforeDelegationModified(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress, updateAmount btypes.BigInt)
更新绑定tokens时分配处理逻辑
func (*StakingHooks) BeforeValidatorRemoved ¶
func (hooks *StakingHooks) BeforeValidatorRemoved(ctx context.Context, val btypes.ValAddress)
删除validator时分配处理逻辑
func (*StakingHooks) HookMapper ¶
func (hooks *StakingHooks) HookMapper() string
type ValidatorPeriodInfoQueryResult ¶
type ValidatorPeriodInfoQueryResult struct { OperatorAddress btypes.ValAddress `json:"validator_address"` ConsPubKey string `json:"consensus_pubkey"` Fees btypes.BigInt `json:"fees"` CurrentTokens btypes.BigInt `json:"current_tokens"` CurrentPeriod int64 `json:"current_period"` LastPeriod int64 `json:"last_period"` LastPeriodFraction qtypes.Fraction `json:"last_period_fraction"` }
Click to show internal directories.
Click to hide internal directories.