Documentation ¶
Index ¶
- func DelegationInvariant(module string) qtypes.Invariant
- func Query(ctx context.Context, route []string, req abci.RequestQuery) (res []byte, err btypes.Error)
- func RedelegationInvariant(module string) qtypes.Invariant
- func UnbondingInvariant(module string) qtypes.Invariant
- type DelegationQueryResult
- type Mapper
- func (mapper *Mapper) AddRedelegation(redelegation types.RedelegationInfo)
- func (mapper *Mapper) AddRedelegations(reDelegations []types.RedelegationInfo)
- func (mapper *Mapper) AddUnbondingDelegation(unbonding types.UnbondingDelegationInfo)
- func (mapper *Mapper) AddUnbondingDelegations(unbondingsAdd []types.UnbondingDelegationInfo)
- func (mapper *Mapper) AfterDelegationCreated(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress)
- func (mapper *Mapper) AfterValidatorCreated(ctx context.Context, val btypes.ValAddress)
- func (mapper *Mapper) AfterValidatorSlashed(ctx context.Context, slashedTokes btypes.BigInt)
- func (mapper *Mapper) BeforeDelegationModified(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress, ...)
- func (mapper *Mapper) BeforeValidatorRemoved(ctx context.Context, val btypes.ValAddress)
- func (mapper *Mapper) ChangeValidatorBondTokens(validator types.Validator, updatedTokens btypes.BigInt)
- func (mapper *Mapper) ClearValidatorVoteInfoInWindow(valAddr btypes.ValAddress)
- func (mapper *Mapper) Copy() mapper.IMapper
- func (mapper *Mapper) CreateValidator(validator types.Validator)
- func (mapper *Mapper) DelDelegationInfo(delAddr btypes.AccAddress, valAddr btypes.ValAddress)
- func (mapper *Mapper) DelValidatorVoteInfo(valAddr btypes.ValAddress)
- func (mapper *Mapper) Delegate(ctx context.Context, info types.DelegationInfo, reDelegate bool)
- func (mapper *Mapper) Exists(valAddress btypes.ValAddress) bool
- func (mapper *Mapper) ExistsWithConsensusAddr(consensusAddr btypes.ConsAddress) bool
- func (mapper *Mapper) GetActiveValidatorSet(ascending bool) (validators []btypes.ValAddress)
- func (mapper *Mapper) GetDelegationInfo(delAddr btypes.AccAddress, valAddr btypes.ValAddress) (info types.DelegationInfo, exist bool)
- func (mapper *Mapper) GetDelegationsByValidator(valAddr btypes.ValAddress) (infos []types.DelegationInfo)
- func (mapper *Mapper) GetParams(ctx context.Context) types.Params
- func (mapper *Mapper) GetRedelegation(height int64, delAdd btypes.AccAddress, valAddr btypes.ValAddress) (reDelegation types.RedelegationInfo, exist bool)
- func (mapper *Mapper) GetRedelegationsByDelegator(delegator btypes.AccAddress) (redelegations []types.RedelegationInfo)
- func (mapper *Mapper) GetRedelegationsByFromValidator(validator btypes.ValAddress) (redelegations []types.RedelegationInfo)
- func (mapper *Mapper) GetUnbondingDelegation(height int64, delAddr btypes.AccAddress, valAddr btypes.ValAddress) (unbonding types.UnbondingDelegationInfo, exist bool)
- func (mapper *Mapper) GetUnbondingDelegationsByDelegator(delegator btypes.AccAddress) (unbondings []types.UnbondingDelegationInfo)
- func (mapper *Mapper) GetUnbondingDelegationsByValidator(validator btypes.ValAddress) (unbondings []types.UnbondingDelegationInfo)
- func (mapper *Mapper) GetValidator(valAddress btypes.ValAddress) (validator types.Validator, exists bool)
- func (mapper *Mapper) GetValidatorByConsensusAddr(consensusAddr btypes.ConsAddress) (validator types.Validator, exists bool)
- func (mapper *Mapper) GetValidatorVoteInfo(valAddr btypes.ValAddress) (info types.ValidatorVoteInfo, exists bool)
- func (mapper *Mapper) GetVoteInfoInWindow(valAddr btypes.ValAddress, index int64) (vote bool)
- func (mapper *Mapper) IterateDelegationsInfo(deleAddr btypes.AccAddress, fn func(types.DelegationInfo))
- func (mapper *Mapper) IterateDelegationsValDeleAddr(valAddr btypes.ValAddress, fn func(btypes.ValAddress, btypes.AccAddress))
- func (mapper *Mapper) IterateRedelegationsInfo(fn func([]types.RedelegationInfo))
- func (mapper *Mapper) IterateUnbondingDelegations(fn func([]types.UnbondingDelegationInfo))
- func (mapper *Mapper) IterateValidators(fn func(types.Validator))
- func (mapper *Mapper) IterateVoteInWindowsInfos(fn func(int64, btypes.ValAddress, bool))
- func (mapper *Mapper) IterateVoteInfos(fn func(btypes.ValAddress, types.ValidatorVoteInfo))
- func (mapper *Mapper) IteratorInactiveValidator(fromSecond, endSecond int64) store.Iterator
- func (mapper *Mapper) IteratorInactiveValidatorByTime(fromTime, endTime time.Time) store.Iterator
- func (mapper *Mapper) IteratorValidatorByVoterPower(ascending bool) store.Iterator
- func (mapper *Mapper) KickValidator(valAddress btypes.ValAddress) (validator types.Validator, ok bool)
- func (mapper *Mapper) MakeValidatorActive(valAddress btypes.ValAddress, addTokens btypes.BigInt)
- func (mapper *Mapper) MakeValidatorInactive(valAddress btypes.ValAddress, inactiveHeight int64, inactiveTime time.Time, ...)
- func (mapper *Mapper) ReDelegate(ctx context.Context, delegation types.DelegationInfo, ...)
- func (mapper *Mapper) RemoveRedelegation(height int64, delAddr btypes.AccAddress, valAddr btypes.ValAddress)
- func (mapper *Mapper) RemoveUnbondingDelegation(height int64, delAddr btypes.AccAddress, valAddr btypes.ValAddress)
- func (mapper *Mapper) ResetValidatorVoteInfo(valAddr btypes.ValAddress, info types.ValidatorVoteInfo)
- func (mapper *Mapper) SetDelegationInfo(info types.DelegationInfo)
- func (mapper *Mapper) SetHooks(sh qtypes.Hooks)
- func (mapper *Mapper) SetParams(ctx context.Context, p types.Params)
- func (mapper *Mapper) SetRedelegation(redelegation types.RedelegationInfo)
- func (mapper *Mapper) SetUnbondingDelegation(unbonding types.UnbondingDelegationInfo)
- func (mapper *Mapper) SetValidatorVoteInfo(valAddr btypes.ValAddress, info types.ValidatorVoteInfo)
- func (mapper *Mapper) SetVoteInfoInWindow(valAddr btypes.ValAddress, index int64, vote bool)
- func (mapper *Mapper) SlashRedelegations(valAddr btypes.ValAddress, infractionHeight int64, fraction qtypes.Dec, ...) btypes.BigInt
- func (mapper *Mapper) SlashUnbondings(valAddr btypes.ValAddress, infractionHeight int64, fraction qtypes.Dec, ...) btypes.BigInt
- func (mapper *Mapper) UnbondTokens(ctx context.Context, info types.DelegationInfo, tokens btypes.BigInt)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DelegationQueryResult ¶
type DelegationQueryResult struct { DelegatorAddr btypes.AccAddress `json:"delegator_address"` ValidatorAddr btypes.ValAddress `json:"validator_address"` ValidatorConsensusPubKey string `json:"validator_cons_pub_key"` Amount btypes.BigInt `json:"delegate_amount"` IsCompound bool `json:"is_compound"` }
func NewDelegationQueryResult ¶
func NewDelegationQueryResult(deleAddr btypes.AccAddress, ownerAddr btypes.ValAddress, bench32ConPubKey string, amount btypes.BigInt, compound bool) DelegationQueryResult
type Mapper ¶
type Mapper struct { *mapper.BaseMapper // contains filtered or unexported fields }
func (*Mapper) AddRedelegation ¶
func (mapper *Mapper) AddRedelegation(redelegation types.RedelegationInfo)
新增转委托,若存在则累加tokens数量
func (*Mapper) AddRedelegations ¶
func (mapper *Mapper) AddRedelegations(reDelegations []types.RedelegationInfo)
添加转委托信息
func (*Mapper) AddUnbondingDelegation ¶
func (mapper *Mapper) AddUnbondingDelegation(unbonding types.UnbondingDelegationInfo)
新增解除委托信息,若存在累加tokens数量
func (*Mapper) AddUnbondingDelegations ¶
func (mapper *Mapper) AddUnbondingDelegations(unbondingsAdd []types.UnbondingDelegationInfo)
添加解除委托信息
func (*Mapper) AfterDelegationCreated ¶
func (mapper *Mapper) AfterDelegationCreated(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress)
func (*Mapper) AfterValidatorCreated ¶
func (mapper *Mapper) AfterValidatorCreated(ctx context.Context, val btypes.ValAddress)
func (*Mapper) AfterValidatorSlashed ¶
func (*Mapper) BeforeDelegationModified ¶
func (mapper *Mapper) BeforeDelegationModified(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress, updateTokes btypes.BigInt)
func (*Mapper) BeforeValidatorRemoved ¶
func (mapper *Mapper) BeforeValidatorRemoved(ctx context.Context, val btypes.ValAddress)
func (*Mapper) ChangeValidatorBondTokens ¶
func (mapper *Mapper) ChangeValidatorBondTokens(validator types.Validator, updatedTokens btypes.BigInt)
更新验证节点绑定tokens,按原tokens从按voting power排序的队列中删除,保存最新验证节点信息
func (*Mapper) ClearValidatorVoteInfoInWindow ¶
func (mapper *Mapper) ClearValidatorVoteInfoInWindow(valAddr btypes.ValAddress)
删除验证节点所有窗口高度投票数据
func (*Mapper) CreateValidator ¶
保存验证节点最新信息
func (*Mapper) DelDelegationInfo ¶
func (mapper *Mapper) DelDelegationInfo(delAddr btypes.AccAddress, valAddr btypes.ValAddress)
删除委托信息
func (*Mapper) DelValidatorVoteInfo ¶
func (mapper *Mapper) DelValidatorVoteInfo(valAddr btypes.ValAddress)
删除验证节点投票信息
func (*Mapper) Exists ¶
func (mapper *Mapper) Exists(valAddress btypes.ValAddress) bool
验证节点是否存在,根据验证节点地址查询
func (*Mapper) ExistsWithConsensusAddr ¶ added in v0.0.8
func (mapper *Mapper) ExistsWithConsensusAddr(consensusAddr btypes.ConsAddress) bool
验证节点是否存在,根据共识地址查询
func (*Mapper) GetActiveValidatorSet ¶
func (mapper *Mapper) GetActiveValidatorSet(ascending bool) (validators []btypes.ValAddress)
获取当前验证节点列表
func (*Mapper) GetDelegationInfo ¶
func (mapper *Mapper) GetDelegationInfo(delAddr btypes.AccAddress, valAddr btypes.ValAddress) (info types.DelegationInfo, exist bool)
获取委托信息
func (*Mapper) GetDelegationsByValidator ¶
func (mapper *Mapper) GetDelegationsByValidator(valAddr btypes.ValAddress) (infos []types.DelegationInfo)
根据验证节点地址获取委托列表
func (*Mapper) GetRedelegation ¶
func (mapper *Mapper) GetRedelegation(height int64, delAdd btypes.AccAddress, valAddr btypes.ValAddress) (reDelegation types.RedelegationInfo, exist bool)
获取转委托信息,完成时间+委托地址+验证节点地址
func (*Mapper) GetRedelegationsByDelegator ¶
func (mapper *Mapper) GetRedelegationsByDelegator(delegator btypes.AccAddress) (redelegations []types.RedelegationInfo)
根据委托地址获取转委托信息
func (*Mapper) GetRedelegationsByFromValidator ¶
func (mapper *Mapper) GetRedelegationsByFromValidator(validator btypes.ValAddress) (redelegations []types.RedelegationInfo)
根据验证节点地址遍历转委托信息
func (*Mapper) GetUnbondingDelegation ¶
func (mapper *Mapper) GetUnbondingDelegation(height int64, delAddr btypes.AccAddress, valAddr btypes.ValAddress) (unbonding types.UnbondingDelegationInfo, exist bool)
获取解除委托信息,完成时间+委托地址+验证节点地址
func (*Mapper) GetUnbondingDelegationsByDelegator ¶
func (mapper *Mapper) GetUnbondingDelegationsByDelegator(delegator btypes.AccAddress) (unbondings []types.UnbondingDelegationInfo)
根据委托账户获取解除委托信息列表
func (*Mapper) GetUnbondingDelegationsByValidator ¶
func (mapper *Mapper) GetUnbondingDelegationsByValidator(validator btypes.ValAddress) (unbondings []types.UnbondingDelegationInfo)
根据验证节点地址获取解除委托信息
func (*Mapper) GetValidator ¶
func (mapper *Mapper) GetValidator(valAddress btypes.ValAddress) (validator types.Validator, exists bool)
根据验证节点地址获取验证节点
func (*Mapper) GetValidatorByConsensusAddr ¶ added in v0.0.8
func (mapper *Mapper) GetValidatorByConsensusAddr(consensusAddr btypes.ConsAddress) (validator types.Validator, exists bool)
根据共识地址获取验证节点信息
func (*Mapper) GetValidatorVoteInfo ¶
func (mapper *Mapper) GetValidatorVoteInfo(valAddr btypes.ValAddress) (info types.ValidatorVoteInfo, exists bool)
获取验证节点投票信息
func (*Mapper) GetVoteInfoInWindow ¶
func (mapper *Mapper) GetVoteInfoInWindow(valAddr btypes.ValAddress, index int64) (vote bool)
某一窗口高度是否投过票
func (*Mapper) IterateDelegationsInfo ¶
func (mapper *Mapper) IterateDelegationsInfo(deleAddr btypes.AccAddress, fn func(types.DelegationInfo))
遍历委托,当deleAddr为空时,遍历所有委托,否则遍历此deleAddr的所有委托
func (*Mapper) IterateDelegationsValDeleAddr ¶
func (mapper *Mapper) IterateDelegationsValDeleAddr(valAddr btypes.ValAddress, fn func(btypes.ValAddress, btypes.AccAddress))
遍历委托,当valAddr为空时,遍历所有委托,否则遍历此valAddr下委托
func (*Mapper) IterateRedelegationsInfo ¶
func (mapper *Mapper) IterateRedelegationsInfo(fn func([]types.RedelegationInfo))
遍历转委托信息
func (*Mapper) IterateUnbondingDelegations ¶
func (mapper *Mapper) IterateUnbondingDelegations(fn func([]types.UnbondingDelegationInfo))
遍历解除委托
func (*Mapper) IterateValidators ¶
遍历验证节点
func (*Mapper) IterateVoteInWindowsInfos ¶
func (mapper *Mapper) IterateVoteInWindowsInfos(fn func(int64, btypes.ValAddress, bool))
遍历验证节点投票窗口期内投票数据
func (*Mapper) IterateVoteInfos ¶
func (mapper *Mapper) IterateVoteInfos(fn func(btypes.ValAddress, types.ValidatorVoteInfo))
遍历验证节点投票信息
func (*Mapper) IteratorInactiveValidator ¶
遍历inactive状态验证节点
func (*Mapper) IteratorInactiveValidatorByTime ¶
遍历inactive状态验证节点
func (*Mapper) IteratorValidatorByVoterPower ¶
遍历active状态验证节点, 按voting power排序
func (*Mapper) KickValidator ¶
func (mapper *Mapper) KickValidator(valAddress btypes.ValAddress) (validator types.Validator, ok bool)
删除验证节点信息
func (*Mapper) MakeValidatorActive ¶
func (mapper *Mapper) MakeValidatorActive(valAddress btypes.ValAddress, addTokens btypes.BigInt)
更新验证节点状态, inactive -> active
func (*Mapper) MakeValidatorInactive ¶
func (mapper *Mapper) MakeValidatorInactive(valAddress btypes.ValAddress, inactiveHeight int64, inactiveTime time.Time, code types.InactiveCode)
更新验证节点状态, active -> inactive
func (*Mapper) ReDelegate ¶
func (mapper *Mapper) ReDelegate(ctx context.Context, delegation types.DelegationInfo, info types.RedelegationInfo)
转委托,执行BeforeDelegationModified hooks方法,保存转委托信息
func (*Mapper) RemoveRedelegation ¶
func (mapper *Mapper) RemoveRedelegation(height int64, delAddr btypes.AccAddress, valAddr btypes.ValAddress)
删除转委托信息
func (*Mapper) RemoveUnbondingDelegation ¶
func (mapper *Mapper) RemoveUnbondingDelegation(height int64, delAddr btypes.AccAddress, valAddr btypes.ValAddress)
删除解除委托信息
func (*Mapper) ResetValidatorVoteInfo ¶
func (mapper *Mapper) ResetValidatorVoteInfo(valAddr btypes.ValAddress, info types.ValidatorVoteInfo)
重置验证节点投票信息
func (*Mapper) SetDelegationInfo ¶
func (mapper *Mapper) SetDelegationInfo(info types.DelegationInfo)
保存委托信息
func (*Mapper) SetRedelegation ¶
func (mapper *Mapper) SetRedelegation(redelegation types.RedelegationInfo)
保存转委托信息
func (*Mapper) SetUnbondingDelegation ¶
func (mapper *Mapper) SetUnbondingDelegation(unbonding types.UnbondingDelegationInfo)
保存解除委托信息
func (*Mapper) SetValidatorVoteInfo ¶
func (mapper *Mapper) SetValidatorVoteInfo(valAddr btypes.ValAddress, info types.ValidatorVoteInfo)
保存验证节点投票信息
func (*Mapper) SetVoteInfoInWindow ¶
func (mapper *Mapper) SetVoteInfoInWindow(valAddr btypes.ValAddress, index int64, vote bool)
设置某窗口高度投票信息
func (*Mapper) SlashRedelegations ¶
func (mapper *Mapper) SlashRedelegations(valAddr btypes.ValAddress, infractionHeight int64, fraction qtypes.Dec, maxSlash btypes.BigInt) btypes.BigInt
从转委托中扣除惩罚
func (*Mapper) SlashUnbondings ¶
func (mapper *Mapper) SlashUnbondings(valAddr btypes.ValAddress, infractionHeight int64, fraction qtypes.Dec, maxSlash btypes.BigInt) btypes.BigInt
从解除委托信息中扣除惩罚
func (*Mapper) UnbondTokens ¶
func (mapper *Mapper) UnbondTokens(ctx context.Context, info types.DelegationInfo, tokens btypes.BigInt)
解除委托, 执行BeforeDelegationModified hooks方法,保存最新delegation