Documentation ¶
Index ¶
- Constants
- Variables
- func GetDelegatorKey(delAddr sdk.AccAddress) []byte
- func GetValidatorKey(valAddr sdk.ValAddress) []byte
- func RegisterCodec(cdc sdk.SDKCodec)
- type Commission
- type CommissionRates
- type Delegator
- type DelegatorResp
- type Description
- type MsgAddShares
- type MsgBindProxy
- type MsgCreateValidator
- func (msg MsgCreateValidator) GetSignBytes() []byte
- func (MsgCreateValidator) GetSigners() []sdk.AccAddress
- func (msg MsgCreateValidator) MarshalJSON() ([]byte, error)
- func (MsgCreateValidator) Route() string
- func (MsgCreateValidator) Type() string
- func (MsgCreateValidator) ValidateBasic() sdk.Error
- type MsgDeposit
- type MsgDestroyValidator
- type MsgEditValidator
- type MsgRegProxy
- type MsgUnbindProxy
- type MsgWithdraw
- type Undelegation
- type Validator
- type ValidatorInner
Constants ¶
const ( ModuleName = "staking" UnbondDelegationPath = "custom/staking/unbondingDelegation" )
const
Variables ¶
var ( // ValidatorsKey is useful for subspace and store query about validator ValidatorsKey = []byte{0x21} // DelegatorKey is useful for subspace and store query about delegator DelegatorKey = []byte{0x52} )
Functions ¶
func GetDelegatorKey ¶
func GetDelegatorKey(delAddr sdk.AccAddress) []byte
GetDelegatorKey builds the store key for a specific delegator
func GetValidatorKey ¶
func GetValidatorKey(valAddr sdk.ValAddress) []byte
GetValidatorKey builds the store key for a specific validator
func RegisterCodec ¶
RegisterCodec registers the msg type for staking module
Types ¶
type Commission ¶
type Commission struct { CommissionRates `json:"commission_rates"` UpdateTime time.Time `json:"update_time"` }
Commission defines a commission parameters for a given validator
type CommissionRates ¶
type CommissionRates struct { Rate sdk.Dec `json:"rate"` MaxRate sdk.Dec `json:"max_rate"` MaxChangeRate sdk.Dec `json:"max_change_rate"` }
CommissionRates is a part of Commission
type Delegator ¶
type Delegator struct { DelegatorAddress sdk.AccAddress `json:"delegator_address"` ValidatorAddresses []sdk.ValAddress `json:"validator_address"` Tokens sdk.Dec `json:"tokens"` IsProxy bool `json:"is_proxy"` TotalDelegatedTokens sdk.Dec `json:"total_delegated_tokens"` ProxyAddress sdk.AccAddress `json:"proxy_address"` }
Delegator is the struct of the info of a delegator
func NewDelegator ¶
func NewDelegator(delAddr sdk.AccAddress) Delegator
NewDelegator creates a new instance of Delegator
type DelegatorResp ¶
type DelegatorResp struct { DelegatorAddress sdk.AccAddress `json:"delegator_address"` ValidatorAddresses []sdk.ValAddress `json:"validator_address"` Tokens sdk.Dec `json:"tokens" ` UnbondedTokens sdk.Dec `json:"unbonded_tokens"` CompletionTime time.Time `json:"completion_time"` IsProxy bool `json:"is_proxy"` TotalDelegatedTokens sdk.Dec `json:"total_delegated_tokens"` ProxyAddress sdk.AccAddress `json:"proxy_address"` }
DelegatorResp is designed only for delegator query
func ConvertToDelegatorResp ¶
func ConvertToDelegatorResp(delegator Delegator, undelegation Undelegation) DelegatorResp
ConvertToDelegatorResp builds DelegatorResp with the info of Delegator and Undelegation
type Description ¶
type Description struct { Moniker string `json:"moniker"` Identity string `json:"identity"` Website string `json:"website"` Details string `json:"details"` }
Description shows the detail info of a validator
func NewDescription ¶
func NewDescription(moniker, identity, website, details string) Description
NewDescription creates a new instance of Description
type MsgAddShares ¶ added in v0.11.0
type MsgAddShares struct {}
MsgAddShares - structure for adding-shares transaction
func NewMsgAddShares ¶ added in v0.11.0
func NewMsgAddShares(delAddr sdk.AccAddress, valAddrs []sdk.ValAddress) MsgAddShares
NewMsgAddShares creates a msg of adding shares to vals
func (MsgAddShares) GetSignBytes ¶ added in v0.11.0
func (msg MsgAddShares) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgAddShares) GetSigners ¶ added in v0.11.0
func (MsgAddShares) GetSigners() []sdk.AccAddress
func (MsgAddShares) Type ¶ added in v0.11.0
func (MsgAddShares) Type() string
func (MsgAddShares) ValidateBasic ¶ added in v0.11.0
func (MsgAddShares) ValidateBasic() sdk.Error
type MsgBindProxy ¶
type MsgBindProxy struct { DelAddr sdk.AccAddress `json:"delegator_address"` ProxyAddress sdk.AccAddress `json:"proxy_address"` }
MsgBindProxy - structure for binding proxy relationship between voters and voting proxy
func NewMsgBindProxy ¶
func NewMsgBindProxy(delAddr, proxyAddr sdk.AccAddress) MsgBindProxy
NewMsgBindProxy creates a msg of binding proxy
func (MsgBindProxy) GetSignBytes ¶
func (msg MsgBindProxy) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgBindProxy) GetSigners ¶
func (MsgBindProxy) GetSigners() []sdk.AccAddress
func (MsgBindProxy) Type ¶
func (MsgBindProxy) Type() string
func (MsgBindProxy) ValidateBasic ¶
func (MsgBindProxy) ValidateBasic() sdk.Error
type MsgCreateValidator ¶
type MsgCreateValidator struct { Description Description `json:"description"` MinSelfDelegation sdk.DecCoin `json:"min_self_delegation"` DelegatorAddress sdk.AccAddress `json:"delegator_address"` ValidatorAddress sdk.ValAddress `json:"validator_address"` PubKey crypto.PubKey `json:"pubkey"` }
MsgCreateValidator - structure for creating a validator
func NewMsgCreateValidator ¶
func NewMsgCreateValidator(valAddr sdk.ValAddress, pubKey crypto.PubKey, description Description, ) MsgCreateValidator
NewMsgCreateValidator creates a msg of create-validator Delegator address and validator address are the same
func (MsgCreateValidator) GetSignBytes ¶
func (msg MsgCreateValidator) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCreateValidator) GetSigners ¶
func (MsgCreateValidator) GetSigners() []sdk.AccAddress
func (MsgCreateValidator) MarshalJSON ¶
func (msg MsgCreateValidator) MarshalJSON() ([]byte, error)
MarshalJSON is useful for the signing of msg MsgCreateValidator
func (MsgCreateValidator) Type ¶
func (MsgCreateValidator) Type() string
func (MsgCreateValidator) ValidateBasic ¶
func (MsgCreateValidator) ValidateBasic() sdk.Error
type MsgDeposit ¶ added in v0.11.0
type MsgDeposit struct { DelegatorAddress sdk.AccAddress `json:"delegator_address"` Amount sdk.DecCoin `json:"quantity"` }
MsgDeposit - structure for depositing to the delegator account
func NewMsgDeposit ¶ added in v0.11.0
func NewMsgDeposit(delAddr sdk.AccAddress, amount sdk.DecCoin) MsgDeposit
NewMsgDeposit creates a msg of delegating
func (MsgDeposit) GetSignBytes ¶ added in v0.11.0
func (msg MsgDeposit) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgDeposit) GetSigners ¶ added in v0.11.0
func (MsgDeposit) GetSigners() []sdk.AccAddress
func (MsgDeposit) Type ¶ added in v0.11.0
func (MsgDeposit) Type() string
func (MsgDeposit) ValidateBasic ¶ added in v0.11.0
func (MsgDeposit) ValidateBasic() sdk.Error
type MsgDestroyValidator ¶
type MsgDestroyValidator struct {
DelAddr sdk.AccAddress `json:"delegator_address"`
}
MsgDestroyValidator - structure to deregister a validator
func NewMsgDestroyValidator ¶
func NewMsgDestroyValidator(delAddr sdk.AccAddress) MsgDestroyValidator
NewMsgDestroyValidator creates a msg of destroy-validator
func (MsgDestroyValidator) GetSignBytes ¶
func (msg MsgDestroyValidator) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgDestroyValidator) GetSigners ¶
func (MsgDestroyValidator) GetSigners() []sdk.AccAddress
func (MsgDestroyValidator) Type ¶
func (MsgDestroyValidator) Type() string
func (MsgDestroyValidator) ValidateBasic ¶
func (MsgDestroyValidator) ValidateBasic() sdk.Error
type MsgEditValidator ¶
type MsgEditValidator struct { Description ValidatorAddress sdk.ValAddress `json:"address"` }
MsgEditValidator - structure for editing the info of a validator
func NewMsgEditValidator ¶
func NewMsgEditValidator(valAddr sdk.ValAddress, description Description) MsgEditValidator
NewMsgEditValidator creates a msg of edit-validator
func (MsgEditValidator) GetSignBytes ¶
func (msg MsgEditValidator) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgEditValidator) GetSigners ¶
func (MsgEditValidator) GetSigners() []sdk.AccAddress
func (MsgEditValidator) Type ¶
func (MsgEditValidator) Type() string
func (MsgEditValidator) ValidateBasic ¶
func (MsgEditValidator) ValidateBasic() sdk.Error
type MsgRegProxy ¶
type MsgRegProxy struct { ProxyAddress sdk.AccAddress `json:"proxy_address"` Reg bool `json:"reg"` }
MsgRegProxy - structure to register delegator as proxy or unregister proxy to delegator if Reg == true, action is reg, otherwise action is unreg
func NewMsgRegProxy ¶
func NewMsgRegProxy(proxyAddress sdk.AccAddress, reg bool) MsgRegProxy
NewMsgRegProxy creates a msg of registering or unregistering proxy
func (MsgRegProxy) GetSignBytes ¶
func (msg MsgRegProxy) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgRegProxy) GetSigners ¶
func (MsgRegProxy) GetSigners() []sdk.AccAddress
func (MsgRegProxy) Type ¶
func (MsgRegProxy) Type() string
func (MsgRegProxy) ValidateBasic ¶
func (MsgRegProxy) ValidateBasic() sdk.Error
type MsgUnbindProxy ¶
type MsgUnbindProxy struct {
DelAddr sdk.AccAddress `json:"delegator_address"`
}
MsgUnbindProxy - structure for unbinding proxy relationship between voters and proxy
func NewMsgUnbindProxy ¶
func NewMsgUnbindProxy(delAddr sdk.AccAddress) MsgUnbindProxy
NewMsgUnbindProxy creates a msg of unbinding proxy
func (MsgUnbindProxy) GetSignBytes ¶
func (msg MsgUnbindProxy) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgUnbindProxy) GetSigners ¶
func (MsgUnbindProxy) GetSigners() []sdk.AccAddress
func (MsgUnbindProxy) Type ¶
func (MsgUnbindProxy) Type() string
func (MsgUnbindProxy) ValidateBasic ¶
func (MsgUnbindProxy) ValidateBasic() sdk.Error
type MsgWithdraw ¶ added in v0.11.0
type MsgWithdraw struct { DelegatorAddress sdk.AccAddress `json:"delegator_address" ` Amount sdk.DecCoin `json:"quantity"` }
MsgWithdraw - structure for withdrawing okt and the corresponding shares from all validators
func NewMsgWithdraw ¶ added in v0.11.0
func NewMsgWithdraw(delAddr sdk.AccAddress, amount sdk.DecCoin) MsgWithdraw
NewMsgWithdraw creates a new instance of MsgWithdraw
func (MsgWithdraw) GetSignBytes ¶ added in v0.11.0
func (msg MsgWithdraw) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgWithdraw) GetSigners ¶ added in v0.11.0
func (MsgWithdraw) GetSigners() []sdk.AccAddress
func (MsgWithdraw) Type ¶ added in v0.11.0
func (MsgWithdraw) Type() string
func (MsgWithdraw) ValidateBasic ¶ added in v0.11.0
func (MsgWithdraw) ValidateBasic() sdk.Error
type Undelegation ¶
type Undelegation struct { DelegatorAddress sdk.AccAddress `json:"delegator_address"` Quantity sdk.Dec `json:"quantity"` CompletionTime time.Time `json:"completion_time"` }
Undelegation is the struct of the info for unbonding
func DefaultUndelegation ¶
func DefaultUndelegation() Undelegation
DefaultUndelegation returns default entity for Undelegation
type Validator ¶
type Validator struct { OperatorAddress sdk.ValAddress `json:"operator_address"` ConsPubKey string `json:"consensus_pubkey"` Jailed bool `json:"jailed"` Status byte `json:"status"` Description Description `json:"description"` UnbondingHeight int64 `json:"unbonding_height"` UnbondingCompletionTime time.Time `json:"unbonding_time"` MinSelfDelegation sdk.Dec `json:"min_self_delegation"` }
Validator is the struct of standard validator's detail info
type ValidatorInner ¶
type ValidatorInner struct { OperatorAddress sdk.ValAddress `json:"operator_address"` ConsPubKey crypto.PubKey `json:"consensus_pubkey"` Jailed bool `json:"jailed"` Status byte `json:"status"` Tokens sdk.Int `json:"tokens"` Description Description `json:"description"` UnbondingHeight int64 `json:"unbonding_height"` UnbondingCompletionTime time.Time `json:"unbonding_time"` Commission Commission `json:"commission"` MinSelfDelegation sdk.Dec `json:"min_self_delegation"` }
ValidatorInner is the struct of validator's detail info(inner)
func (ValidatorInner) Standardize ¶
func (vi ValidatorInner) Standardize() (val Validator, err error)
Standardize converts the inner validator to the standard one