Documentation
¶
Index ¶
- Constants
- func BeginBlocker(ctx context.Context, req abci.RequestBeginBlock)
- func CloseExpireInactiveValidator(ctx context.Context, survivalSecs uint32)
- func EndBlocker(ctx context.Context) (res abci.ResponseEndBlock)
- func EndBlockerByReturnUnbondTokens(ctx context.Context)
- func ErrCodeValidatorInactiveIncome(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func ErrInvalidInput(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func ErrOwnerHasValidator(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func ErrOwnerNoEnoughToken(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func ErrOwnerNotExists(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func ErrValidatorExists(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func ErrValidatorIsActive(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func ErrValidatorIsInactive(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func ErrValidatorNotExists(codeSpace btypes.CodespaceType, msg string) btypes.Error
- func GetUpdatedValidators(ctx context.Context, maxValidatorCount uint64) []abci.ValidatorUpdate
- func InitGenesis(ctx context.Context, data GenesisState)
- func Query(ctx context.Context, route []string, req abci.RequestQuery) (res []byte, err btypes.Error)
- func RegisterCodec(cdc *amino.Codec)
- func ReturnAllUnbondTokens(ctx context.Context)
- func ValidateGenesis(genesisAccounts []*types.QOSAccount, data GenesisState) error
- type DelegationInfoState
- type DelegationQueryResult
- type DelegatorUnbondState
- type GenesisState
- type TxActiveValidator
- func (tx *TxActiveValidator) CalcGas() btypes.BigInt
- func (tx *TxActiveValidator) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
- func (tx *TxActiveValidator) GetGasPayer() btypes.Address
- func (tx *TxActiveValidator) GetSignData() (ret []byte)
- func (tx *TxActiveValidator) GetSigner() []btypes.Address
- func (tx *TxActiveValidator) ValidateData(ctx context.Context) (err error)
- type TxCreateDelegation
- func (tx *TxCreateDelegation) CalcGas() btypes.BigInt
- func (tx *TxCreateDelegation) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
- func (tx *TxCreateDelegation) GetGasPayer() btypes.Address
- func (tx *TxCreateDelegation) GetSignData() (ret []byte)
- func (tx *TxCreateDelegation) GetSigner() []btypes.Address
- func (tx *TxCreateDelegation) ValidateData(ctx context.Context) (err error)
- type TxCreateReDelegation
- func (tx *TxCreateReDelegation) CalcGas() btypes.BigInt
- func (tx *TxCreateReDelegation) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
- func (tx *TxCreateReDelegation) GetGasPayer() btypes.Address
- func (tx *TxCreateReDelegation) GetSignData() (ret []byte)
- func (tx *TxCreateReDelegation) GetSigner() []btypes.Address
- func (tx *TxCreateReDelegation) ValidateData(ctx context.Context) error
- type TxCreateValidator
- func (tx *TxCreateValidator) CalcGas() btypes.BigInt
- func (tx *TxCreateValidator) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
- func (tx *TxCreateValidator) GetGasPayer() btypes.Address
- func (tx *TxCreateValidator) GetSignData() (ret []byte)
- func (tx *TxCreateValidator) GetSigner() []btypes.Address
- func (tx *TxCreateValidator) ValidateData(ctx context.Context) (err error)
- type TxModifyCompound
- func (tx *TxModifyCompound) CalcGas() btypes.BigInt
- func (tx *TxModifyCompound) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
- func (tx *TxModifyCompound) GetGasPayer() btypes.Address
- func (tx *TxModifyCompound) GetSignData() (ret []byte)
- func (tx *TxModifyCompound) GetSigner() []btypes.Address
- func (tx *TxModifyCompound) ValidateData(ctx context.Context) (err error)
- type TxRevokeValidator
- func (tx *TxRevokeValidator) CalcGas() btypes.BigInt
- func (tx *TxRevokeValidator) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
- func (tx *TxRevokeValidator) GetGasPayer() btypes.Address
- func (tx *TxRevokeValidator) GetSignData() (ret []byte)
- func (tx *TxRevokeValidator) GetSigner() []btypes.Address
- func (tx *TxRevokeValidator) ValidateData(ctx context.Context) (err error)
- type TxUnbondDelegation
- func (tx *TxUnbondDelegation) CalcGas() btypes.BigInt
- func (tx *TxUnbondDelegation) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
- func (tx *TxUnbondDelegation) GetGasPayer() btypes.Address
- func (tx *TxUnbondDelegation) GetSignData() (ret []byte)
- func (tx *TxUnbondDelegation) GetSigner() []btypes.Address
- func (tx *TxUnbondDelegation) ValidateData(ctx context.Context) error
- type ValidatorVoteInWindowInfoState
- type ValidatorVoteInfoState
Constants ¶
View Source
const ( DefaultCodeSpace btypes.CodespaceType = "stake" CodeInvalidInput btypes.CodeType = 501 // 输入有误 CodeOwnerNotExists btypes.CodeType = 502 // Owner账户不存在 CodeOwnerNoEnoughToken btypes.CodeType = 503 // Owner账户Tokens不足 CodeValidatorExists btypes.CodeType = 504 // Validator已存在 CodeOwnerHasValidator btypes.CodeType = 505 // Owner已绑定有Validator CodeValidatorNotExists btypes.CodeType = 506 // Validator不存在 CodeValidatorIsActive btypes.CodeType = 507 // Validator处于激活状态 CodeValidatorIsInactive btypes.CodeType = 508 // Validator处于非激活状态 CodeValidatorInactiveIncome btypes.CodeType = 509 // Validator处于非激活状态时收益非法 )
stake errors reserve 500 ~ 599.
View Source
const ( MaxNameLen = 300 MaxDescriptionLen = 1000 )
Variables ¶
This section is empty.
Functions ¶
func BeginBlocker ¶
func BeginBlocker(ctx context.Context, req abci.RequestBeginBlock)
1. 统计validator投票信息, 将不活跃的validator转成Inactive状态
func EndBlocker ¶
func EndBlocker(ctx context.Context) (res abci.ResponseEndBlock)
1. 将所有Inactive到一定期限的validator删除 2. 统计新的validator
func EndBlockerByReturnUnbondTokens ¶
unbond的token返还至delegator账户中
func ErrCodeValidatorInactiveIncome ¶
func ErrCodeValidatorInactiveIncome(codeSpace btypes.CodespaceType, msg string) btypes.Error
func ErrInvalidInput ¶
func ErrInvalidInput(codeSpace btypes.CodespaceType, msg string) btypes.Error
func ErrOwnerHasValidator ¶
func ErrOwnerHasValidator(codeSpace btypes.CodespaceType, msg string) btypes.Error
func ErrOwnerNoEnoughToken ¶
func ErrOwnerNoEnoughToken(codeSpace btypes.CodespaceType, msg string) btypes.Error
func ErrOwnerNotExists ¶
func ErrOwnerNotExists(codeSpace btypes.CodespaceType, msg string) btypes.Error
func ErrValidatorExists ¶
func ErrValidatorExists(codeSpace btypes.CodespaceType, msg string) btypes.Error
func ErrValidatorIsActive ¶
func ErrValidatorIsActive(codeSpace btypes.CodespaceType, msg string) btypes.Error
func ErrValidatorIsInactive ¶
func ErrValidatorIsInactive(codeSpace btypes.CodespaceType, msg string) btypes.Error
func ErrValidatorNotExists ¶
func ErrValidatorNotExists(codeSpace btypes.CodespaceType, msg string) btypes.Error
func GetUpdatedValidators ¶
func GetUpdatedValidators(ctx context.Context, maxValidatorCount uint64) []abci.ValidatorUpdate
func InitGenesis ¶
func InitGenesis(ctx context.Context, data GenesisState)
func RegisterCodec ¶
func ReturnAllUnbondTokens ¶
func ValidateGenesis ¶
func ValidateGenesis(genesisAccounts []*types.QOSAccount, data GenesisState) error
Types ¶
type DelegationInfoState ¶
type DelegationQueryResult ¶
type DelegationQueryResult struct {
DelegatorAddr btypes.Address `json:"delegator_address"`
OwnerAddr btypes.Address `json:"owner_address"`
ValidatorPubKey crypto.PubKey `json:"validator_pub_key"`
Amount uint64 `json:"delegate_amount"`
IsCompound bool `json:"is_compound"`
}
type DelegatorUnbondState ¶
type GenesisState ¶
type GenesisState struct {
Params ecotypes.StakeParams `json:"params"`
Validators []ecotypes.Validator `json:"validators"` //validatorKey, validatorByOwnerKey,validatorByInactiveKey,validatorByVotePowerKey
ValidatorsVoteInfo []ValidatorVoteInfoState `json:"val_votes_info"` //validatorVoteInfoKey
ValidatorsVoteInWindow []ValidatorVoteInWindowInfoState `json:"val_votes_in_window"` //validatorVoteInfoInWindowKey
DelegatorsInfo []DelegationInfoState `json:"delegators_info"` //DelegationByDelValKey, DelegationByValDelKey
DelegatorsUnbondInfo []DelegatorUnbondState `json:"delegator_unbond_info"` //DelegatorUnbondingQOSatHeightKey
CurrentValidators []ecotypes.Validator `json:"current_validators"` // currentValidatorsAddressKey
}
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
func ExportGenesis ¶
func ExportGenesis(ctx context.Context, forZeroHeight bool) GenesisState
func NewGenesisState ¶
func NewGenesisState(params ecotypes.StakeParams, validators []ecotypes.Validator, validatorsVoteInfo []ValidatorVoteInfoState, validatorsVoteInWindow []ValidatorVoteInWindowInfoState, delegatorsInfo []DelegationInfoState, delegatorsUnbondInfo []DelegatorUnbondState, currentValidators []ecotypes.Validator) GenesisState
type TxActiveValidator ¶
func NewActiveValidatorTx ¶
func NewActiveValidatorTx(owner btypes.Address) *TxActiveValidator
func (*TxActiveValidator) CalcGas ¶
func (tx *TxActiveValidator) CalcGas() btypes.BigInt
func (*TxActiveValidator) GetGasPayer ¶
func (tx *TxActiveValidator) GetGasPayer() btypes.Address
func (*TxActiveValidator) GetSignData ¶
func (tx *TxActiveValidator) GetSignData() (ret []byte)
func (*TxActiveValidator) GetSigner ¶
func (tx *TxActiveValidator) GetSigner() []btypes.Address
func (*TxActiveValidator) ValidateData ¶
func (tx *TxActiveValidator) ValidateData(ctx context.Context) (err error)
type TxCreateDelegation ¶
type TxCreateDelegation struct {
Delegator btypes.Address //委托人
ValidatorOwner btypes.Address //验证者Owner
Amount uint64 //委托QOS数量
IsCompound bool //定期收益是否复投
}
func (*TxCreateDelegation) CalcGas ¶
func (tx *TxCreateDelegation) CalcGas() btypes.BigInt
func (*TxCreateDelegation) Exec ¶
func (tx *TxCreateDelegation) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
创建或新增委托
func (*TxCreateDelegation) GetGasPayer ¶
func (tx *TxCreateDelegation) GetGasPayer() btypes.Address
func (*TxCreateDelegation) GetSignData ¶
func (tx *TxCreateDelegation) GetSignData() (ret []byte)
func (*TxCreateDelegation) GetSigner ¶
func (tx *TxCreateDelegation) GetSigner() []btypes.Address
func (*TxCreateDelegation) ValidateData ¶
func (tx *TxCreateDelegation) ValidateData(ctx context.Context) (err error)
type TxCreateReDelegation ¶
type TxCreateReDelegation struct {
Delegator btypes.Address //委托人
FromValidatorOwner btypes.Address //原委托验证人Owner
ToValidatorOwner btypes.Address //现委托验证人Owner
Amount uint64 //委托数量
IsRedelegateAll bool //
IsCompound bool //
}
func (*TxCreateReDelegation) CalcGas ¶
func (tx *TxCreateReDelegation) CalcGas() btypes.BigInt
func (*TxCreateReDelegation) Exec ¶
func (tx *TxCreateReDelegation) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
delegate from one to another
func (*TxCreateReDelegation) GetGasPayer ¶
func (tx *TxCreateReDelegation) GetGasPayer() btypes.Address
func (*TxCreateReDelegation) GetSignData ¶
func (tx *TxCreateReDelegation) GetSignData() (ret []byte)
func (*TxCreateReDelegation) GetSigner ¶
func (tx *TxCreateReDelegation) GetSigner() []btypes.Address
func (*TxCreateReDelegation) ValidateData ¶
func (tx *TxCreateReDelegation) ValidateData(ctx context.Context) error
type TxCreateValidator ¶
type TxCreateValidator struct {
Name string
Owner btypes.Address //操作者, self delegator
PubKey crypto.PubKey //validator公钥
BondTokens uint64 //绑定Token数量
IsCompound bool //周期收益是否复投
Description string
}
func NewCreateValidatorTx ¶
func (*TxCreateValidator) CalcGas ¶
func (tx *TxCreateValidator) CalcGas() btypes.BigInt
func (*TxCreateValidator) GetGasPayer ¶
func (tx *TxCreateValidator) GetGasPayer() btypes.Address
func (*TxCreateValidator) GetSignData ¶
func (tx *TxCreateValidator) GetSignData() (ret []byte)
func (*TxCreateValidator) GetSigner ¶
func (tx *TxCreateValidator) GetSigner() []btypes.Address
func (*TxCreateValidator) ValidateData ¶
func (tx *TxCreateValidator) ValidateData(ctx context.Context) (err error)
type TxModifyCompound ¶
type TxModifyCompound struct {
Delegator btypes.Address //委托人
ValidatorOwner btypes.Address //验证者Owner
IsCompound bool //周期收益是否复投: 收益发放周期内多次修改,仅最后一次生效
}
func (*TxModifyCompound) CalcGas ¶
func (tx *TxModifyCompound) CalcGas() btypes.BigInt
func (*TxModifyCompound) GetGasPayer ¶
func (tx *TxModifyCompound) GetGasPayer() btypes.Address
func (*TxModifyCompound) GetSignData ¶
func (tx *TxModifyCompound) GetSignData() (ret []byte)
func (*TxModifyCompound) GetSigner ¶
func (tx *TxModifyCompound) GetSigner() []btypes.Address
func (*TxModifyCompound) ValidateData ¶
func (tx *TxModifyCompound) ValidateData(ctx context.Context) (err error)
type TxRevokeValidator ¶
func NewRevokeValidatorTx ¶
func NewRevokeValidatorTx(owner btypes.Address) *TxRevokeValidator
func (*TxRevokeValidator) CalcGas ¶
func (tx *TxRevokeValidator) CalcGas() btypes.BigInt
func (*TxRevokeValidator) GetGasPayer ¶
func (tx *TxRevokeValidator) GetGasPayer() btypes.Address
func (*TxRevokeValidator) GetSignData ¶
func (tx *TxRevokeValidator) GetSignData() (ret []byte)
func (*TxRevokeValidator) GetSigner ¶
func (tx *TxRevokeValidator) GetSigner() []btypes.Address
func (*TxRevokeValidator) ValidateData ¶
func (tx *TxRevokeValidator) ValidateData(ctx context.Context) (err error)
type TxUnbondDelegation ¶
type TxUnbondDelegation struct {
Delegator btypes.Address //委托人
ValidatorOwner btypes.Address //验证者Owner
UnbondAmount uint64 //unbond数量
IsUnbondAll bool //是否全部解绑, 为true时覆盖UnbondAmount
}
func (*TxUnbondDelegation) CalcGas ¶
func (tx *TxUnbondDelegation) CalcGas() btypes.BigInt
func (*TxUnbondDelegation) Exec ¶
func (tx *TxUnbondDelegation) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)
unbond delegator tokens
func (*TxUnbondDelegation) GetGasPayer ¶
func (tx *TxUnbondDelegation) GetGasPayer() btypes.Address
func (*TxUnbondDelegation) GetSignData ¶
func (tx *TxUnbondDelegation) GetSignData() (ret []byte)
func (*TxUnbondDelegation) GetSigner ¶
func (tx *TxUnbondDelegation) GetSigner() []btypes.Address
func (*TxUnbondDelegation) ValidateData ¶
func (tx *TxUnbondDelegation) ValidateData(ctx context.Context) error
type ValidatorVoteInfoState ¶
type ValidatorVoteInfoState struct {
ValidatorPubKey crypto.PubKey `json:"validator_pub_key"`
VoteInfo ecotypes.ValidatorVoteInfo `json:"vote_info"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.