mapper

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDistributionStoreQueryPath

func BuildDistributionStoreQueryPath() []byte

Types

type DelegationMapper

type DelegationMapper struct {
	*mapper.BaseMapper
}

func GetDelegationMapper

func GetDelegationMapper(ctx context.Context) *DelegationMapper

func NewDelegationMapper

func NewDelegationMapper() *DelegationMapper

func (*DelegationMapper) AddDelegatorUnbondingQOSatHeight

func (mapper *DelegationMapper) AddDelegatorUnbondingQOSatHeight(height uint64, delAddr btypes.Address, add_amount uint64)

func (*DelegationMapper) Copy

func (mapper *DelegationMapper) Copy() mapper.IMapper

func (*DelegationMapper) DelDelegationInfo

func (mapper *DelegationMapper) DelDelegationInfo(delAddr btypes.Address, valAddr btypes.Address)

func (*DelegationMapper) GetDelegationInfo

func (mapper *DelegationMapper) GetDelegationInfo(delAddr btypes.Address, valAddr btypes.Address) (info ecotypes.DelegationInfo, exist bool)

func (*DelegationMapper) GetDelegatorUnbondingQOSatHeight

func (mapper *DelegationMapper) GetDelegatorUnbondingQOSatHeight(height uint64, delAdd btypes.Address) (amount uint64, exist bool)

func (*DelegationMapper) IterateDelegationsInfo

func (mapper *DelegationMapper) IterateDelegationsInfo(deleAddr btypes.Address, fn func(ecotypes.DelegationInfo))

func (*DelegationMapper) IterateDelegationsUnbondInfo

func (mapper *DelegationMapper) IterateDelegationsUnbondInfo(fn func(btypes.Address, uint64, uint64))

func (*DelegationMapper) IterateDelegationsValDeleAddr

func (mapper *DelegationMapper) IterateDelegationsValDeleAddr(valAddr btypes.Address, fn func(btypes.Address, btypes.Address))

func (*DelegationMapper) RemoveDelegatorUnbondingQOSatHeight

func (mapper *DelegationMapper) RemoveDelegatorUnbondingQOSatHeight(height uint64, delAddr btypes.Address)

func (*DelegationMapper) SetDelegationInfo

func (mapper *DelegationMapper) SetDelegationInfo(info ecotypes.DelegationInfo)

func (*DelegationMapper) SetDelegatorUnbondingQOSatHeight

func (mapper *DelegationMapper) SetDelegatorUnbondingQOSatHeight(height uint64, delAddr btypes.Address, amount uint64)

type DistributionMapper

type DistributionMapper struct {
	*mapper.BaseMapper
}

func GetDistributionMapper

func GetDistributionMapper(ctx context.Context) *DistributionMapper

func NewDistributionMapper

func NewDistributionMapper() *DistributionMapper

func (*DistributionMapper) AddPreDistributionQOS

func (mapper *DistributionMapper) AddPreDistributionQOS(amount btypes.BigInt)

func (*DistributionMapper) CalculateDelegatorPeriodRewards

func (mapper *DistributionMapper) CalculateDelegatorPeriodRewards(valAddr, deleAddr btypes.Address, endPeriod, blockHeight uint64) (btypes.BigInt, error)

计算delegator在计费点区间的收益

func (*DistributionMapper) CalculateRewardsBetweenPeriod

func (mapper *DistributionMapper) CalculateRewardsBetweenPeriod(valAddr btypes.Address, startPeriod, endPeriod, bondTokens uint64) btypes.BigInt

计算bondTokens在validator的两个计费点区间的收益

func (*DistributionMapper) ClearPreDistributionQOS

func (mapper *DistributionMapper) ClearPreDistributionQOS()

func (*DistributionMapper) Copy

func (mapper *DistributionMapper) Copy() mapper.IMapper

func (*DistributionMapper) DelDelegatorEarningStartInfo

func (mapper *DistributionMapper) DelDelegatorEarningStartInfo(valAddr, deleAddr btypes.Address)

