types

package
v0.23.0-iris Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const MaxBondDenominatorPrecision = 8

Maximum amount of decimal points in the decimal representation of rationals used in MsgBeginUnbonding / MsgBeginRedelegate

View Source
const MsgType = "stake"

name to idetify transaction types

Variables

View Source
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 ErrDescriptionLength(codespace sdk.CodespaceType, descriptor string, got, max int) 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 ErrNotMature(codespace sdk.CodespaceType, operation, descriptor string, got, min int64) sdk.Error

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

func MustMarshalValidator(cdc *wire.Codec, validator Validator) []byte

return the redelegation without fields contained within the key for the store

func OpAddTokens

func OpAddTokens(r *rand.Rand, pool Pool, validator Validator) (Pool, Validator, sdk.Rat, string)

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

func RandomSetup(r *rand.Rand, numValidators int) (Pool, []Validator)

RandomSetup generates a random staking state.

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

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)
	DelegatorShares sdk.Rat        `json:"delegator_shares"` // total shares issued to a validator's delegators

	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

type CodeType = sdk.CodeType
const (
	DefaultCodespace sdk.CodespaceType = 4

	CodeInvalidValidator  CodeType = 101
	CodeInvalidDelegation CodeType = 102
	CodeInvalidInput      CodeType = 103
	CodeValidatorJailed   CodeType = 104
	CodeUnauthorized      CodeType = sdk.CodeUnauthorized
	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"`
	Shares        sdk.Rat        `json:"shares"`
	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) Equal

func (d Delegation) Equal(d2 Delegation) bool

nolint

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"`
	SharesAmount     sdk.Rat        `json:"shares_amount"`
}

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) Type

func (msg MsgBeginRedelegate) Type() string

nolint

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"`
	SharesAmount  sdk.Rat        `json:"shares_amount"`
}

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) Type

func (msg MsgBeginUnbonding) Type() string

nolint

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) Type

func (msg MsgCompleteRedelegate) Type() string

nolint

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) Type

func (msg MsgCompleteUnbonding) Type() string

nolint

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) Type

func (msg MsgCreateValidator) Type() string

nolint

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) Type

func (msg MsgDelegate) Type() string

nolint

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) Type

func (msg MsgEditValidator) Type() string

nolint

func (MsgEditValidator) ValidateBasic

func (msg MsgEditValidator) ValidateBasic() sdk.Error

quick validity check

type Operation

type Operation func(r *rand.Rand, pool Pool, c Validator) (Pool, Validator, sdk.Rat, string)

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

func RandomOperation(r *rand.Rand) Operation

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

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Param types are identical.

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)

	// Fee Related
	PrevBondedShares sdk.Rat `json:"prev_bonded_shares"` // last recorded bonded shares - for fee calculations
}

Pool - dynamic parameters of the current state

func InitialPool

func InitialPool() Pool

initial pool for testing

func (Pool) BondedRatio

func (p Pool) BondedRatio() sdk.Rat

get the bond ratio of the global state

func (Pool) Equal

func (p Pool) Equal(p2 Pool) bool

nolint

func (Pool) NextInflation added in v0.21.0

func (p Pool) NextInflation(params Params) (inflation sdk.Rat)

get the next inflation rate for the hour

func (Pool) ProcessProvisions added in v0.21.0

func (p Pool) ProcessProvisions(params Params) Pool

process provisions for an hour period

func (Pool) TokenSupply

func (p Pool) TokenSupply() sdk.Rat

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
	SharesSrc        sdk.Rat        `json:"shares_src"`         // amount of source shares redelegating
	SharesDst        sdk.Rat        `json:"shares_dst"`         // amount of destination shares redelegating
}

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) Equal

func (d Redelegation) Equal(d2 Redelegation) bool

nolint

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

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)
	DelegatorShares sdk.Rat        `json:"delegator_shares"` // total shares issued to a validator's delegators

	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

func MustUnmarshalValidator(cdc *wire.Codec, ownerAddr, value []byte) Validator

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

func UnmarshalValidator(cdc *wire.Codec, ownerAddr, value []byte) (validator Validator, err error)

unmarshal a redelegation from a store key and value

func (Validator) ABCIValidator

func (v Validator) ABCIValidator() abci.Validator

ABCIValidator returns an abci.Validator from a staked validator type.

func (Validator) ABCIValidatorZero

func (v Validator) ABCIValidatorZero() abci.Validator

ABCIValidatorZero returns an abci.Validator from a staked validator type with with zero power used for validator updates.

func (Validator) AddTokensFromDel

func (v Validator) AddTokensFromDel(pool Pool, amount int64) (Validator, Pool, sdk.Rat)

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

func (v Validator) BondedTokens() sdk.Rat

Get the bonded tokens which the validator holds

func (Validator) DelegatorShareExRate

func (v Validator) DelegatorShareExRate() sdk.Rat

DelegatorShareExRate gets the exchange rate of tokens over delegator shares. UNITS: tokens/delegator-shares

func (Validator) Equal

func (v Validator) Equal(c2 Validator) bool

only the vitals - does not check bond height of IntraTxCounter nolint gocyclo - why dis fail?

func (Validator) GetBondHeight

func (v Validator) GetBondHeight() int64

func (Validator) GetDelegatorShares

func (v Validator) GetDelegatorShares() sdk.Rat

func (Validator) GetMoniker

func (v Validator) GetMoniker() string

func (Validator) GetOwner

func (v Validator) GetOwner() sdk.AccAddress

func (Validator) GetPower

func (v Validator) GetPower() sdk.Rat

func (Validator) GetPubKey

func (v Validator) GetPubKey() crypto.PubKey

func (Validator) GetRevoked

func (v Validator) GetRevoked() bool

nolint - for sdk.Validator

func (Validator) GetStatus

func (v Validator) GetStatus() sdk.BondStatus

func (Validator) HumanReadableString

func (v Validator) HumanReadableString() (string, error)

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

func (v Validator) RemoveDelShares(pool Pool, delShares sdk.Rat) (Validator, Pool, sdk.Rat)

RemoveDelShares removes delegator shares from a validator.

func (Validator) RemoveTokens added in v0.21.0

func (v Validator) RemoveTokens(pool Pool, tokens sdk.Rat) (Validator, Pool)

removes tokens from a validator

func (Validator) UpdateStatus

func (v Validator) UpdateStatus(pool Pool, NewStatus sdk.BondStatus) (Validator, Pool)

UpdateStatus updates the location of the shares within a validator to reflect the new status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL