Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func AssertInvariants(t *testing.T, msg string, pOrig Pool, cOrig []Validator, pMod Pool, ...)
- func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDelegatorAddr(codespace sdk.CodespaceType) sdk.Error
- func ErrBadDenom(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 ErrBadSharesPrecision(codespace sdk.CodespaceType) sdk.Error
- func ErrBothShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionHuge(codespace sdk.CodespaceType) sdk.Error
- func ErrCommissionNegative(codespace sdk.CodespaceType) sdk.Error
- func ErrDelegationValidatorEmpty(codespace sdk.CodespaceType) sdk.Error
- func ErrDescriptionLength(codespace sdk.CodespaceType, descriptor string, got, max int) 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 int64) sdk.Error
- func ErrTransitiveRedelegation(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorOwnerExists(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error
- func ErrValidatorRevoked(codespace sdk.CodespaceType) sdk.Error
- func MustMarshalDelegation(cdc *wire.Codec, delegation Delegation) []byte
- func MustMarshalRED(cdc *wire.Codec, red Redelegation) []byte
- func MustMarshalUBD(cdc *wire.Codec, ubd UnbondingDelegation) []byte
- func MustMarshalValidator(cdc *wire.Codec, validator Validator) []byte
- func OpAddTokens(r *rand.Rand, pool Pool, validator Validator) (Pool, Validator, sdk.Rat, string)
- func OpBondOrUnbond(r *rand.Rand, pool Pool, validator Validator) (Pool, Validator, sdk.Rat, string)
- func OpRemoveShares(r *rand.Rand, pool Pool, validator Validator) (Pool, Validator, sdk.Rat, string)
- func RandomSetup(r *rand.Rand, numValidators int) (Pool, []Validator)
- func RegisterWire(cdc *wire.Codec)
- type BechValidator
- type CodeType
- type Delegation
- type Description
- type GenesisState
- type MsgBeginRedelegate
- type MsgBeginUnbonding
- type MsgCompleteRedelegate
- type MsgCompleteUnbonding
- type MsgCreateValidator
- type MsgDelegate
- type MsgEditValidator
- type Operation
- type Params
- type Pool
- type Redelegation
- type UnbondingDelegation
- type Validator
- func (v Validator) ABCIValidator() abci.Validator
- func (v Validator) ABCIValidatorZero() abci.Validator
- func (v Validator) AddTokensFromDel(pool Pool, amount int64) (Validator, Pool, sdk.Rat)
- func (v Validator) Bech32Validator() (BechValidator, error)
- func (v Validator) BondedTokens() sdk.Rat
- func (v Validator) DelegatorShareExRate() sdk.Rat
- func (v Validator) Equal(c2 Validator) bool
- func (v Validator) GetBondHeight() int64
- func (v Validator) GetDelegatorShares() sdk.Rat
- func (v Validator) GetMoniker() string
- func (v Validator) GetOwner() sdk.AccAddress
- func (v Validator) GetPower() sdk.Rat
- func (v Validator) GetPubKey() crypto.PubKey
- func (v Validator) GetRevoked() bool
- func (v Validator) GetStatus() sdk.BondStatus
- func (v Validator) HumanReadableString() (string, error)
- func (v Validator) RemoveDelShares(pool Pool, delShares sdk.Rat) (Validator, Pool, sdk.Rat)
- func (v Validator) RemoveTokens(pool Pool, tokens sdk.Rat) (Validator, Pool)
- func (v Validator) UpdateStatus(pool Pool, NewStatus sdk.BondStatus) (Validator, Pool)
Constants ¶
const MaxBondDenominatorPrecision = 8
Maximum amount of decimal points in the decimal representation of rationals used in MsgBeginUnbonding / MsgBeginRedelegate
const MsgType = "stake"
name to idetify transaction types
Variables ¶
var MsgCdc *wire.Codec
generic sealed codec to be used throughout sdk
Functions ¶
func AssertInvariants ¶
func AssertInvariants(t *testing.T, msg string, pOrig Pool, cOrig []Validator, pMod Pool, vMods []Validator)
AssertInvariants ensures invariants that should always be true are true. nolint: unparam
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 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 ErrBadSharesPrecision ¶
func ErrBadSharesPrecision(codespace sdk.CodespaceType) sdk.Error
func ErrBothShareMsgsGiven ¶
func ErrBothShareMsgsGiven(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionHuge ¶
func ErrCommissionHuge(codespace sdk.CodespaceType) sdk.Error
func ErrCommissionNegative ¶
func ErrCommissionNegative(codespace sdk.CodespaceType) sdk.Error
func ErrDelegationValidatorEmpty ¶
func ErrDelegationValidatorEmpty(codespace sdk.CodespaceType) sdk.Error
func ErrDescriptionLength ¶
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 ErrTransitiveRedelegation ¶
func ErrTransitiveRedelegation(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorOwnerExists ¶
func ErrValidatorOwnerExists(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorPubKeyExists ¶
func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error
func ErrValidatorRevoked ¶
func ErrValidatorRevoked(codespace sdk.CodespaceType) sdk.Error
func MustMarshalDelegation ¶
func MustMarshalDelegation(cdc *wire.Codec, delegation Delegation) []byte
return the delegation without fields contained within the key for the store
func MustMarshalRED ¶
func MustMarshalRED(cdc *wire.Codec, red Redelegation) []byte
return the redelegation without fields contained within the key for the store
func MustMarshalUBD ¶
func MustMarshalUBD(cdc *wire.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 OpAddTokens ¶
OpAddTokens implements an operation that adds a random number of tokens to a validator.
func OpBondOrUnbond ¶
func OpBondOrUnbond(r *rand.Rand, pool Pool, validator Validator) (Pool, Validator, sdk.Rat, string)
OpBondOrUnbond implements an operation that bonds or unbonds a validator depending on current status. nolint: unparam TODO split up into multiple operations
func OpRemoveShares ¶
func OpRemoveShares(r *rand.Rand, pool Pool, validator Validator) (Pool, Validator, sdk.Rat, string)
OpRemoveShares implements an operation that removes a random number of delegatorshares from a validator.
func RandomSetup ¶
RandomSetup generates a random staking state.
Types ¶
type BechValidator ¶ added in v0.21.0
type BechValidator struct { Owner sdk.AccAddress `json:"owner"` // in bech32 PubKey string `json:"pub_key"` // in bech32 Revoked bool `json:"revoked"` // has the validator been revoked from bonded status? Status sdk.BondStatus `json:"status"` // validator status (bonded/unbonding/unbonded) Tokens sdk.Rat `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 BondIntraTxCounter int16 `json:"bond_intra_tx_counter"` // block-local tx index of validator change ProposerRewardPool sdk.Coins `json:"proposer_reward_pool"` // XXX reward pool collected from being the proposer Commission sdk.Rat `json:"commission"` // XXX the commission rate of fees charged to any delegators CommissionMax sdk.Rat `json:"commission_max"` // XXX maximum commission rate which this validator can ever charge CommissionChangeRate sdk.Rat `json:"commission_change_rate"` // XXX maximum daily increase of the validator commission CommissionChangeToday sdk.Rat `json:"commission_change_today"` // XXX commission rate change today, reset each day (UTC time) // fee related LastBondedTokens sdk.Rat `json:"prev_bonded_shares"` // last bonded token amount }
validator struct for bech output
type CodeType ¶
const ( DefaultCodespace sdk.CodespaceType = 4 CodeInvalidValidator CodeType = 101 CodeInvalidDelegation CodeType = 102 CodeInvalidInput CodeType = 103 CodeValidatorJailed CodeType = 104 CodeInternal CodeType = sdk.CodeInternal CodeUnknownRequest CodeType = sdk.CodeUnknownRequest )
type Delegation ¶
type Delegation struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorAddr sdk.AccAddress `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 *wire.Codec, key, value []byte) Delegation
return the delegation without fields contained within the key for the store
func UnmarshalDelegation ¶
func UnmarshalDelegation(cdc *wire.Codec, key, value []byte) (delegation Delegation, err error)
return the delegation without fields contained within the key for the store
func (Delegation) GetBondShares ¶
func (d Delegation) GetBondShares() sdk.Rat
func (Delegation) GetDelegator ¶
func (d Delegation) GetDelegator() sdk.AccAddress
nolint - for sdk.Delegation
func (Delegation) GetValidator ¶
func (d Delegation) GetValidator() sdk.AccAddress
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) 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 { Pool Pool `json:"pool"` Params Params `json:"params"` Validators []Validator `json:"validators"` Bonds []Delegation `json:"bonds"` }
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(pool Pool, params Params, validators []Validator, bonds []Delegation) GenesisState
type MsgBeginRedelegate ¶
type MsgBeginRedelegate struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorSrcAddr sdk.AccAddress `json:"validator_src_addr"` ValidatorDstAddr sdk.AccAddress `json:"validator_dst_addr"` }
MsgDelegate - struct for bonding transactions
func NewMsgBeginRedelegate ¶
func NewMsgBeginRedelegate(delegatorAddr, validatorSrcAddr, validatorDstAddr sdk.AccAddress, sharesAmount sdk.Rat) 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) ValidateBasic ¶
func (msg MsgBeginRedelegate) ValidateBasic() sdk.Error
quick validity check
type MsgBeginUnbonding ¶
type MsgBeginUnbonding struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorAddr sdk.AccAddress `json:"validator_addr"` }
MsgBeginUnbonding - struct for unbonding transactions
func NewMsgBeginUnbonding ¶
func NewMsgBeginUnbonding(delegatorAddr, validatorAddr sdk.AccAddress, sharesAmount sdk.Rat) 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) ValidateBasic ¶
func (msg MsgBeginUnbonding) ValidateBasic() sdk.Error
quick validity check
type MsgCompleteRedelegate ¶
type MsgCompleteRedelegate struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorSrcAddr sdk.AccAddress `json:"validator_source_addr"` ValidatorDstAddr sdk.AccAddress `json:"validator_destination_addr"` }
MsgDelegate - struct for bonding transactions
func NewMsgCompleteRedelegate ¶
func NewMsgCompleteRedelegate(delegatorAddr, validatorSrcAddr, validatorDstAddr sdk.AccAddress) MsgCompleteRedelegate
func (MsgCompleteRedelegate) GetSignBytes ¶
func (msg MsgCompleteRedelegate) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgCompleteRedelegate) GetSigners ¶
func (msg MsgCompleteRedelegate) GetSigners() []sdk.AccAddress
func (MsgCompleteRedelegate) ValidateBasic ¶
func (msg MsgCompleteRedelegate) ValidateBasic() sdk.Error
quick validity check
type MsgCompleteUnbonding ¶
type MsgCompleteUnbonding struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorAddr sdk.AccAddress `json:"validator_addr"` }
MsgCompleteUnbonding - struct for unbonding transactions
func NewMsgCompleteUnbonding ¶
func NewMsgCompleteUnbonding(delegatorAddr, validatorAddr sdk.AccAddress) MsgCompleteUnbonding
func (MsgCompleteUnbonding) GetSignBytes ¶
func (msg MsgCompleteUnbonding) GetSignBytes() []byte
get the bytes for the message signer to sign on
func (MsgCompleteUnbonding) GetSigners ¶
func (msg MsgCompleteUnbonding) GetSigners() []sdk.AccAddress
func (MsgCompleteUnbonding) ValidateBasic ¶
func (msg MsgCompleteUnbonding) ValidateBasic() sdk.Error
quick validity check
type MsgCreateValidator ¶
type MsgCreateValidator struct { Description DelegatorAddr sdk.AccAddress `json:"delegator_address"` ValidatorAddr sdk.AccAddress `json:"validator_address"` PubKey crypto.PubKey `json:"pubkey"` Delegation sdk.Coin `json:"delegation"` }
MsgCreateValidator - struct for unbonding transactions
func NewMsgCreateValidator ¶
func NewMsgCreateValidator(validatorAddr sdk.AccAddress, pubkey crypto.PubKey, selfDelegation sdk.Coin, description Description) MsgCreateValidator
Default way to create validator. Delegator address and validator address are the same
func NewMsgCreateValidatorOnBehalfOf ¶ added in v0.21.0
func NewMsgCreateValidatorOnBehalfOf(delegatorAddr, validatorAddr sdk.AccAddress, pubkey crypto.PubKey, delegation sdk.Coin, description Description) 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) ValidateBasic ¶
func (msg MsgCreateValidator) ValidateBasic() sdk.Error
quick validity check
type MsgDelegate ¶
type MsgDelegate struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` ValidatorAddr sdk.AccAddress `json:"validator_addr"` Delegation sdk.Coin `json:"delegation"` }
MsgDelegate - struct for bonding transactions
func NewMsgDelegate ¶
func NewMsgDelegate(delegatorAddr, validatorAddr sdk.AccAddress, 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) ValidateBasic ¶
func (msg MsgDelegate) ValidateBasic() sdk.Error
quick validity check
type MsgEditValidator ¶
type MsgEditValidator struct { Description ValidatorAddr sdk.AccAddress `json:"address"` }
MsgEditValidator - struct for editing a validator
func NewMsgEditValidator ¶
func NewMsgEditValidator(validatorAddr sdk.AccAddress, description Description) 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) ValidateBasic ¶
func (msg MsgEditValidator) ValidateBasic() sdk.Error
quick validity check
type Operation ¶
Operation reflects any operation that transforms staking state. It takes in a RNG instance, pool, validator and returns an updated pool, updated validator, delta tokens, and descriptive message.
func RandomOperation ¶
RandomOperation returns a random staking operation.
type Params ¶
type Params struct { InflationRateChange sdk.Rat `json:"inflation_rate_change"` // maximum annual change in inflation rate InflationMax sdk.Rat `json:"inflation_max"` // maximum inflation rate InflationMin sdk.Rat `json:"inflation_min"` // minimum inflation rate GoalBonded sdk.Rat `json:"goal_bonded"` // Goal of percent bonded atoms UnbondingTime int64 `json:"unbonding_time"` MaxValidators uint16 `json:"max_validators"` // maximum number of validators BondDenom string `json:"bond_denom"` // bondable coin denomination }
Params defines the high level settings for staking
type Pool ¶
type Pool struct { LooseTokens sdk.Rat `json:"loose_tokens"` // tokens which are not bonded in a validator BondedTokens sdk.Rat `json:"bonded_tokens"` // reserve of bonded tokens InflationLastTime int64 `json:"inflation_last_time"` // block which the last inflation was processed // TODO make time Inflation sdk.Rat `json:"inflation"` // current annual inflation rate DateLastCommissionReset int64 `json:"date_last_commission_reset"` // unix timestamp for last commission accounting reset (daily) PrevBondedShares sdk.Rat `json:"prev_bonded_shares"` // last recorded bonded shares - for fee calculations }
Pool - dynamic parameters of the current state
func (Pool) BondedRatio ¶
get the bond ratio of the global state
func (Pool) NextInflation ¶ added in v0.21.0
get the next inflation rate for the hour
func (Pool) ProcessProvisions ¶ added in v0.21.0
process provisions for an hour period
func (Pool) TokenSupply ¶
Sum total of all staking tokens in the pool
type Redelegation ¶
type Redelegation struct { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` // delegator ValidatorSrcAddr sdk.AccAddress `json:"validator_src_addr"` // validator redelegation source owner addr ValidatorDstAddr sdk.AccAddress `json:"validator_dst_addr"` // validator redelegation destination owner addr CreationHeight int64 `json:"creation_height"` // height which the redelegation took place MinTime int64 `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 *wire.Codec, key, value []byte) Redelegation
unmarshal a redelegation from a store key and value
func UnmarshalRED ¶
func UnmarshalRED(cdc *wire.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 { DelegatorAddr sdk.AccAddress `json:"delegator_addr"` // delegator ValidatorAddr sdk.AccAddress `json:"validator_addr"` // validator unbonding from owner addr CreationHeight int64 `json:"creation_height"` // height which the unbonding took place MinTime int64 `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 *wire.Codec, key, value []byte) UnbondingDelegation
unmarshal a unbonding delegation from a store key and value
func UnmarshalUBD ¶
func UnmarshalUBD(cdc *wire.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 { Owner sdk.AccAddress `json:"owner"` // sender of BondTx - UnbondTx returns here PubKey crypto.PubKey `json:"pub_key"` // pubkey of validator Revoked bool `json:"revoked"` // has the validator been revoked from bonded status? Status sdk.BondStatus `json:"status"` // validator status (bonded/unbonding/unbonded) Tokens sdk.Rat `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 BondIntraTxCounter int16 `json:"bond_intra_tx_counter"` // block-local tx index of validator change ProposerRewardPool sdk.Coins `json:"proposer_reward_pool"` // XXX reward pool collected from being the proposer Commission sdk.Rat `json:"commission"` // XXX the commission rate of fees charged to any delegators CommissionMax sdk.Rat `json:"commission_max"` // XXX maximum commission rate which this validator can ever charge CommissionChangeRate sdk.Rat `json:"commission_change_rate"` // XXX maximum daily increase of the validator commission CommissionChangeToday sdk.Rat `json:"commission_change_today"` // XXX commission rate change today, reset each day (UTC time) // fee related LastBondedTokens sdk.Rat `json:"prev_bonded_tokens"` // Previous bonded tokens held }
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(owner sdk.AccAddress, pubKey crypto.PubKey, description Description) Validator
NewValidator - initialize a new validator
func UnmarshalValidator ¶
unmarshal a redelegation from a store key and value
func (Validator) ABCIValidator ¶
ABCIValidator returns an abci.Validator from a staked validator type.
func (Validator) ABCIValidatorZero ¶
ABCIValidatorZero returns an abci.Validator from a staked validator type with with zero power used for validator updates.
func (Validator) AddTokensFromDel ¶
AddTokensFromDel adds tokens to a validator
func (Validator) Bech32Validator ¶ added in v0.21.0
func (v Validator) Bech32Validator() (BechValidator, error)
get the bech validator from the the regular validator
func (Validator) BondedTokens ¶ added in v0.21.0
Get the bonded tokens which the validator holds
func (Validator) DelegatorShareExRate ¶
DelegatorShareExRate gets the exchange rate of tokens over delegator shares. UNITS: tokens/delegator-shares
func (Validator) Equal ¶
only the vitals - does not check bond height of IntraTxCounter nolint gocyclo - why dis fail?
func (Validator) GetBondHeight ¶
func (Validator) GetDelegatorShares ¶
func (Validator) GetMoniker ¶
func (Validator) GetOwner ¶
func (v Validator) GetOwner() sdk.AccAddress
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 owner or the owner's public key cannot be converted to Bech32 format.
func (Validator) RemoveDelShares ¶
RemoveDelShares removes delegator shares from a validator.
func (Validator) RemoveTokens ¶ added in v0.21.0
removes tokens from a validator
func (Validator) UpdateStatus ¶
UpdateStatus updates the location of the shares within a validator to reflect the new status