func (*DistributionMapper) DeleteDelegatorIncomeInfo

func (mapper *DistributionMapper) DeleteDelegatorIncomeInfo(valAddr, deleAddr btypes.Address)

删除delegator收益计算信息 todo: 某高度下发放收益信息没有删除

func (*DistributionMapper) DeleteValidatorPeriodSummaryInfo

func (mapper *DistributionMapper) DeleteValidatorPeriodSummaryInfo(valAddr btypes.Address)

清空validator收益分配相关信息

func (*DistributionMapper) GetCommunityFeePool

func (mapper *DistributionMapper) GetCommunityFeePool() btypes.BigInt

func (*DistributionMapper) GetDelegatorEarningStartInfo

func (mapper *DistributionMapper) GetDelegatorEarningStartInfo(valAddr, deleAddr btypes.Address) (info types.DelegatorEarningsStartInfo, exsits bool)

func (*DistributionMapper) GetLastBlockProposer

func (mapper *DistributionMapper) GetLastBlockProposer() btypes.Address

func (*DistributionMapper) GetParams

func (mapper *DistributionMapper) GetParams() (params types.DistributionParams)

func (*DistributionMapper) GetPreDistributionQOS

func (mapper *DistributionMapper) GetPreDistributionQOS() btypes.BigInt

func (*DistributionMapper) GetValidatorCurrentPeriodSummary

func (mapper *DistributionMapper) GetValidatorCurrentPeriodSummary(valAddr btypes.Address) (vcps types.ValidatorCurrentPeriodSummary, exsits bool)

func (*DistributionMapper) GetValidatorHistoryPeriodSummary

func (mapper *DistributionMapper) GetValidatorHistoryPeriodSummary(valAddr btypes.Address, period uint64) (frac qtypes.Fraction)

func (*DistributionMapper) GetValidatorMinPeriodFromDelegators

func (mapper *DistributionMapper) GetValidatorMinPeriodFromDelegators(valAddr btypes.Address) uint64

func (*DistributionMapper) IncrementValidatorPeriod

func (mapper *DistributionMapper) IncrementValidatorPeriod(validator types.Validator) uint64

增加validator收益计费点 1. 保存历史计费点收益汇总信息 2. 更新当前计费点收益信息,返回上一计费点数值

func (*DistributionMapper) InitDelegatorIncomeInfo

func (mapper *DistributionMapper) InitDelegatorIncomeInfo(valAddr, deleAddr btypes.Address, bondTokens, currHeight uint64)

首次Delegate: 1. first delegate 2. unbond all , then delegate

func (*DistributionMapper) InitValidatorPeriodSummaryInfo

func (mapper *DistributionMapper) InitValidatorPeriodSummaryInfo(valAddr btypes.Address) types.ValidatorCurrentPeriodSummary

初始化validator历史计费点汇总收益,当前计费点收益信息.

func (*DistributionMapper) IteratorDelegatorsEarningStartInfo

func (mapper *DistributionMapper) IteratorDelegatorsEarningStartInfo(fn func(btypes.Address, btypes.Address, types.DelegatorEarningsStartInfo))

func (*DistributionMapper) IteratorDelegatorsIncomeHeight

func (mapper *DistributionMapper) IteratorDelegatorsIncomeHeight(fn func(btypes.Address, btypes.Address, uint64))

func (*DistributionMapper) IteratorValidatorsCurrentPeriod

func (mapper *DistributionMapper) IteratorValidatorsCurrentPeriod(fn func(btypes.Address, types.ValidatorCurrentPeriodSummary))

func (*DistributionMapper) IteratorValidatorsHistoryPeriod

func (mapper *DistributionMapper) IteratorValidatorsHistoryPeriod(fn func(valAddr btypes.Address, period uint64, frac qtypes.Fraction))

func (*DistributionMapper) ModifyDelegatorTokens

func (mapper *DistributionMapper) ModifyDelegatorTokens(validator types.Validator, deleAddr btypes.Address, updatedToken, blockHeight uint64) error

