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, val Validator) (Pool, Validator, int64, string)
- func OpBondOrUnbond(r *rand.Rand, pool Pool, val Validator) (Pool, Validator, int64, string)
- func OpRemoveShares(r *rand.Rand, pool Pool, val Validator) (Pool, Validator, int64, string)
- func RandomSetup(r *rand.Rand, numValidators int) (Pool, []Validator)
- func RegisterWire(cdc *wire.Codec)
- 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 PoolShares
- func (s PoolShares) Bonded() sdk.Rat
- func (s PoolShares) Equal(s2 PoolShares) bool
- func (s PoolShares) ToBonded(p Pool) PoolShares
- func (s PoolShares) ToUnbonded(p Pool) PoolShares
- func (s PoolShares) ToUnbonding(p Pool) PoolShares
- func (s PoolShares) Tokens(p Pool) sdk.Rat
- func (s PoolShares) Unbonded() sdk.Rat
- func (s PoolShares) Unbonding() sdk.Rat
- 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) DelegatorShareExRate(pool Pool) sdk.Rat
- func (v Validator) Equal(c2 Validator) bool
- func (v Validator) EquivalentBondedShares(pool Pool) (eqBondedShares sdk.Rat)
- 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, int64)
- func (v Validator) RemovePoolShares(pool Pool, poolShares sdk.Rat) (Validator, Pool, int64)
- func (v Validator) Status() sdk.BondStatus
- 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, tokens int64)
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 ¶
OpBondOrUnbond implements an operation that bonds or unbonds a validator depending on current status. nolint: unparam
func OpRemoveShares ¶
OpRemoveShares implements an operation that removes a random number of shares from a validator.
func RandomSetup ¶
RandomSetup generates a random staking state.
Types ¶
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 ValidatorAddr sdk.AccAddress `json:"address"` PubKey crypto.PubKey `json:"pubkey"` SelfDelegation sdk.Coin `json:"self_delegation"` }
MsgCreateValidator - struct for unbonding transactions
func NewMsgCreateValidator ¶
func NewMsgCreateValidator(validatorAddr sdk.AccAddress, pubkey crypto.PubKey, selfDelegation sdk.Coin, description Description) MsgCreateValidator
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
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"` Bond sdk.Coin `json:"bond"` }
MsgDelegate - struct for bonding transactions
func NewMsgDelegate ¶
func NewMsgDelegate(delegatorAddr, validatorAddr sdk.AccAddress, bond 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 int64 `json:"loose_tokens"` // tokens not associated with any validator UnbondedTokens int64 `json:"unbonded_tokens"` // reserve of unbonded tokens held with validators UnbondingTokens int64 `json:"unbonding_tokens"` // tokens moving from bonded to unbonded pool BondedTokens int64 `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) BondedShareExRate ¶
get the exchange rate of bonded token per issued share
func (Pool) TokenSupply ¶
Sum total of all staking tokens in the pool
func (Pool) UnbondedShareExRate ¶
get the exchange rate of unbonded tokens held in validators per issued share
func (Pool) UnbondingShareExRate ¶
get the exchange rate of unbonding tokens held in validators per issued share
type PoolShares ¶
type PoolShares struct {}
PoolShares reflects the shares of a validator in a pool.
func NewBondedShares ¶
func NewBondedShares(amount sdk.Rat) PoolShares
NewBondedShares returns a new PoolSahres with a specified bonding amount.
func NewUnbondedShares ¶
func NewUnbondedShares(amount sdk.Rat) PoolShares
NewUnbondedShares returns a new PoolShares with a specified unbonded amount.
func NewUnbondingShares ¶
func NewUnbondingShares(amount sdk.Rat) PoolShares
NewUnbondingShares returns a new PoolShares with a specified unbonding amount.
func (PoolShares) Bonded ¶
func (s PoolShares) Bonded() sdk.Rat
Bonded returns amount of bonded shares.
func (PoolShares) Equal ¶
func (s PoolShares) Equal(s2 PoolShares) bool
Equal returns a boolean determining of two PoolShares are identical.
func (PoolShares) ToBonded ¶
func (s PoolShares) ToBonded(p Pool) PoolShares
ToBonded the equivalent amount of pool shares if the shares were bonded.
func (PoolShares) ToUnbonded ¶
func (s PoolShares) ToUnbonded(p Pool) PoolShares
ToUnbonded returns the equivalent amount of pool shares if the shares were unbonded.
func (PoolShares) ToUnbonding ¶
func (s PoolShares) ToUnbonding(p Pool) PoolShares
ToUnbonding returns the equivalent amount of pool shares if the shares were unbonding.
func (PoolShares) Tokens ¶
func (s PoolShares) Tokens(p Pool) sdk.Rat
Tokens returns the equivalent amount of tokens contained by the pool shares for a given pool.
func (PoolShares) Unbonded ¶
func (s PoolShares) Unbonded() sdk.Rat
Unbonded returns the amount of unbonded shares.
func (PoolShares) Unbonding ¶
func (s PoolShares) Unbonding() sdk.Rat
Unbonding returns the amount of unbonding shares.
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? 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) PrevBondedShares sdk.Rat `json:"prev_bonded_shares"` // total shares of a global hold pools }
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) DelegatorShareExRate ¶
DelegatorShareExRate gets the exchange rate of tokens over delegator shares. UNITS: eq-val-bonded-shares/delegator-shares
func (Validator) EquivalentBondedShares ¶
EquivalentBondedShares ...
TODO: Remove should only be tokens get the power or potential power for a validator if bonded, the power is the BondedShares if not bonded, the power is the amount of bonded shares which the the validator would have it was bonded.
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.
NOTE: This function assumes the shares have already been updated for the validator status.
func (Validator) RemovePoolShares ¶
RemovePoolShares removes pool shares from a validator. It returns corresponding tokens, which could be burned (e.g. when slashing a validator) or redistributed elsewhere.
func (Validator) Status ¶
func (v Validator) Status() sdk.BondStatus
Status returns the validator's bond status inferred from the pool shares.
func (Validator) UpdateStatus ¶
UpdateStatus updates the location of the shares within a validator if it's bond status has changed.