Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func ErrBadDelegationAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDenom(codespace sdk.CodespaceType) sdk.Error
- func ErrBadRedelegationAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBadRedelegationDst(codespace sdk.CodespaceType) sdk.Error
- func ErrBadRemoveValidator(codespace sdk.CodespaceType) sdk.Error
- func ErrBadSharesAmount(codespace sdk.CodespaceType) sdk.Error
- func ErrBadSharesPercent(codespace sdk.CodespaceType) sdk.Error
- func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBothShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionChangeRateGTMaxRate(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionChangeRateNegative(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionGTMaxChangeRate(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionGTMaxRate(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionHuge(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionNegative(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionUpdateTime(codespace sdk.CodespaceType) sdk.Error
- func ErrConflictingRedelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrDelegationValidatorEmpty(codespace sdk.CodespaceType) sdk.Error
- func ErrDelegatorShareExRateInvalid(codespace sdk.CodespaceType) sdk.Error
- func ErrDescriptionLength(codespace sdk.CodespaceType, descriptor string, got, max int) sdk.Error
- func ErrExistingUnbondingDelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrInsufficientShares(codespace sdk.CodespaceType) sdk.Error
- func ErrMissingSignature(codespace sdk.CodespaceType) sdk.Error
- func ErrNeitherShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
- func ErrNilDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrNoDelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrNoDelegatorForAddress(codespace sdk.CodespaceType) sdk.Error
- func ErrNoRedelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrNoUnbondingDelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrNoValidatorFound(codespace sdk.CodespaceType) sdk.Error
- func ErrNotEnoughDelegationShares(codespace sdk.CodespaceType, shares string) sdk.Error
- func ErrNotMature(codespace sdk.CodespaceType, operation, descriptor string, got, min time.Time) sdk.Error
- func ErrSelfRedelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrTransitiveRedelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorOwnerExists(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorPubKeyTypeNotSupported(codespace sdk.CodespaceType, keyType string, supportedTypes []string) sdk.Error
- func MustMarshalDelegation(cdc *codec.Codec, delegation Delegation) []byte
- func MustMarshalRED(cdc *codec.Codec, red Redelegation) []byte
- func MustMarshalUBD(cdc *codec.Codec, ubd UnbondingDelegation) []byte
- func MustMarshalValidator(cdc *codec.Codec, validator Validator) []byte
- func RegisterCodec(cdc *codec.Codec)
- func ValidateParams(p Params) error
- type BondedPool
- type CodeType
- type Commission
- type CommissionMsg
- type DVPair
- type DVVTriplet
- type Delegation
- type Description
- type GenesisState
- type LastValidatorPower
- type MsgBeginRedelegate
- type MsgBeginUnbonding
- type MsgCreateValidator
- type MsgDelegate
- type MsgEditValidator
- type Params
- func (p Params) Equal(p2 Params) bool
- func (p *Params) GetParamSpace() string
- func (p Params) HumanReadableString() string
- func (p *Params) KeyValuePairs() params.KeyValuePairs
- func (p *Params) ReadOnly() bool
- func (p Params) String() string
- func (p *Params) StringFromBytes(cdc *codec.Codec, key string, bytes []byte) (string, error)
- func (p *Params) Validate(key string, value string) (interface{}, sdk.Error)
- type Pool
- type PoolStatus
- type Redelegation
- type UnbondingDelegation
- type Validator
- func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate
- func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate
- func (v Validator) AddTokensFromDel(ctx sdk.Context, pool Pool, amount sdk.Int) (Validator, Pool, sdk.Dec)
- func (v Validator) BondedTokens() sdk.Dec
- func (v Validator) ConsAddress() sdk.ConsAddress
- func (v Validator) DelegatorShareExRate() sdk.Dec
- func (v Validator) Equal(v2 Validator) bool
- func (v Validator) GetBondHeight() int64
- func (v Validator) GetCommission() sdk.Dec
- func (v Validator) GetConsAddr() sdk.ConsAddress
- func (v Validator) GetConsPubKey() crypto.PubKey
- func (v Validator) GetDelegatorShares() sdk.Dec
- func (v Validator) GetJailed() bool
- func (v Validator) GetMoniker() string
- func (v Validator) GetOperator() sdk.ValAddress
- func (v Validator) GetPotentialPower() sdk.Dec
- func (v Validator) GetPower() sdk.Dec
- func (v Validator) GetStatus() sdk.BondStatus
- func (v Validator) GetTokens() sdk.Dec
- func (v Validator) HumanReadableString() (string, error)
- func (v Validator) MarshalJSON() ([]byte, error)
- func (v Validator) RemoveDelShares(ctx sdk.Context, pool Pool, delShares sdk.Dec) (Validator, Pool, sdk.Dec)
- func (v Validator) RemoveTokens(ctx sdk.Context, pool Pool, tokens sdk.Dec) (Validator, Pool)
- func (v Validator) SetInitialCommission(commission Commission) (Validator, sdk.Error)
- func (v *Validator) UnmarshalJSON(data []byte) error
- func (v Validator) UpdateStatus(ctx sdk.Context, pool Pool, NewStatus sdk.BondStatus) (Validator, Pool)
Constants ¶
const ( // Default parameter namespace DefaultParamSpace = "stake" // Delay, in blocks, between when validator updates are returned to Tendermint and when they are applied // For example, if this is 0, the validator set at the end of a block will sign the next block, or // if this is 1, the validator set at the end of a block will sign the block after the next. // Constant as this should not change without a hard fork. ValidatorUpdateDelay int64 = 1 // Stake token denomination "iris-atto" StakeDenom = sdk.IrisAtto )
const DoNotModifyDesc = "[do-not-modify]"
constant used in flags to indicate that description field should not be updated
const MsgRoute = "stake"
name to identify transaction routes
Variables ¶
var ( KeyUnbondingTime = []byte("UnbondingTime") KeyMaxValidators = []byte("MaxValidators") )
nolint - Keys for parameter access
var MsgCdc *codec.Codec
generic sealed codec to be used throughout sdk
Functions ¶
func ErrBadDelegationAddr ¶
func ErrBadDelegationAddr(codespace sdk.CodespaceType) sdk.Error
func ErrBadDelegationAmount ¶
func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error
func ErrBadDelegatorAddr ¶
func ErrBadDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrBadDenom ¶
func ErrBadDenom(codespace sdk.CodespaceType) sdk.Error
func ErrBadRedelegationAddr ¶
func ErrBadRedelegationAddr(codespace sdk.CodespaceType) sdk.Error
func ErrBadRedelegationDst ¶
func ErrBadRedelegationDst(codespace sdk.CodespaceType) sdk.Error
func ErrBadRemoveValidator ¶
func ErrBadRemoveValidator(codespace sdk.CodespaceType) sdk.Error
func ErrBadSharesAmount ¶
func ErrBadSharesAmount(codespace sdk.CodespaceType) sdk.Error
func ErrBadSharesPercent ¶
func ErrBadSharesPercent(codespace sdk.CodespaceType) sdk.Error
func ErrBadValidatorAddr ¶
func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrBothShareMsgsGiven ¶
func ErrBothShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionChangeRateGTMaxRate ¶
func ErrCommissionChangeRateGTMaxRate(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionChangeRateNegative ¶
func ErrCommissionChangeRateNegative(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionGTMaxChangeRate ¶
func ErrCommissionGTMaxChangeRate(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionGTMaxRate ¶
func ErrCommissionGTMaxRate(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionHuge ¶
func ErrCommissionHuge(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionNegative ¶
func ErrCommissionNegative(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionUpdateTime ¶
func ErrCommissionUpdateTime(codespace sdk.CodespaceType) sdk.Error
func ErrConflictingRedelegation ¶
func ErrConflictingRedelegation(codespace sdk.CodespaceType) sdk.Error
func ErrDelegationValidatorEmpty ¶
func ErrDelegationValidatorEmpty(codespace sdk.CodespaceType) sdk.Error
func ErrDelegatorShareExRateInvalid ¶
func ErrDelegatorShareExRateInvalid(codespace sdk.CodespaceType) sdk.Error
func ErrDescriptionLength ¶
func ErrExistingUnbondingDelegation ¶
func ErrExistingUnbondingDelegation(codespace sdk.CodespaceType) sdk.Error
func ErrInsufficientShares ¶
func ErrInsufficientShares(codespace sdk.CodespaceType) sdk.Error
func ErrMissingSignature ¶
func ErrMissingSignature(codespace sdk.CodespaceType) sdk.Error
func ErrNeitherShareMsgsGiven ¶
func ErrNeitherShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
func ErrNilDelegatorAddr ¶
func ErrNilDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
func ErrNilValidatorAddr ¶
func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error
validator
func ErrNoDelegation ¶
func ErrNoDelegation(codespace sdk.CodespaceType) sdk.Error
func ErrNoDelegatorForAddress ¶
func ErrNoDelegatorForAddress(codespace sdk.CodespaceType) sdk.Error
func ErrNoRedelegation ¶
func ErrNoRedelegation(codespace sdk.CodespaceType) sdk.Error
func ErrNoUnbondingDelegation ¶
func ErrNoUnbondingDelegation(codespace sdk.CodespaceType) sdk.Error
func ErrNoValidatorFound ¶
func ErrNoValidatorFound(codespace sdk.CodespaceType) sdk.Error
func ErrNotEnoughDelegationShares ¶
func ErrNotEnoughDelegationShares(codespace sdk.CodespaceType, shares string) sdk.Error
func ErrNotMature ¶
func ErrSelfRedelegation ¶
func ErrSelfRedelegation(codespace sdk.CodespaceType) sdk.Error
func ErrTransitiveRedelegation ¶
func ErrTransitiveRedelegation(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorJailed ¶
func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorOwnerExists ¶
func ErrValidatorOwnerExists(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorPubKeyExists ¶
func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error
func MustMarshalDelegation ¶
func MustMarshalDelegation(cdc *codec.Codec, delegation Delegation) []byte
return the delegation without fields contained within the key for the store
func MustMarshalRED ¶
func MustMarshalRED(cdc *codec.Codec, red Redelegation) []byte
return the redelegation without fields contained within the key for the store
func MustMarshalUBD ¶
func MustMarshalUBD(cdc *codec.Codec, ubd UnbondingDelegation) []byte
return the unbonding delegation without fields contained within the key for the store
func MustMarshalValidator ¶
return the redelegation without fields contained within the key for the store
func ValidateParams ¶
Types ¶
type BondedPool ¶
type CodeType ¶
const ( DefaultCodespace sdk.CodespaceType = "stake" CodeInvalidValidator CodeType = 101 CodeInvalidDelegation CodeType = 102 CodeInvalidInput CodeType = 103 CodeValidatorJailed CodeType = 104 CodeInvalidAddress CodeType = sdk.CodeInvalidAddress CodeInternal CodeType = sdk.CodeInternal CodeUnknownRequest CodeType = sdk.CodeUnknownRequest )
type Commission ¶
type Commission struct { Rate sdk.Dec `json:"rate"` // the commission rate charged to delegators MaxRate sdk.Dec `json:"max_rate"` // maximum commission rate which validator can ever charge MaxChangeRate sdk.Dec `json:"max_change_rate"` // maximum daily increase of the validator commission UpdateTime time.Time `json:"update_time"` // the last time the commission rate was changed }
Commission defines a commission parameters for a given validator.
func NewCommission ¶
func NewCommission(rate, maxRate, maxChangeRate sdk.Dec) Commission
NewCommission returns an initialized validator commission.
func NewCommissionWithTime ¶
func NewCommissionWithTime(rate, maxRate, maxChangeRate sdk.Dec, updatedAt time.Time) Commission
NewCommission returns an initialized validator commission with a specified update time which should be the current block BFT time.
func (Commission) Equal ¶
func (c Commission) Equal(c2 Commission) bool
Equal checks if the given Commission object is equal to the receiving Commission object.
func (Commission) String ¶
func (c Commission) String() string
String implements the Stringer interface for a Commission.
func (Commission) Validate ¶
func (c Commission) Validate() sdk.Error
Validate performs basic sanity validation checks of initial commission parameters. If validation fails, an SDK error is returned.
func (Commission) ValidateNewRate ¶
ValidateNewRate performs basic sanity validation checks of a new commission rate. If validation fails, an SDK error is returned.
type CommissionMsg ¶
type CommissionMsg struct { Rate sdk.Dec `json:"rate"` // the commission rate charged to delegators MaxRate sdk.Dec `json:"max_rate"` // maximum commission rate which validator can ever charge MaxChangeRate sdk.Dec `json:"max_change_rate"` // maximum daily increase of the validator commission }
CommissionMsg defines a commission message to be used for creating a validator.
func NewCommissionMsg ¶
func NewCommissionMsg(rate, maxRate, maxChangeRate sdk.Dec) CommissionMsg
NewCommissionMsg returns an initialized validator commission message.
type DVPair ¶
type DVPair struct { DelegatorAddr sdk.AccAddress ValidatorAddr sdk.ValAddress }
DVPair is struct that just has a delegator-validator pair with no other data. It is intended to be used as a marshalable pointer. For example, a DVPair can be used to construct the key to getting an UnbondingDelegation from state.
type DVVTriplet ¶
type DVVTriplet struct { DelegatorAddr sdk.AccAddress ValidatorSrcAddr sdk.ValAddress ValidatorDstAddr sdk.ValAddress }
DVVTriplet is struct that just has a delegator-validator-validator triplet with no other data. It is intended to be used as a marshalable pointer. For example, a DVVTriplet can be used to construct the key to getting a Redelegation from state.
type Delegation ¶
type Delegation struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorAddr sdk.ValAddress `json:"validator_addr"` Height int64 `json:"height"` // Last height bond updated }
Delegation represents the bond with tokens held by an account. It is owned by one delegator, and is associated with the voting power of one pubKey.
func MustUnmarshalDelegation ¶
func MustUnmarshalDelegation(cdc *codec.Codec, key, value []byte) Delegation
return the delegation without fields contained within the key for the store
func UnmarshalDelegation ¶
func UnmarshalDelegation(cdc *codec.Codec, key, value []byte) (delegation Delegation, err error)
return the delegation without fields contained within the key for the store
func (Delegation) GetDelegatorAddr ¶
func (d Delegation) GetDelegatorAddr() sdk.AccAddress
nolint - for sdk.Delegation
func (Delegation) GetShares ¶
func (d Delegation) GetShares() sdk.Dec
func (Delegation) GetValidatorAddr ¶
func (d Delegation) GetValidatorAddr() sdk.ValAddress
func (Delegation) HumanReadableString ¶
func (d Delegation) HumanReadableString() (string, error)
HumanReadableString returns a human readable string representation of a Delegation. An error is returned if the Delegation's delegator or validator addresses cannot be Bech32 encoded.
type Description ¶
type Description struct { Moniker string `json:"moniker"` // name Identity string `json:"identity"` // optional identity signature (ex. UPort or Keybase) Website string `json:"website"` // optional website link Details string `json:"details"` // optional details }
Description - description fields for a validator
func NewDescription ¶
func NewDescription(moniker, identity, website, details string) Description
NewDescription returns a new Description with the provided values.
func (Description) EnsureLength ¶
func (d Description) EnsureLength() (Description, sdk.Error)
EnsureLength ensures the length of a validator's description.
func (Description) String ¶ added in v0.16.0
func (d Description) String() string
String implements the Stringer interface for a Description.
func (Description) UpdateDescription ¶
func (d Description) UpdateDescription(d2 Description) (Description, sdk.Error)
UpdateDescription updates the fields of a given description. An error is returned if the resulting description contains an invalid length.
type GenesisState ¶
type GenesisState struct { BondedPool BondedPool `json:"pool"` Params Params `json:"params"` LastTotalPower sdk.Int `json:"last_total_power"` LastValidatorPowers []LastValidatorPower `json:"last_validator_powers"` Validators []Validator `json:"validators"` Bonds []Delegation `json:"bonds"` UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations"` Redelegations []Redelegation `json:"redelegations"` Exported bool `json:"exported"` }
GenesisState - all staking state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func NewGenesisState ¶
func NewGenesisState(bondedPool BondedPool, params Params, validators []Validator, bonds []Delegation) GenesisState
type LastValidatorPower ¶
type LastValidatorPower struct { Address sdk.ValAddress Power sdk.Int }
Last validator power, needed for validator set update logic
type MsgBeginRedelegate ¶
type MsgBeginRedelegate struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorSrcAddr sdk.ValAddress `json:"validator_src_addr"` ValidatorDstAddr sdk.ValAddress `json:"validator_dst_addr"` }
MsgDelegate - struct for bonding transactions
func NewMsgBeginRedelegate ¶
func NewMsgBeginRedelegate(delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, sharesAmount sdk.Dec) MsgBeginRedelegate
func (MsgBeginRedelegate) GetSignBytes ¶
func (msg MsgBeginRedelegate) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgBeginRedelegate) GetSigners ¶
func (msg MsgBeginRedelegate) GetSigners() []sdk.AccAddress
func (MsgBeginRedelegate) Type ¶
func (msg MsgBeginRedelegate) Type() string
func (MsgBeginRedelegate) ValidateBasic ¶
func (msg MsgBeginRedelegate) ValidateBasic() sdk.Error
quick validity check
type MsgBeginUnbonding ¶
type MsgBeginUnbonding struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorAddr sdk.ValAddress `json:"validator_addr"` }
MsgBeginUnbonding - struct for unbonding transactions
func NewMsgBeginUnbonding ¶
func NewMsgBeginUnbonding(delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount sdk.Dec) MsgBeginUnbonding
func (MsgBeginUnbonding) GetSignBytes ¶
func (msg MsgBeginUnbonding) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgBeginUnbonding) GetSigners ¶
func (msg MsgBeginUnbonding) GetSigners() []sdk.AccAddress
func (MsgBeginUnbonding) Type ¶
func (msg MsgBeginUnbonding) Type() string
func (MsgBeginUnbonding) ValidateBasic ¶
func (msg MsgBeginUnbonding) ValidateBasic() sdk.Error
quick validity check
type MsgCreateValidator ¶
type MsgCreateValidator struct { Description Commission CommissionMsg DelegatorAddr sdk.AccAddress `json:"delegator_address"` ValidatorAddr sdk.ValAddress `json:"validator_address"` PubKey crypto.PubKey `json:"pubkey"` Delegation sdk.Coin `json:"delegation"` }
MsgCreateValidator - struct for bonding transactions
func NewMsgCreateValidator ¶
func NewMsgCreateValidator(valAddr sdk.ValAddress, pubkey crypto.PubKey, selfDelegation sdk.Coin, description Description, commission CommissionMsg) MsgCreateValidator
Default way to create validator. Delegator address and validator address are the same
func NewMsgCreateValidatorOnBehalfOf ¶
func NewMsgCreateValidatorOnBehalfOf(delAddr sdk.AccAddress, valAddr sdk.ValAddress, pubkey crypto.PubKey, delegation sdk.Coin, description Description, commission CommissionMsg) MsgCreateValidator
Creates validator msg by delegator address on behalf of validator address
func (MsgCreateValidator) GetSignBytes ¶
func (msg MsgCreateValidator) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgCreateValidator) GetSigners ¶
func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress
Return address(es) that must sign over msg.GetSignBytes()
func (MsgCreateValidator) Type ¶
func (msg MsgCreateValidator) Type() string
func (MsgCreateValidator) ValidateBasic ¶
func (msg MsgCreateValidator) ValidateBasic() sdk.Error
quick validity check
type MsgDelegate ¶
type MsgDelegate struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorAddr sdk.ValAddress `json:"validator_addr"` Delegation sdk.Coin `json:"delegation"` }
MsgDelegate - struct for bonding transactions
func NewMsgDelegate ¶
func NewMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, delegation sdk.Coin) MsgDelegate
func (MsgDelegate) GetSignBytes ¶
func (msg MsgDelegate) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgDelegate) GetSigners ¶
func (msg MsgDelegate) GetSigners() []sdk.AccAddress
func (MsgDelegate) Type ¶
func (msg MsgDelegate) Type() string
func (MsgDelegate) ValidateBasic ¶
func (msg MsgDelegate) ValidateBasic() sdk.Error
quick validity check
type MsgEditValidator ¶
type MsgEditValidator struct { Description ValidatorAddr sdk.ValAddress `json:"address"` // We pass a reference to the new commission rate as it's not mandatory to // update. If not updated, the deserialized rate will be zero with no way to // distinguish if an update was intended. // // REF: #2373 CommissionRate *sdk.Dec `json:"commission_rate"` }
MsgEditValidator - struct for editing a validator
func NewMsgEditValidator ¶
func NewMsgEditValidator(valAddr sdk.ValAddress, description Description, newRate *sdk.Dec) MsgEditValidator
func (MsgEditValidator) GetSignBytes ¶
func (msg MsgEditValidator) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgEditValidator) GetSigners ¶
func (msg MsgEditValidator) GetSigners() []sdk.AccAddress
func (MsgEditValidator) Type ¶
func (msg MsgEditValidator) Type() string
func (MsgEditValidator) ValidateBasic ¶
func (msg MsgEditValidator) ValidateBasic() sdk.Error
quick validity check
type Params ¶
type Params struct { UnbondingTime time.Duration `json:"unbonding_time"` MaxValidators uint16 `json:"max_validators"` // maximum number of validators }
Params defines the high level settings for staking
func (*Params) GetParamSpace ¶
func (Params) HumanReadableString ¶
HumanReadableString returns a human readable string representation of the parameters.
func (*Params) KeyValuePairs ¶
func (p *Params) KeyValuePairs() params.KeyValuePairs
Implements params.Params
func (*Params) StringFromBytes ¶
type Pool ¶
type Pool struct { BankKeeper bank.Keeper BondedPool BondedPool }
Pool - dynamic parameters of the current state
type PoolStatus ¶
type PoolStatus struct { LooseTokens sdk.Dec `json:"loose_tokens"` // tokens which are not bonded in a validator BondedTokens sdk.Dec `json:"bonded_tokens"` // reserve of bonded tokens }
func (PoolStatus) BondedRatio ¶
func (p PoolStatus) BondedRatio() sdk.Dec
get the bond ratio of the global state
func (PoolStatus) HumanReadableString ¶
func (p PoolStatus) HumanReadableString() string
HumanReadableString returns a human readable string representation of a pool.
func (PoolStatus) TokenSupply ¶
func (p PoolStatus) TokenSupply() sdk.Dec
Sum total of all staking tokens in the pool
type Redelegation ¶
type Redelegation struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` // delegator ValidatorSrcAddr sdk.ValAddress `json:"validator_src_addr"` // validator redelegation source operator addr ValidatorDstAddr sdk.ValAddress `json:"validator_dst_addr"` // validator redelegation destination operator addr CreationHeight int64 `json:"creation_height"` // height which the redelegation took place MinTime time.Time `json:"min_time"` // unix time for redelegation completion InitialBalance sdk.Coin `json:"initial_balance"` // initial balance when redelegation started Balance sdk.Coin `json:"balance"` // current balance }
Redelegation reflects a delegation's passive re-delegation queue.
func MustUnmarshalRED ¶
func MustUnmarshalRED(cdc *codec.Codec, key, value []byte) Redelegation
unmarshal a redelegation from a store key and value
func UnmarshalRED ¶
func UnmarshalRED(cdc *codec.Codec, key, value []byte) (red Redelegation, err error)
unmarshal a redelegation from a store key and value
func (Redelegation) HumanReadableString ¶
func (d Redelegation) HumanReadableString() (string, error)
HumanReadableString returns a human readable string representation of a Redelegation. An error is returned if the UnbondingDelegation's delegator or validator addresses cannot be Bech32 encoded.
type UnbondingDelegation ¶
type UnbondingDelegation struct { TxHash string `json:"tx_hash"` DelegatorAddr sdk.AccAddress `json:"delegator_addr"` // delegator ValidatorAddr sdk.ValAddress `json:"validator_addr"` // validator unbonding from operator addr CreationHeight int64 `json:"creation_height"` // height which the unbonding took place MinTime time.Time `json:"min_time"` // unix time for unbonding completion InitialBalance sdk.Coin `json:"initial_balance"` // atoms initially scheduled to receive at completion Balance sdk.Coin `json:"balance"` // atoms to receive at completion }
UnbondingDelegation reflects a delegation's passive unbonding queue.
func MustUnmarshalUBD ¶
func MustUnmarshalUBD(cdc *codec.Codec, key, value []byte) UnbondingDelegation
unmarshal a unbonding delegation from a store key and value
func UnmarshalUBD ¶
func UnmarshalUBD(cdc *codec.Codec, key, value []byte) (ubd UnbondingDelegation, err error)
unmarshal a unbonding delegation from a store key and value
func (UnbondingDelegation) Equal ¶
func (d UnbondingDelegation) Equal(d2 UnbondingDelegation) bool
nolint
func (UnbondingDelegation) HumanReadableString ¶
func (d UnbondingDelegation) HumanReadableString() (string, error)
HumanReadableString returns a human readable string representation of an UnbondingDelegation. An error is returned if the UnbondingDelegation's delegator or validator addresses cannot be Bech32 encoded.
type Validator ¶
type Validator struct { OperatorAddr sdk.ValAddress `json:"operator_address"` // address of the validator's operator; bech encoded in JSON ConsPubKey crypto.PubKey `json:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON Jailed bool `json:"jailed"` // has the validator been jailed from bonded status? Status sdk.BondStatus `json:"status"` // validator status (bonded/unbonding/unbonded) Tokens sdk.Dec `json:"tokens"` // delegated tokens (incl. self-delegation) Description Description `json:"description"` // description terms for the validator BondHeight int64 `json:"bond_height"` // earliest height as a bonded validator UnbondingHeight int64 `json:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding UnbondingMinTime time.Time `json:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding Commission Commission `json:"commission"` // commission parameters }
Validator defines the total amount of bond shares and their exchange rate to coins. Accumulation of interest is modelled as an in increase in the exchange rate, and slashing as a decrease. When coins are delegated to this validator, the validator is credited with a Delegation whose number of bond shares is based on the amount of coins delegated divided by the current exchange rate. Voting power can be calculated as total bonds multiplied by exchange rate.
func MustUnmarshalValidator ¶
unmarshal a redelegation from a store key and value
func NewValidator ¶
func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description) Validator
NewValidator - initialize a new validator
func UnmarshalValidator ¶
func UnmarshalValidator(cdc *codec.Codec, operatorAddr, value []byte) (validator Validator, err error)
unmarshal a redelegation from a store key and value
func (Validator) ABCIValidatorUpdate ¶
func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate
ABCIValidatorUpdate returns an abci.ValidatorUpdate from a staked validator type with the full validator power
func (Validator) ABCIValidatorUpdateZero ¶
func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate
ABCIValidatorUpdateZero returns an abci.ValidatorUpdate from a staked validator type with zero power used for validator updates.
func (Validator) AddTokensFromDel ¶
func (v Validator) AddTokensFromDel(ctx sdk.Context, pool Pool, amount sdk.Int) (Validator, Pool, sdk.Dec)
AddTokensFromDel adds tokens to a validator
func (Validator) BondedTokens ¶
Get the bonded tokens which the validator holds
func (Validator) ConsAddress ¶
func (v Validator) ConsAddress() sdk.ConsAddress
return the TM validator address
func (Validator) DelegatorShareExRate ¶
DelegatorShareExRate gets the exchange rate of tokens over delegator shares. UNITS: tokens/delegator-shares
func (Validator) GetBondHeight ¶
func (Validator) GetCommission ¶
func (Validator) GetConsAddr ¶
func (v Validator) GetConsAddr() sdk.ConsAddress
func (Validator) GetConsPubKey ¶
func (Validator) GetDelegatorShares ¶
func (Validator) GetMoniker ¶
func (Validator) GetOperator ¶
func (v Validator) GetOperator() sdk.ValAddress
func (Validator) GetPotentialPower ¶
func (Validator) GetStatus ¶
func (v Validator) GetStatus() sdk.BondStatus
func (Validator) HumanReadableString ¶
HumanReadableString returns a human readable string representation of a validator. An error is returned if the operator or the operator's public key cannot be converted to Bech32 format.
func (Validator) MarshalJSON ¶
MarshalJSON marshals the validator to JSON using Bech32
func (Validator) RemoveDelShares ¶
func (v Validator) RemoveDelShares(ctx sdk.Context, pool Pool, delShares sdk.Dec) (Validator, Pool, sdk.Dec)
RemoveDelShares removes delegator shares from a validator.
func (Validator) RemoveTokens ¶
removes tokens from a validator
func (Validator) SetInitialCommission ¶
func (v Validator) SetInitialCommission(commission Commission) (Validator, sdk.Error)
SetInitialCommission attempts to set a validator's initial commission. An error is returned if the commission is invalid.
func (*Validator) UnmarshalJSON ¶
UnmarshalJSON unmarshals the validator from JSON using Bech32
func (Validator) UpdateStatus ¶
func (v Validator) UpdateStatus(ctx sdk.Context, pool Pool, NewStatus sdk.BondStatus) (Validator, Pool)
UpdateStatus updates the location of the shares within a validator to reflect the new status