修改delegator绑定的token: 1. 增加validator的计费点 2. 计算delegator在两次计费点间的收益 3. 追加该收益到delegator 收益计算信息中

func (*DistributionMapper) SetCommunityFeePool

func (mapper *DistributionMapper) SetCommunityFeePool(communityFee btypes.BigInt)

func (*DistributionMapper) SetLastBlockProposer

func (mapper *DistributionMapper) SetLastBlockProposer(proposer btypes.Address)

func (*DistributionMapper) SetParams

func (mapper *DistributionMapper) SetParams(params types.DistributionParams)

func (*DistributionMapper) SetPreDistributionQOS

func (mapper *DistributionMapper) SetPreDistributionQOS(amount btypes.BigInt)

type MintMapper

type MintMapper struct {
	*mapper.BaseMapper
}

func GetMintMapper

func GetMintMapper(ctx context.Context) *MintMapper

func NewMintMapper

func NewMintMapper() *MintMapper

func (*MintMapper) AddAppliedQOSAmount

func (mapper *MintMapper) AddAppliedQOSAmount(amount uint64)

增加 已分配 QOS amount

func (*MintMapper) AddInflationPhrase

func (mapper *MintMapper) AddInflationPhrase(phrase ecotypes.InflationPhrase)

func (*MintMapper) Copy

func (mapper *MintMapper) Copy() mapper.IMapper

func (*MintMapper) GetAppliedQOSAmount

func (mapper *MintMapper) GetAppliedQOSAmount() (v uint64)

获取已分配QOS总数

func (*MintMapper) GetCurrentInflationPhrase

func (mapper *MintMapper) GetCurrentInflationPhrase() (inflationPhrase ecotypes.InflationPhrase, exist bool)

获取当前的Inflation Phrase

func (*MintMapper) GetCurrentInflationPhraseKey

func (mapper *MintMapper) GetCurrentInflationPhraseKey(newPhrase bool) ([]byte, error)

获取当前Inflation Phrase的键值

func (*MintMapper) GetFirstBlockTime

func (mapper *MintMapper) GetFirstBlockTime() (t int64)

func (*MintMapper) GetMintParams

func (mapper *MintMapper) GetMintParams() ecotypes.MintParams

func (*MintMapper) SetAppliedQOSAmount

func (mapper *MintMapper) SetAppliedQOSAmount(amount uint64)

设置 已分配 QOS amount

func (*MintMapper) SetFirstBlockTime

func (mapper *MintMapper) SetFirstBlockTime(t int64)

func (*MintMapper) SetMintParams

func (mapper *MintMapper) SetMintParams(config ecotypes.MintParams)

设置Params key: MintParamsKey+endtime value: InflationPhrase

func (*MintMapper) SetParams

func (mapper *MintMapper) SetParams(config ecotypes.MintParams)

设置Params key: MintParamsKey+endtime value: InflationPhrase

type ValidatorMapper

type ValidatorMapper struct {
	*mapper.BaseMapper
}

func GetValidatorMapper

func GetValidatorMapper(ctx context.Context) *ValidatorMapper

func NewValidatorMapper

func NewValidatorMapper() *ValidatorMapper

func (*ValidatorMapper) ChangeValidatorBondTokens

func (mapper *ValidatorMapper) ChangeValidatorBondTokens(validator ecotypes.Validator, updatedTokens uint64)

func (*ValidatorMapper) Copy

func (mapper *ValidatorMapper) Copy() mapper.IMapper

func (*ValidatorMapper) CreateValidator

func (mapper *ValidatorMapper) CreateValidator(validator ecotypes.Validator)

func (*ValidatorMapper) Exists

func (mapper *ValidatorMapper) Exists(valAddress btypes.Address) bool

func (*ValidatorMapper) ExistsWithOwner

func (mapper *ValidatorMapper) ExistsWithOwner(owner btypes.Address) bool

func (*ValidatorMapper) GetParams

func (mapper *ValidatorMapper) GetParams() ecotypes.StakeParams

func (*ValidatorMapper) GetValidator

func (mapper *ValidatorMapper) GetValidator(valAddress btypes.Address) (validator ecotypes.Validator, exsits bool)

func (*ValidatorMapper) GetValidatorByOwner

func (mapper *ValidatorMapper) GetValidatorByOwner(owner btypes.Address) (validator ecotypes.Validator, exsits bool)

func (*ValidatorMapper) IterateValidators

func (mapper *ValidatorMapper) IterateValidators(fn func(ecotypes.Validator))

func (*ValidatorMapper) IteratorInactiveValidator

func (mapper *ValidatorMapper) IteratorInactiveValidator(fromSecond, endSecond uint64) store.Iterator

func (*ValidatorMapper) IteratorInactiveValidatorByTime

func (mapper *ValidatorMapper) IteratorInactiveValidatorByTime(fromTime, endTime time.Time) store.Iterator

func (*ValidatorMapper) IteratorValidatrorByVoterPower

func (mapper *ValidatorMapper) IteratorValidatrorByVoterPower(ascending bool) store.Iterator

func (*ValidatorMapper) KickValidator

func (mapper *ValidatorMapper) KickValidator(valAddress btypes.Address) (validator ecotypes.Validator, ok bool)

func (*ValidatorMapper) MakeValidatorActive

func (mapper *ValidatorMapper) MakeValidatorActive(valAddress btypes.Address)

func (*ValidatorMapper) MakeValidatorInactive

func (mapper *ValidatorMapper) MakeValidatorInactive(valAddress btypes.Address, inactiveHeight uint64, inactiveTime time.Time, code ecotypes.InactiveCode)

func (*ValidatorMapper) SetParams

func (mapper *ValidatorMapper) SetParams(params ecotypes.StakeParams)

type VoteInfoMapper

type VoteInfoMapper struct {
	*mapper.BaseMapper
}

func GetVoteInfoMapper

func GetVoteInfoMapper(ctx context.Context) *VoteInfoMapper

func NewVoteInfoMapper

func NewVoteInfoMapper() *VoteInfoMapper

func (*VoteInfoMapper) ClearValidatorVoteInfoInWindow

func (mapper *VoteInfoMapper) ClearValidatorVoteInfoInWindow(valAddr btypes.Address)

func (*VoteInfoMapper) Copy

func (mapper *VoteInfoMapper) Copy() mapper.IMapper

func (*VoteInfoMapper) DelValidatorVoteInfo

func (mapper *VoteInfoMapper) DelValidatorVoteInfo(valAddr btypes.Address)

func (*VoteInfoMapper) GetValidatorVoteInfo

func (mapper *VoteInfoMapper) GetValidatorVoteInfo(valAddr btypes.Address) (info types.ValidatorVoteInfo, exsits bool)

func (*VoteInfoMapper) GetVoteInfoInWindow

func (mapper *VoteInfoMapper) GetVoteInfoInWindow(valAddr btypes.Address, index uint64) (vote bool)

func (*VoteInfoMapper) IterateVoteInWindowsInfos

func (mapper *VoteInfoMapper) IterateVoteInWindowsInfos(fn func(uint64, btypes.Address, bool))

func (*VoteInfoMapper) IterateVoteInfos

func (mapper *VoteInfoMapper) IterateVoteInfos(fn func(btypes.Address, types.ValidatorVoteInfo))

func (*VoteInfoMapper) ResetValidatorVoteInfo

func (mapper *VoteInfoMapper) ResetValidatorVoteInfo(valAddr btypes.Address, info types.ValidatorVoteInfo)

func (*VoteInfoMapper) SetValidatorVoteInfo

func (mapper *VoteInfoMapper) SetValidatorVoteInfo(valAddr btypes.Address, info types.ValidatorVoteInfo)

func (*VoteInfoMapper) SetVoteInfoInWindow

func (mapper *VoteInfoMapper) SetVoteInfoInWindow(valAddr btypes.Address, index uint64, vote bool)

Jump to

Keyboard shortcuts

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