types

package
v1.7.0-browser Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 27 Imported by: 4

Documentation

Overview

nolint

nolint

Index

Constants

View Source
const (
	DefaultCodespace string = ModuleName

	CodeNoValidatorFound                uint32 = 67000
	CodeInvalidDelegation               uint32 = 67001
	CodeNilValidatorAddr                uint32 = 67002
	CodeBadValidatorAddr                uint32 = 67003
	CodeMoreMinSelfDelegation           uint32 = 67004
	CodeProxyNotFound                   uint32 = 67005
	CodeEmptyValidators                 uint32 = 67006
	CodeProxyAlreadyExist               uint32 = 67007
	CodeAddressNotEqual                 uint32 = 67009
	CodeDescriptionIsEmpty              uint32 = 67010
	CodeGetConsPubKeyBech32Failed       uint32 = 67011
	CodeUnknownStakingQueryType         uint32 = 67012
	CodeValidatorOwnerExists            uint32 = 67013
	CodeValidatorPubKeyExists           uint32 = 67014
	CodeValidatorPubKeyTypeNotSupported uint32 = 67015
	CodeBondedPoolOrNotBondedIsNotExist uint32 = 67016
	CodeInvalidDescriptionLength        uint32 = 67017
	CodeCommissionNegative              uint32 = 67018
	CodeCommissionHuge                  uint32 = 67019
	CodeCommissionGTMaxRate             uint32 = 67020
	CodeCommissionUpdateTime            uint32 = 67021
	CodeCommissionChangeRateNegative    uint32 = 67022
	CodeCommissionChangeRateGTMaxRate   uint32 = 67023
	CodeCommissionGTMaxChangeRate       uint32 = 67024
	CodeMinSelfDelegationInvalid        uint32 = 67025
	CodeNilDelegatorAddr                uint32 = 67026
	CodeDelegatorEqualToProxyAddr       uint32 = 67027
	CodeBadDenom                        uint32 = 67028
	CodeBadDelegationAmount             uint32 = 67029
	CodeNoUnbondingDelegation           uint32 = 67030
	CodeAddSharesToDismission           uint32 = 67031
	CodeAddSharesDuringProxy            uint32 = 67032
	CodeDoubleProxy                     uint32 = 67033
	CodeExceedValidatorAddrs            uint32 = 67034
	CodeNoDelegationToAddShares         uint32 = 67035
	CodeNotInDelegating                 uint32 = 67036
	CodeInsufficientDelegation          uint32 = 67037
	CodeInsufficientQuantity            uint32 = 67038
	CodeInvalidMinSelfDelegation        uint32 = 67039
	CodeBadUnDelegationAmount           uint32 = 67040
	CodeInvalidProxyUpdating            uint32 = 67041
	CodeInvalidProxyWithdrawTotal       uint32 = 67042
	CodeAlreadyAddedShares              uint32 = 67043
	CodeNoDelegatorExisted              uint32 = 67044
	CodeTargetValsDuplicate             uint32 = 67045
	CodeAlreadyBound                    uint32 = 67046
)
View Source
const (
	CodeInvalidCommissionRate                 uint32 = 67047
	CodeNotSupportEditValidatorCommissionRate uint32 = 67048
	CodeDisabledOperate                       uint32 = 67049
	CodeNoDelegatorValidator                  uint32 = 67050
)
View Source
const (
	EventTypeCompleteUnbonding = "complete_unbonding"
	EventTypeCreateValidator   = "create_validator"
	EventTypeEditValidator     = "edit_validator"
	EventTypeDelegate          = "delegate"
	EventTypeUnbond            = "unbond"

	AttributeKeyValidator         = "validator"
	AttributeKeyCommissionRate    = "commission_rate"
	AttributeKeyMinSelfDelegation = "min_self_delegation"
	AttributeKeyDelegator         = "delegator"
	AttributeKeyCompletionTime    = "completion_time"
	AttributeValueCategory        = ModuleName

	EventTypeAddShares = "add_shares"

	AttributeKeyValidatorToAddShares = "validator_to_add_shares"
	AttributeKeyShares               = "shares"
)

staking module event types

View Source
const (
	// ModuleName is the name of the staking module
	ModuleName = "staking"

	// StoreKey is the string store representation
	StoreKey = ModuleName

	// TStoreKey is the string transient store representation
	TStoreKey = "transient_" + ModuleName

	// QuerierRoute is the querier route for the staking module
	QuerierRoute = ModuleName

	// RouterKey is the msg router key for the staking module
	RouterKey = ModuleName
)
View Source
const (
	// Update the validator set every 252 blocks by default
	DefaultBlocksPerEpoch = 252

	// Default maximum number of validators to vote
	DefaultMaxValsToVote = 30

	// Default validate rate update interval by hours
	DefaultValidateRateUpdateInterval = 24
)
View Source
const (

	// Default unbonding duration, 14 days
	DefaultUnbondingTime time.Duration = time.Hour * 24 * 7 * 2

	// Default maximum number of bonded validators
	DefaultMaxValidators uint16 = 21

	DefaultEpoch              uint16 = DefaultBlocksPerEpoch
	DefaultMaxValsToAddShares uint16 = DefaultMaxValsToVote
)

Staking params default values

View Source
const (
	NotBondedPoolName = "not_bonded_tokens_pool"
	BondedPoolName    = "bonded_tokens_pool"
)

names used as root for pool module accounts:

- NotBondedPool -> "not_bonded_tokens_pool"

- BondedPool -> "bonded_tokens_pool"

View Source
const (
	QueryValidators           = "validators"
	QueryValidator            = "validator"
	QueryUnbondingDelegation  = "unbondingDelegation"
	QueryPool                 = "pool"
	QueryParameters           = "parameters"
	QueryParams4IBC           = "params4ibc"
	QueryAddress              = "address"
	QueryForAddress           = "validatorAddress"
	QueryForAccAddress        = "validatorAccAddress"
	QueryProxy                = "proxy"
	QueryValidatorAllShares   = "validatorAllShares"
	QueryDelegator            = "delegator"
	QueryDelegatorDelegations = "delegatorDelegations"
	QueryUnbondingDelegation2 = "unbondingDelegation2"
	QueryHistoricalInfo       = "historicalInfo"
	QueryDelegatorValidators  = "delegatorValidators"
	QueryDelegatorValidator   = "delegatorValidator"
	QueryValidatorDelegations = "validatorDelegations"
	QueryValidatorDelegator   = "validatorDelegator"
)

query endpoints supported by the staking Querier

View Source
const (
	// TODO: Why can't we just have one string description which can be JSON by convention
	MaxMonikerLength  = 70
	MaxIdentityLength = 3000
	MaxWebsiteLength  = 140
	MaxDetailsLength  = 280
)

nolint

View Source
const DoNotModifyDesc = "[do-not-modify]"

DoNotModifyDesc is the constant used in flags to indicate that description field should not be updated

View Source
const (
	EventTypeEditValidatorCommissionRate = "edit_validator_commission_rate"
)

staking module event types

View Source
const PubkeyType = "/cosmos.crypto.ed25519.PubKey"

PubkeyType is to be compatible with the response format of the standard cosmos REST API.

Variables

View Source
var (
	ErrInvalidHistoricalInfo = sdkerrors.Register(ModuleName, 144, "invalid historical info")
	ErrNoHistoricalInfo      = sdkerrors.Register(ModuleName, 145, "no historical info found")
)
View Source
var (
	// Keys for store prefixes
	// Last* values are constant during a block.
	LastValidatorPowerKey = []byte{0x11} // prefix for each key to a validator index, for bonded validators
	LastTotalPowerKey     = []byte{0x12} // prefix for the total power

	ValidatorsKey             = []byte{0x21} // prefix for each key to a validator
	ValidatorsByConsAddrKey   = []byte{0x22} // prefix for each key to a validator index, by pubkey
	ValidatorsByPowerIndexKey = []byte{0x23} // prefix for each key to a validator index, sorted by power

	ValidatorQueueKey = []byte{0x43} // prefix for the timestamps in validator queue

	SharesKey           = []byte{0x51}
	DelegatorKey        = []byte{0x52}
	UnDelegationInfoKey = []byte{0x53}
	UnDelegateQueueKey  = []byte{0x54}
	ProxyKey            = []byte{0x55}

	// prefix key for vals info to enforce the update of validator-set
	ValidatorAbandonedKey = []byte{0x60}
)

nolint

View Source
var (
	// DefaultMinDelegation is the limit value of delegation or undelegation
	DefaultMinDelegation = sdk.NewDecWithPrec(1, 4)
	// DefaultMinSelfDelegation is the default value of each validator's msd (hard code)
	DefaultMinSelfDelegation = sdk.NewDec(10000)
)
View Source
var (
	KeyUnbondingTime     = []byte("UnbondingTime")
	KeyMaxValidators     = []byte("MaxValidators")
	KeyEpoch             = []byte("BlocksPerEpoch")    // how many blocks each epoch has
	KeyTheEndOfLastEpoch = []byte("TheEndOfLastEpoch") // a block height that is the end of last epoch

	KeyMaxValsToAddShares = []byte("MaxValsToAddShares")
	KeyMinDelegation      = []byte("MinDelegation")
	KeyMinSelfDelegation  = []byte("MinSelfDelegation")

	KeyHistoricalEntries = []byte("HistoricalEntries")
)

nolint - Keys for parameter access

View Source
var ModuleCdc *codec.Codec

ModuleCdc is generic sealed codec to be used throughout this module

Functions

func AddressFromLastValidatorPowerKey

func AddressFromLastValidatorPowerKey(key []byte) []byte

AddressFromLastValidatorPowerKey gets the validator operator address from LastValidatorPowerKey

func Bech32ifyConsPub

func Bech32ifyConsPub(pub crypto.PubKey) (string, error)

Bech32ifyConsPub returns a Bech32 encoded string containing the Bech32PrefixConsPub prefixfor a given consensus node's PubKey.

func ErrAddSharesDuringProxy

func ErrAddSharesDuringProxy(delegator string, proxy string) sdk.EnvelopedErr

ErrAddSharesDuringProxy returns an error when a delegator who has bound tries to add shares to validators by itself

func ErrAddSharesToDismission

func ErrAddSharesToDismission(valAddr string) sdk.Error

ErrAddSharesToDismission returns an error when a zero-msd validator becomes the shares adding target

func ErrAlreadyAddedShares

func ErrAlreadyAddedShares(delAddr string) sdk.EnvelopedErr

ErrAlreadyAddedShares returns an error when a delegator tries to bind proxy after adding shares

func ErrAlreadyBound

func ErrAlreadyBound(delAddr string) sdk.EnvelopedErr

ErrAlreadyBound returns an error when a delegator keeps binding a proxy before proxy register

func ErrBadDelegationAmount

func ErrBadDelegationAmount() sdk.Error

ErrBadDelegationAmount returns an error when the amount of delegation isn't positive

func ErrBadDenom

func ErrBadDenom() sdk.EnvelopedErr

ErrBadDenom returns an error when the coin denomination is invalid

func ErrBadUnDelegationAmount

func ErrBadUnDelegationAmount() sdk.Error

ErrBadUnDelegationAmount returns an error when the amount of delegation is not positive

func ErrBadValidatorAddr

func ErrBadValidatorAddr() sdk.Error

ErrBadValidatorAddr returns an error when an invalid validator address appears

func ErrBondedPoolOrNotBondedIsNotExist

func ErrBondedPoolOrNotBondedIsNotExist() sdk.Error

ErrBondedPoolOrNotBondedIsNotExist returns an error when bonded pool or not bonded pool is empty.

func ErrCodeDisabledOperate added in v1.6.3

func ErrCodeDisabledOperate() sdk.Error

func ErrCodeNoDelegatorValidator added in v1.6.6

func ErrCodeNoDelegatorValidator(delegator string, validator string) sdk.Error

func ErrCodeNotSupportEditValidatorCommissionRate added in v1.6.3

func ErrCodeNotSupportEditValidatorCommissionRate() sdk.Error

func ErrCommissionChangeRateGTMaxRate

func ErrCommissionChangeRateGTMaxRate() sdk.Error

ErrCommissionChangeRateGTMaxRate returns an error when the commission change rate is greater than the max rate

func ErrCommissionChangeRateNegative

func ErrCommissionChangeRateNegative() sdk.Error

ErrCommissionChangeRateNegative returns an error when the commission change rate is not positive

func ErrCommissionGTMaxChangeRate

func ErrCommissionGTMaxChangeRate() sdk.Error

ErrCommissionGTMaxChangeRate returns an error when the new rate % points change is greater than the max change rate

func ErrCommissionGTMaxRate

func ErrCommissionGTMaxRate() sdk.Error

ErrCommissionGTMaxRate returns an error when the commission rate is greater than the max rate

func ErrCommissionHuge

func ErrCommissionHuge() sdk.Error

ErrCommissionHuge returns an error when the commission is greater than 100%

func ErrCommissionNegative

func ErrCommissionNegative() sdk.Error

ErrCommissionNegative returns an error when the commission is not positive

func ErrCommissionUpdateTime

func ErrCommissionUpdateTime() sdk.Error

ErrCommissionUpdateTime returns an error when the commission is remodified within 24 hours

func ErrDelegatorEqualToProxyAddr

func ErrDelegatorEqualToProxyAddr() sdk.Error

ErrDelegatorEqualToProxyAddr returns an error when the address is not expected

func ErrDescriptionIsEmpty

func ErrDescriptionIsEmpty() sdk.Error

ErrDescriptionIsEmpty returns an error when description is empty.

func ErrDescriptionLength

func ErrDescriptionLength(descriptor string, got, max int) sdk.Error

ErrDescriptionLength returns an error when the description of validator has a wrong length

func ErrDoubleProxy

func ErrDoubleProxy(delegator string) sdk.EnvelopedErr

ErrDoubleProxy returns an error when a delegator trys to bind more than one proxy

func ErrEmptyValidators

func ErrEmptyValidators() sdk.Error

ErrEmptyValidators returns an error when none of the validators in shares adding list is available

func ErrExceedValidatorAddrs

func ErrExceedValidatorAddrs(num int) sdk.EnvelopedErr

ErrExceedValidatorAddrs returns an error when the number of target validators exceeds the max limit

func ErrGetConsPubKeyBech32

func ErrGetConsPubKeyBech32() sdk.Error

ErrGetConsPubKeyBech32 returns an error when get bech32 consensus public key failed.

func ErrInsufficientDelegation

func ErrInsufficientDelegation(quantity, delLeft string) sdk.Error

ErrInsufficientDelegation returns an error when the delegation left is not enough for unbonding

func ErrInsufficientQuantity

func ErrInsufficientQuantity(quantity, minLimit string) sdk.Error

ErrInsufficientQuantity returns an error when the quantity is less than the min delegation limit

func ErrInvalidCommissionRate added in v1.6.3

func ErrInvalidCommissionRate() sdk.Error

ErrInvalidCommissionRate returns an error when commission rate not be between 0 and 1 (inclusive)

func ErrInvalidDelegation

func ErrInvalidDelegation(delegator string) sdk.EnvelopedErr

ErrInvalidDelegation returns an error when the delegation is invalid

func ErrInvalidProxyUpdating

func ErrInvalidProxyUpdating() sdk.Error

ErrInvalidProxyUpdating returns an error when the total delegated tokens on a proxy are going to be negative

func ErrInvalidProxyWithdrawTotal

func ErrInvalidProxyWithdrawTotal(addr string) sdk.Error

ErrInvalidProxyWithdrawTotal returns an error when proxy withdraws total tokens

func ErrMinSelfDelegationInvalid

func ErrMinSelfDelegationInvalid() sdk.Error

ErrMinSelfDelegationInvalid returns an error when the msd isn't positive

func ErrMoreMinSelfDelegation

func ErrMoreMinSelfDelegation(valAddr string) sdk.Error

ErrMoreMinSelfDelegation returns an error when the msd doesn't match the rest of shares on a validator

func ErrNilDelegatorAddr

func ErrNilDelegatorAddr() sdk.Error

ErrNilDelegatorAddr returns an error when the delegator address is nil

func ErrNilValidatorAddr

func ErrNilValidatorAddr() sdk.Error

ErrNilValidatorAddr returns an error when an empty validator address appears

func ErrNoDelegationToAddShares

func ErrNoDelegationToAddShares(delegator string) sdk.EnvelopedErr

ErrNoDelegationToAddShares returns an error when there's no delegation to support adding shares to validators

func ErrNoDelegatorExisted

func ErrNoDelegatorExisted(delAddr string) sdk.Error

ErrNoDelegatorExisted returns an error when the info if a certain delegator doesn't exist

func ErrNoMinSelfDelegation

func ErrNoMinSelfDelegation(valAddr string) sdk.Error

ErrNoMinSelfDelegation returns an error when the msd has already been unbonded

func ErrNoUnbondingDelegation

func ErrNoUnbondingDelegation() sdk.Error

ErrNoUnbondingDelegation returns an error when the unbonding delegation doesn't exist

func ErrNoValidatorFound

func ErrNoValidatorFound(valAddr string) sdk.EnvelopedErr

ErrNoValidatorFound returns an error when a validator doesn't exist

func ErrNotInDelegating

func ErrNotInDelegating(addr string) sdk.Error

ErrNotInDelegating returns an error when the UndelegationInfo doesn't exist during it's unbonding period

func ErrProxyAlreadyExist

func ErrProxyAlreadyExist(delegator string) sdk.EnvelopedErr

ErrProxyAlreadyExist returns an error when a proxy tries to reg the second time

func ErrProxyNotFound

func ErrProxyNotFound(delegator string) sdk.EnvelopedErr

ErrProxyNotFound returns an error when a delegator who's not a proxy tries to unreg

func ErrTargetValsDuplicate

func ErrTargetValsDuplicate() sdk.Error

ErrTargetValsDuplicate returns an error when the target validators in voting list are duplicate

func ErrUnknownStakingQueryType

func ErrUnknownStakingQueryType() sdk.Error

ErrUnknownStakingQueryType returns an error when encounter unknown staking query type.

func ErrValidatorOwnerExists

func ErrValidatorOwnerExists() sdk.Error

ErrValidatorOwnerExists returns an error when the validator address has been registered

func ErrValidatorPubKeyExists

func ErrValidatorPubKeyExists() sdk.Error

ErrValidatorPubKeyExists returns an error when the validator consensus pubkey has been registered

func ErrValidatorPubKeyTypeNotSupported

func ErrValidatorPubKeyTypeNotSupported(keyType string,
	supportedTypes []string) sdk.Error

ErrValidatorPubKeyTypeNotSupported returns an error when the type of pubkey was not supported

func GetCompleteTimeKey

func GetCompleteTimeKey(timestamp time.Time) []byte

GetCompleteTimeKey get the key for the prefix of time

func GetCompleteTimeWithAddrKey

func GetCompleteTimeWithAddrKey(timestamp time.Time, delAddr sdk.AccAddress) []byte

GetCompleteTimeWithAddrKey get the key for the complete time with delegator address

func GetConsPubKeyBech32

func GetConsPubKeyBech32(pubkey string) (pk crypto.PubKey, err error)

GetConsPubKeyBech32 creates a PubKey for a consensus node with a given public key string using the Bech32 Bech32PrefixConsPub prefix.

func GetDelegatorKey

func GetDelegatorKey(delAddr sdk.AccAddress) []byte

GetDelegatorKey gets the key for Delegator

func GetLastValidatorPowerKey

func GetLastValidatorPowerKey(operator sdk.ValAddress) []byte

GetLastValidatorPowerKey gets the bonded validator index key for an operator address

func GetProxyDelegatorKey

func GetProxyDelegatorKey(proxyAddr, delAddr sdk.AccAddress) []byte

GetProxyDelegatorKey gets the key for the relationship between delegator and proxy

func GetSharesKey

func GetSharesKey(valAddr sdk.ValAddress, delAddr sdk.AccAddress) []byte

GetSharesKey gets the whole key for an item of shares info

func GetSharesToValidatorsKey

func GetSharesToValidatorsKey(valAddr sdk.ValAddress) []byte

GetSharesToValidatorsKey gets the first-prefix for an item of shares info

func GetUndelegationInfoKey

func GetUndelegationInfoKey(delAddr sdk.AccAddress) []byte

GetUndelegationInfoKey gets the key for UndelegationInfo

func GetValidatorByConsAddrKey

func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte

GetValidatorByConsAddrKey gets the key for the validator with pubkey VALUE: validator operator address ([]byte)

func GetValidatorKey

func GetValidatorKey(operatorAddr sdk.ValAddress) []byte

GetValidatorKey gets the key for the validator with address VALUE: staking/Validator

func GetValidatorQueueTimeKey

func GetValidatorQueueTimeKey(timestamp time.Time) []byte

GetValidatorQueueTimeKey gets the prefix for all unbonding delegations from a delegator

func GetValidatorsByPowerIndexKey

func GetValidatorsByPowerIndexKey(validator Validator) []byte

GetValidatorsByPowerIndexKey gets the validator by power index Power index is the key used in the power-store, and represents the relative power ranking of the validator VALUE: validator operator address ([]byte)

func KeyHistoricalEntriesParams added in v1.3.0

func KeyHistoricalEntriesParams(p uint32) params.ParamSet

func MustBech32ifyConsPub

func MustBech32ifyConsPub(pub crypto.PubKey) string

func MustGetConsPubKeyBech32

func MustGetConsPubKeyBech32(pubkey string) (pk crypto.PubKey)

MustGetConsPubKeyBech32 returns the result of GetConsPubKeyBech32 panicing on failure.

func MustMarshalHistoricalInfo added in v1.3.0

func MustMarshalHistoricalInfo(cdc *codec.Codec, hi HistoricalInfo) []byte

MustMarshalHistoricalInfo wll marshal historical info and panic on error

func MustMarshalValidator

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

MustMarshalValidator must return the marshaling bytes of a validator

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types for codec

func SplitCompleteTimeWithAddrKey

func SplitCompleteTimeWithAddrKey(key []byte) (time.Time, sdk.AccAddress)

SplitCompleteTimeWithAddrKey splits the key and returns the endtime and delegator address

func ValidateBasic added in v1.3.0

func ValidateBasic(hi HistoricalInfo) error

ValidateBasic will ensure HistoricalInfo is not nil and sorted

Types

type AccountKeeper

type AccountKeeper interface {
	IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool))
}

AccountKeeper defines the expected account keeper (noalias)

type CM45Delegation added in v1.7.0

type CM45Delegation struct {
	DelAddr sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	ValAddr sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
	Shares  sdk.Dec        `json:"shares" yaml:"shares"`
}

func NewCM45Delegation added in v1.7.0

func NewCM45Delegation(delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares sdk.Dec) CM45Delegation

type CM45DelegationResp added in v1.7.0

type CM45DelegationResp struct {
	Delegation CM45Delegation `json:"delegation" yaml:"delegation"`
	Balance    sdk.DecCoin    `json:"balance" yaml:"balance"`
}

func NewCM45DelegationResp added in v1.7.0

func NewCM45DelegationResp(cm45delegation CM45Delegation, tokens sdk.Dec) CM45DelegationResp

type CM45DelegationResponses added in v1.7.0

type CM45DelegationResponses struct {
	DelResponses []CM45DelegationResp `json:"delegation_responses"`
}

func FormatCM45DelegationResponses added in v1.7.0

func FormatCM45DelegationResponses(delegator Delegator) CM45DelegationResponses

func NewCM45DelegationResponses added in v1.7.0

func NewCM45DelegationResponses(ds []CM45DelegationResp) CM45DelegationResponses

type CM45Entry added in v1.7.0

type CM45Entry struct {
	CompletionTime time.Time `json:"completion_time"`
	Balance        sdk.Dec   `json:"balance" yaml:"balance"`
}

func NewCM45Entry added in v1.7.0

func NewCM45Entry(ct time.Time, balance sdk.Dec) CM45Entry

type CM45Params added in v1.7.0

type CM45Params struct {
	// time duration of unbonding
	UnbondingTime string `json:"unbonding_time" yaml:"unbonding_time"`
	// note: we need to be a bit careful about potential overflow here, since this is user-determined
	// maximum number of validators (max uint16 = 65535)
	MaxValidators uint16 `json:"max_bonded_validators" yaml:"max_bonded_validators"`
	// epoch for validator update
	Epoch              uint16 `json:"epoch" yaml:"epoch"`
	MaxValsToAddShares uint16 `json:"max_validators_to_add_shares" yaml:"max_validators_to_add_shares"`
	// limited amount of delegate
	MinDelegation sdk.Dec `json:"min_delegation" yaml:"min_delegation"`
	// validator's self declared minimum self delegation
	MinSelfDelegation sdk.Dec `json:"min_self_delegation" yaml:"min_self_delegation"`

	HistoricalEntries uint32 `` /* 139-byte string literal not displayed */
}

type CM45UnbondingResp added in v1.7.0

type CM45UnbondingResp struct {
	DelAddr sdk.AccAddress
	Entries []CM45Entry
}

func NewCM45UnbondingResp added in v1.7.0

func NewCM45UnbondingResp(delAddr sdk.AccAddress, entry CM45Entry) CM45UnbondingResp

type CM45Validator added in v1.7.0

type CM45Validator struct {
	// address of the validator's operator; bech encoded in JSON
	OperatorAddress sdktypes.ValAddress `json:"operator_address" yaml:"operator_address"`
	// the consensus public key of the validator; bech encoded in JSON
	ConsPubKey *CosmosAny `json:"consensus_pubkey" yaml:"consensus_pubkey"`
	// has the validator been jailed from bonded status?
	Jailed bool `json:"jailed" yaml:"jailed"`
	// validator status (bonded/unbonding/unbonded)
	Status string `json:"status" yaml:"status"`
	// delegated tokens (incl. self-delegation)
	Tokens sdktypes.Int `json:"tokens" yaml:"tokens"`
	// total shares added to a validator
	DelegatorShares sdktypes.Dec `json:"delegator_shares" yaml:"delegator_shares"`
	// description terms for the validator
	Description Description `json:"description" yaml:"description"`
	// if unbonding, height at which this validator has begun unbonding
	UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"`
	// if unbonding, min time for the validator to complete unbonding
	UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"`
	// commission parameters
	Commission Commission `json:"commission" yaml:"commission"`
	// validator's self declared minimum self delegation
	MinSelfDelegation sdktypes.Dec `json:"min_self_delegation" yaml:"min_self_delegation"`
}

CM45Validator is constructed to be compatible with ATOMScan returning the latest cosmos REST API response

func WrapCM45Validator added in v1.7.0

func WrapCM45Validator(v Validator, ca *CosmosAny) CM45Validator

type Commission

type Commission struct {
	CommissionRates `json:"commission_rates" yaml:"commission_rates"`
	UpdateTime      time.Time `json:"update_time" yaml:"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

NewCommissionWithTime 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) UnmarshalFromAmino added in v0.19.16

func (c *Commission) UnmarshalFromAmino(cdc *amino.Codec, data []byte) error

func (Commission) ValidateNewRate

func (c Commission) ValidateNewRate(newRate sdk.Dec, blockTime time.Time) sdk.Error

ValidateNewRate performs basic sanity validation checks of a new commission rate If validation fails, an SDK error is returned.

type CommissionRates

type CommissionRates struct {
	// the commission rate charged to delegators, as a fraction
	Rate sdk.Dec `json:"rate" yaml:"rate"`
	// maximum commission rate which validator can ever charge, as a fraction
	MaxRate sdk.Dec `json:"max_rate" yaml:"max_rate"`
	// maximum daily increase of the validator commission, as a fraction
	MaxChangeRate sdk.Dec `json:"max_change_rate" yaml:"max_change_rate"`
}

CommissionRates defines the initial commission rates to be used for creating a validator

func NewCommissionRates

func NewCommissionRates(rate, maxRate, maxChangeRate sdk.Dec) CommissionRates

NewCommissionRates returns an initialized validator commission rates

func (*CommissionRates) UnmarshalFromAmino added in v0.19.16

func (c *CommissionRates) UnmarshalFromAmino(cdc *amino.Codec, data []byte) error

func (CommissionRates) Validate

func (c CommissionRates) Validate() sdk.Error

Validate performs basic sanity validation checks of initial commission parameters If validation fails, an SDK error is returned

type CosmosAny added in v1.7.0

type CosmosAny struct {
	// nolint
	TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"@type,omitempty"`
	// Must be a valid serialized protocol buffer of the above specified type.
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

func WrapCosmosAny added in v1.7.0

func WrapCosmosAny(v []byte) CosmosAny

type Delegator

type Delegator struct {
	DelegatorAddress     sdk.AccAddress   `json:"delegator_address" yaml:"delegator_address"`
	ValidatorAddresses   []sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
	Shares               sdk.Dec          `json:"shares" yaml:"shares"`
	Tokens               sdk.Dec          `json:"tokens" yaml:"tokens"` // self-delegated tokens
	IsProxy              bool             `json:"is_proxy" yaml:"is_proxy"`
	TotalDelegatedTokens sdk.Dec          `json:"total_delegated_tokens" yaml:"total_delegated_tokens"` // total tokens delegated by other delegators
	ProxyAddress         sdk.AccAddress   `json:"proxy_address" yaml:"proxy_address"`
}

Delegator is the struct of delegator info

func MustUnMarshalDelegator

func MustUnMarshalDelegator(cdc *codec.Codec, value []byte) (delegator Delegator)

MustUnMarshalDelegator must return a delegator entity by unmarshalling

func NewDelegator

func NewDelegator(delAddr sdk.AccAddress) Delegator

NewDelegator creates a new Delegator object

func (*Delegator) BindProxy

func (d *Delegator) BindProxy(proxyAddr sdk.AccAddress)

BindProxy sets relationship between a delegator and proxy

func (Delegator) GetDelegatorAddress added in v1.6.3

func (d Delegator) GetDelegatorAddress() sdk.AccAddress

GetDelegatorAddress gets delegator address

func (Delegator) GetLastAddedShares

func (d Delegator) GetLastAddedShares() sdk.Dec

GetLastAddedShares gets the last shares added to validators of a delegator for other module

func (Delegator) GetShareAddedValidatorAddresses

func (d Delegator) GetShareAddedValidatorAddresses() []sdk.ValAddress

GetShareAddedValidatorAddresses gets validator address that the delegator added shares to for other module

func (Delegator) HasProxy

func (d Delegator) HasProxy() bool

HasProxy tells whether the delegator has bound a proxy

func (*Delegator) RegProxy

func (d *Delegator) RegProxy(reg bool)

RegProxy registers or deregisters the identity of proxy

func (*Delegator) UnbindProxy

func (d *Delegator) UnbindProxy()

UnbindProxy clears the proxy address on a delegator

type Description

type Description struct {
	Moniker  string `json:"moniker" yaml:"moniker"`   // name
	Identity string `json:"identity" yaml:"identity"` // optional identity signature (ex. UPort or Keybase)
	Website  string `json:"website" yaml:"website"`   // optional website link
	Details  string `json:"details" yaml:"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, error)

EnsureLength ensures the length of a validator's description.

func (*Description) UnmarshalFromAmino added in v0.19.16

func (d *Description) UnmarshalFromAmino(_ *amino.Codec, data []byte) error

func (Description) UpdateDescription

func (d Description) UpdateDescription(d2 Description) (Description, 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 {
	Params               Params                      `json:"params" yaml:"params"`
	LastTotalPower       sdk.Int                     `json:"last_total_power" yaml:"last_total_power"`
	LastValidatorPowers  []LastValidatorPower        `json:"last_validator_powers" yaml:"last_validator_powers"`
	Validators           []ValidatorExported         `json:"validators" yaml:"validators"`
	Delegators           []Delegator                 `json:"delegators" yaml:"delegators"`
	UnbondingDelegations []UndelegationInfo          `json:"unbonding_delegations" yaml:"unbonding_delegations"`
	AllShares            []SharesExported            `json:"all_shares" yaml:"all_shares"`
	ProxyDelegatorKeys   []ProxyDelegatorKeyExported `json:"proxy_delegator_keys" yaml:"proxy_delegator_keys"`
	Exported             bool                        `json:"exported" yaml:"exported"`
}

GenesisState - all staking state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState gets the default genesis state

func NewGenesisState

func NewGenesisState(params Params, validators Validators, delegators []Delegator) GenesisState

NewGenesisState creates a new object of GenesisState

type HistoricalInfo added in v1.3.0

type HistoricalInfo struct {
	Header abci.Header `json:"header" yaml:"header"`
	ValSet []Validator `json:"valset" yaml:"valset"`
}

HistoricalInfo contains the historical information that gets stored at each height

func MustUnmarshalHistoricalInfo added in v1.3.0

func MustUnmarshalHistoricalInfo(cdc *codec.Codec, value []byte) HistoricalInfo

MustUnmarshalHistoricalInfo wll unmarshal historical info and panic on error

func NewHistoricalInfo added in v1.3.0

func NewHistoricalInfo(header abci.Header, valSet []Validator) HistoricalInfo

NewHistoricalInfo will create a historical information struct from header and valset it will first sort valset before inclusion into historical info

func UnmarshalHistoricalInfo added in v1.3.0

func UnmarshalHistoricalInfo(cdc *codec.Codec, value []byte) (hi HistoricalInfo, err error)

UnmarshalHistoricalInfo will unmarshal historical info and return any error

type KeyHistoricalEntriesParamsSet added in v1.3.0

type KeyHistoricalEntriesParamsSet struct {
	HistoricalEntries uint32 `` /* 139-byte string literal not displayed */
}

func (KeyHistoricalEntriesParamsSet) ParamSetPairs added in v1.3.0

type LastValidatorPower

type LastValidatorPower struct {
	Address sdk.ValAddress
	Power   int64
}

LastValidatorPower is needed for validator set update logic

func NewLastValidatorPower

func NewLastValidatorPower(valAddr sdk.ValAddress, power int64) LastValidatorPower

NewLastValidatorPower creates a new instance of LastValidatorPower

type MsgAddShares

type MsgAddShares struct {
	DelAddr  sdk.AccAddress   `json:"delegator_address" yaml:"delegator_address"`
	ValAddrs []sdk.ValAddress `json:"validator_addresses" yaml:"validator_addresses"`
}

MsgAddShares - struct for adding-shares transaction

func NewMsgAddShares

func NewMsgAddShares(delAddr sdk.AccAddress, valAddrs []sdk.ValAddress) MsgAddShares

NewMsgAddShares creates a msg of adding shares to vals

func (MsgAddShares) GetSignBytes

func (msg MsgAddShares) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over

func (MsgAddShares) GetSigners

func (msg MsgAddShares) GetSigners() []sdk.AccAddress

func (MsgAddShares) Route

func (MsgAddShares) Route() string

nolint

func (MsgAddShares) Type

func (MsgAddShares) Type() string

func (MsgAddShares) ValidateBasic

func (msg MsgAddShares) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgBindProxy

type MsgBindProxy struct {
	DelAddr      sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	ProxyAddress sdk.AccAddress `json:"proxy_address" yaml:"proxy_address"`
}

MsgBindProxy - structure for bind proxy relationship between the delegator and the proxy

func NewMsgBindProxy

func NewMsgBindProxy(delAddr sdk.AccAddress, ProxyDelAddr sdk.AccAddress) MsgBindProxy

NewMsgBindProxy creates a msg of binding proxy

func (MsgBindProxy) GetSignBytes

func (msg MsgBindProxy) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over

func (MsgBindProxy) GetSigners

func (msg MsgBindProxy) GetSigners() []sdk.AccAddress

func (MsgBindProxy) Route

func (MsgBindProxy) Route() string

nolint

func (MsgBindProxy) Type

func (MsgBindProxy) Type() string

func (MsgBindProxy) ValidateBasic

func (msg MsgBindProxy) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgCreateValidator

type MsgCreateValidator struct {
	Description Description `json:"description" yaml:"description"`
	//Commission        CommissionRates `json:"commission" yaml:"commission"`
	MinSelfDelegation sdk.SysCoin    `json:"min_self_delegation" yaml:"min_self_delegation"`
	DelegatorAddress  sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	ValidatorAddress  sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
	PubKey            crypto.PubKey  `json:"pubkey" yaml:"pubkey"`
}

MsgCreateValidator - struct for bonding transactions

func NewMsgCreateValidator

func NewMsgCreateValidator(
	valAddr sdk.ValAddress, pubKey crypto.PubKey,
	description Description, minSelfDelegation sdk.SysCoin,
) MsgCreateValidator

NewMsgCreateValidator creates a msg of create-validator Delegator address and validator address are the same

func (MsgCreateValidator) GetSignBytes

func (msg MsgCreateValidator) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over

func (MsgCreateValidator) GetSigners

func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress

GetSigners returns address(es) that must sign over msg.GetSignBytes()

func (MsgCreateValidator) MarshalJSON

func (msg MsgCreateValidator) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface to provide custom JSON serialization

func (MsgCreateValidator) Route

func (msg MsgCreateValidator) Route() string

nolint

func (MsgCreateValidator) Type

func (msg MsgCreateValidator) Type() string

func (*MsgCreateValidator) UnmarshalJSON

func (msg *MsgCreateValidator) UnmarshalJSON(bz []byte) error

UnmarshalJSON implements the json.Unmarshaler interface to provide custom JSON deserialization

func (MsgCreateValidator) ValidateBasic

func (msg MsgCreateValidator) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgDeposit

type MsgDeposit struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	Amount           sdk.SysCoin    `json:"quantity" yaml:"quantity"`
}

MsgDeposit - structure for depositing to the delegator account

func NewMsgDeposit

func NewMsgDeposit(delAddr sdk.AccAddress, amount sdk.SysCoin) MsgDeposit

NewMsgDeposit creates a new instance of MsgDeposit

func (MsgDeposit) GetSignBytes

func (msg MsgDeposit) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over

func (MsgDeposit) GetSigners

func (msg MsgDeposit) GetSigners() []sdk.AccAddress

func (MsgDeposit) Route

func (msg MsgDeposit) Route() string

nolint

func (MsgDeposit) Type

func (msg MsgDeposit) Type() string

func (MsgDeposit) ValidateBasic

func (msg MsgDeposit) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgDestroyValidator

type MsgDestroyValidator struct {
	DelAddr sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
}

MsgDestroyValidator - struct for transactions to deregister a validator

func NewMsgDestroyValidator

func NewMsgDestroyValidator(delAddr sdk.AccAddress) MsgDestroyValidator

NewMsgDestroyValidator creates a msg of destroy-validator

func (MsgDestroyValidator) GetSignBytes

func (msg MsgDestroyValidator) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over

func (MsgDestroyValidator) GetSigners

func (msg MsgDestroyValidator) GetSigners() []sdk.AccAddress

func (MsgDestroyValidator) Route

func (MsgDestroyValidator) Route() string

nolint

func (MsgDestroyValidator) Type

func (MsgDestroyValidator) Type() string

func (MsgDestroyValidator) ValidateBasic

func (msg MsgDestroyValidator) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgEditValidator

type MsgEditValidator struct {
	Description
	ValidatorAddress sdk.ValAddress `json:"address" yaml:"address"`
}

MsgEditValidator - struct for editing a validator

func NewMsgEditValidator

func NewMsgEditValidator(valAddr sdk.ValAddress, description Description) MsgEditValidator

NewMsgEditValidator creates a msg of edit-validator

func (MsgEditValidator) GetSignBytes

func (msg MsgEditValidator) GetSignBytes() []byte

GetSignBytes gets the bytes for the message signer to sign on

func (MsgEditValidator) GetSigners

func (msg MsgEditValidator) GetSigners() []sdk.AccAddress

func (MsgEditValidator) Route

func (msg MsgEditValidator) Route() string

nolint

func (MsgEditValidator) Type

func (msg MsgEditValidator) Type() string

func (MsgEditValidator) ValidateBasic

func (msg MsgEditValidator) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgEditValidatorCommissionRate added in v1.6.3

type MsgEditValidatorCommissionRate struct {
	CommissionRate   sdk.Dec        `json:"commission_rate" yaml:"commission_rate"`
	ValidatorAddress sdk.ValAddress `json:"address" yaml:"address"`
}

MsgEditValidatorCommissionRate - struct for editing a validator commission rate

func NewMsgEditValidatorCommissionRate added in v1.6.3

func NewMsgEditValidatorCommissionRate(valAddr sdk.ValAddress, newRate sdk.Dec) MsgEditValidatorCommissionRate

NewMsgEditValidatorCommissionRate creates a msg of edit-validator-commission-rate

func (MsgEditValidatorCommissionRate) GetSignBytes added in v1.6.3

func (msg MsgEditValidatorCommissionRate) GetSignBytes() []byte

GetSignBytes gets the bytes for the message signer to sign on

func (MsgEditValidatorCommissionRate) GetSigners added in v1.6.3

func (msg MsgEditValidatorCommissionRate) GetSigners() []sdk.AccAddress

func (MsgEditValidatorCommissionRate) Route added in v1.6.3

nolint

func (MsgEditValidatorCommissionRate) Type added in v1.6.3

func (MsgEditValidatorCommissionRate) ValidateBasic added in v1.6.3

func (msg MsgEditValidatorCommissionRate) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgRegProxy

type MsgRegProxy struct {
	ProxyAddress sdk.AccAddress `json:"proxy_address" yaml:"proxy_address"`
	Reg          bool           `json:"reg" yaml:"reg"`
}

MsgRegProxy - register delegator as proxy or unregister proxy to delegator if Reg == true, action is reg, otherwise action is unreg

func NewMsgRegProxy

func NewMsgRegProxy(proxyAddress sdk.AccAddress, reg bool) MsgRegProxy

NewMsgRegProxy creates a msg of registering proxy

func (MsgRegProxy) GetSignBytes

func (msg MsgRegProxy) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over

func (MsgRegProxy) GetSigners

func (msg MsgRegProxy) GetSigners() []sdk.AccAddress

func (MsgRegProxy) Route

func (MsgRegProxy) Route() string

nolint

func (MsgRegProxy) Type

func (MsgRegProxy) Type() string

func (MsgRegProxy) ValidateBasic

func (msg MsgRegProxy) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgUnbindProxy

type MsgUnbindProxy struct {
	DelAddr sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
}

MsgUnbindProxy - structure for unbinding proxy relationship between the delegator and the proxy

func NewMsgUnbindProxy

func NewMsgUnbindProxy(delAddr sdk.AccAddress) MsgUnbindProxy

NewMsgUnbindProxy creates a msg of unbinding proxy

func (MsgUnbindProxy) GetSignBytes

func (msg MsgUnbindProxy) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over

func (MsgUnbindProxy) GetSigners

func (msg MsgUnbindProxy) GetSigners() []sdk.AccAddress

func (MsgUnbindProxy) Route

func (MsgUnbindProxy) Route() string

nolint

func (MsgUnbindProxy) Type

func (MsgUnbindProxy) Type() string

func (MsgUnbindProxy) ValidateBasic

func (msg MsgUnbindProxy) ValidateBasic() error

ValidateBasic gives a quick validity check

type MsgWithdraw

type MsgWithdraw struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	Amount           sdk.SysCoin    `json:"quantity" yaml:"quantity"`
}

MsgWithdraw - structure for withdrawing okt and the corresponding shares from all validators

func NewMsgWithdraw

func NewMsgWithdraw(delAddr sdk.AccAddress, amount sdk.SysCoin) MsgWithdraw

NewMsgWithdraw creates a new instance of MsgWithdraw

func (MsgWithdraw) GetSignBytes

func (msg MsgWithdraw) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over

func (MsgWithdraw) GetSigners

func (msg MsgWithdraw) GetSigners() []sdk.AccAddress

func (MsgWithdraw) Route

func (msg MsgWithdraw) Route() string

nolint

func (MsgWithdraw) Type

func (msg MsgWithdraw) Type() string

func (MsgWithdraw) ValidateBasic

func (msg MsgWithdraw) ValidateBasic() error

ValidateBasic gives a quick validity check

type MultiStakingHooks

type MultiStakingHooks []StakingHooks

MultiStakingHooks combines multiple staking hooks, all hook functions are run in array sequence TODO:need to trim the staking hooks as the okexchain design

func NewMultiStakingHooks

func NewMultiStakingHooks(hooks ...StakingHooks) MultiStakingHooks

NewMultiStakingHooks creates a new object of MultiStakingHooks

func (MultiStakingHooks) AfterDelegationModified added in v1.6.3

func (h MultiStakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)

func (MultiStakingHooks) AfterValidatorBeginUnbonding

func (h MultiStakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress,
	valAddr sdk.ValAddress)

AfterValidatorBeginUnbonding handles the hooks after the validator began the unbonding

func (MultiStakingHooks) AfterValidatorBonded

func (h MultiStakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorBonded handles the hooks after the validator was bonded

func (MultiStakingHooks) AfterValidatorCreated

func (h MultiStakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

AfterValidatorCreated handles the hooks after the validator created

func (MultiStakingHooks) AfterValidatorDestroyed

func (h MultiStakingHooks) AfterValidatorDestroyed(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorDestroyed handles the hooks after the validator was destroyed by tx

func (MultiStakingHooks) AfterValidatorRemoved

func (h MultiStakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

AfterValidatorRemoved handles the hooks after the validator was removed

func (MultiStakingHooks) BeforeDelegationCreated added in v1.6.3

func (h MultiStakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)

func (MultiStakingHooks) BeforeDelegationRemoved added in v1.6.3

func (h MultiStakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (MultiStakingHooks) BeforeDelegationSharesModified added in v1.6.3

func (h MultiStakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)

func (MultiStakingHooks) BeforeValidatorModified

func (h MultiStakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

BeforeValidatorModified handles the hooks before the validator modified

func (MultiStakingHooks) CheckEnabled added in v1.6.3

func (h MultiStakingHooks) CheckEnabled(ctx sdk.Context) bool

type OVPair

type OVPair struct {
	OperAddr sdk.ValAddress `json:"operator_address"`
	ValAddr  string         `json:"validator_address"`
}

OVPair is designed for querying validators by rest

type OVPairs

type OVPairs []OVPair

OVPairs is the alias of the OVPair slice

func (OVPairs) String

func (ovPairs OVPairs) String() (out string)

String returns a human readable string representation of OVPairs

type Params

type Params struct {
	// time duration of unbonding
	UnbondingTime time.Duration `json:"unbonding_time" yaml:"unbonding_time"`
	// note: we need to be a bit careful about potential overflow here, since this is user-determined
	// maximum number of validators (max uint16 = 65535)
	MaxValidators uint16 `json:"max_bonded_validators" yaml:"max_bonded_validators"`
	// epoch for validator update
	Epoch              uint16 `json:"epoch" yaml:"epoch"`
	MaxValsToAddShares uint16 `json:"max_validators_to_add_shares" yaml:"max_validators_to_add_shares"`
	// limited amount of delegate
	MinDelegation sdk.Dec `json:"min_delegation" yaml:"min_delegation"`
	// validator's self declared minimum self delegation
	MinSelfDelegation sdk.Dec `json:"min_self_delegation" yaml:"min_self_delegation"`

	HistoricalEntries uint32 `` /* 139-byte string literal not displayed */
}

Params defines the high level settings for staking

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters

func NewParams

func NewParams(unbondingTime time.Duration, maxValidators uint16, epoch uint16, maxValsToAddShares uint16, minDelegation sdk.Dec,
	minSelfDelegation sdk.Dec) Params

NewParams creates a new Params instance

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Param types are identical TODO: This is slower than comparing struct fields directly

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs is the implements params.ParamSet

func (*Params) String

func (p *Params) String() string

String returns a human readable string representation of the Params

func (Params) ToCM45Params added in v1.7.0

func (p Params) ToCM45Params() CM45Params

func (Params) Validate

func (p Params) Validate() error

Validate gives a quick validity check for a set of params

type Pool

type Pool struct {
	// tokens which are not bonded to a validator (unbonded or unbonding)
	NotBondedTokens sdk.Dec `json:"not_bonded_tokens" yaml:"not_bonded_tokens"`
	// tokens which are currently bonded to a validator
	BondedTokens sdk.Dec `json:"bonded_tokens" yaml:"bonded_tokens"`
}

Pool - tracking bonded and not-bonded token supply of the bond denomination

func NewPool

func NewPool(notBonded, bonded sdk.Dec) Pool

NewPool creates a new Pool instance used for queries

func (Pool) String

func (p Pool) String() string

String returns a human readable string representation of Pool

type ProxyDelegatorKeyExported

type ProxyDelegatorKeyExported struct {
	DelAddr   sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	ProxyAddr sdk.AccAddress `json:"proxy_address" yaml:"proxy_address"`
}

ProxyDelegatorKeyExported is designed for ProxyDelegatorKey export

func NewProxyDelegatorKeyExported

func NewProxyDelegatorKeyExported(delAddr, proxyAddr sdk.AccAddress) ProxyDelegatorKeyExported

NewProxyDelegatorKeyExported creates a new object of ProxyDelegatorKeyExported

type QueryBondsParams added in v1.6.6

type QueryBondsParams struct {
	DelegatorAddr sdk.AccAddress
	ValidatorAddr sdk.ValAddress
}

QueryBondsParams defines the params for the following queries: - 'custom/staking/delegation' - 'custom/staking/unbondingDelegation' - 'custom/staking/delegatorValidator'

func NewQueryBondsParams added in v1.6.6

func NewQueryBondsParams(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) QueryBondsParams

NewQueryBondsParams creates a new instance of QueryBondsParams

type QueryDelegatorDelegationsRequest added in v1.3.0

type QueryDelegatorDelegationsRequest struct {
	// delegator_addr defines the delegator address to query for.
	DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"`
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

type QueryDelegatorDelegationsResponse added in v1.3.0

type QueryDelegatorDelegationsResponse struct {
	// delegation_responses defines all the delegations' info of a delegator.
	DelegationResponses []types.DelegationResponse `protobuf:"bytes,1,rep,name=delegation_responses,json=delegationResponses,proto3" json:"delegation_responses"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

type QueryDelegatorParams

type QueryDelegatorParams struct {
	DelegatorAddr sdk.AccAddress
}

QueryDelegatorParams defines the params for the following queries: - 'custom/staking/delegatorDelegations' - 'custom/staking/delegatorUnbondingDelegations' - 'custom/staking/delegatorValidators'

func NewQueryDelegatorParams

func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams

NewQueryDelegatorParams creates a new instance of QueryDelegatorParams

type QueryDelegatorUnbondingDelegationsRequest added in v1.3.0

type QueryDelegatorUnbondingDelegationsRequest struct {
	// delegator_addr defines the delegator address to query for.
	DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"`
	// pagination defines an optional pagination for the request.
	Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

type QueryDelegatorUnbondingDelegationsResponse added in v1.3.0

type QueryDelegatorUnbondingDelegationsResponse struct {
	UnbondingResponses []types.UnbondingDelegation `protobuf:"bytes,1,rep,name=unbonding_responses,json=unbondingResponses,proto3" json:"unbonding_responses"`
	// pagination defines the pagination in the response.
	Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}

type QueryHistoricalInfoParams added in v1.6.6

type QueryHistoricalInfoParams struct {
	Height int64
}

QueryHistoricalInfoParams defines the params for the following queries: - 'custom/staking/historicalInfo'

func NewQueryHistoricalInfoParams added in v1.6.6

func NewQueryHistoricalInfoParams(height int64) QueryHistoricalInfoParams

NewQueryHistoricalInfoParams creates a new QueryHistoricalInfoParams instance

type QueryUnbondingDelegationRequest added in v1.3.0

type QueryUnbondingDelegationRequest struct {
	// delegator_addr defines the delegator address to query for.
	DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"`
	// validator_addr defines the validator address to query for.
	ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"`
}

type QueryUnbondingDelegationResponse added in v1.3.0

type QueryUnbondingDelegationResponse struct {
	// unbond defines the unbonding information of a delegation.
	Unbond types.UnbondingDelegation `protobuf:"bytes,1,opt,name=unbond,proto3" json:"unbond"`
}

type QueryValidatorDelegationsResponse added in v1.3.0

type QueryValidatorDelegationsResponse struct {
	DelegationResponses types.DelegationResponses `json:"delegation_responses"`
	Pagination          *query.PageResponse       `json:"pagination"`
}

QueryValidatorDelegationsResponse is response type for the Query/ValidatorDelegations RPC method

type QueryValidatorParams

type QueryValidatorParams struct {
	ValidatorAddr sdk.ValAddress
}

QueryValidatorParams defines the params for the following queries: - 'custom/staking/validator' - 'custom/staking/validatorDelegations' - 'custom/staking/validatorUnbondingDelegations' - 'custom/staking/validatorRedelegations'

func NewQueryValidatorParams

func NewQueryValidatorParams(validatorAddr sdk.ValAddress) QueryValidatorParams

NewQueryValidatorParams creates a new instance of QueryValidatorParams

type QueryValidatorsParams

type QueryValidatorsParams struct {
	Page, Limit int
	Status      string
}

QueryValidatorsParams defines the params for the following queries: - 'custom/staking/validators'

func NewQueryValidatorsParams

func NewQueryValidatorsParams(page, limit int, status string) QueryValidatorsParams

NewQueryValidatorsParams creates a new instance of QueryValidatorsParams

type Shares

type Shares = sdk.Dec

Shares is the alias of sdk.Dec to represent the amount of shares for adding shares to validators

func MustUnmarshalShares

func MustUnmarshalShares(cdc *codec.Codec, bytes []byte) Shares

MustUnmarshalShares unmarshals the shares bytes and return it

type SharesExported

type SharesExported struct {
	DelAddress       sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
	Shares           Shares         `json:"shares" yaml:"shares"`
}

SharesExported is designed for types.Shares export

func NewSharesExported

func NewSharesExported(delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares Shares) SharesExported

NewSharesExported creates a new object of SharesExported

type SharesResponse

type SharesResponse struct {
	DelAddr sdk.AccAddress `json:"delegator_address"`
	Shares  sdk.Dec        `json:"shares"`
}

SharesResponse is the struct for query all the shares on a validator

func NewSharesResponse

func NewSharesResponse(delAddr sdk.AccAddress, shares Shares) SharesResponse

NewSharesResponse creates a new instance of sharesResponse

func (SharesResponse) String

func (sr SharesResponse) String() string

String returns a human readable string representation of SharesResponse

type SharesResponses

type SharesResponses []SharesResponse

SharesResponses is the type alias of SharesResponse slice

func (SharesResponses) String

func (srs SharesResponses) String() (strFormat string)

String returns a human readable string representation of SharesResponses

type StakingHooks

type StakingHooks interface {
	// Must be called when a validator is created
	AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)
	// Must be called when a validator's state changes
	BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)
	// Must be called when a validator is deleted
	AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
	// Must be called when a validator is bonded
	AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)
	// Must be called when a validator begins unbonding
	AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

	// required by okexchain
	// Must be called when a validator is destroyed by tx
	AfterValidatorDestroyed(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

	// Must be called when a delegation is created
	BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)
	// Must be called when a delegation's shares are modified
	BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)
	// Must be called when a delegation is removed
	BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)
	// Must be called when a delegation is modified
	AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddrs []sdk.ValAddress)
	//BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)
	// Check modules enabled
	CheckEnabled(ctx sdk.Context) bool
}

StakingHooks event hooks for staking validator object (noalias)

type StandardizedValidator

type StandardizedValidator struct {
	OperatorAddress         sdk.ValAddress `json:"operator_address" yaml:"operator_address"`
	ConsPubKey              crypto.PubKey  `json:"consensus_pubkey" yaml:"consensus_pubkey"`
	Jailed                  bool           `json:"jailed" yaml:"jailed"`
	Status                  sdk.BondStatus `json:"status" yaml:"status"`
	DelegatorShares         sdk.Dec        `json:"delegator_shares" yaml:"delegator_shares"`
	Description             Description    `json:"description" yaml:"description"`
	UnbondingHeight         int64          `json:"unbonding_height" yaml:"unbonding_height"`
	UnbondingCompletionTime time.Time      `json:"unbonding_time" yaml:"unbonding_time"`
	MinSelfDelegation       sdk.Dec        `json:"min_self_delegation" yaml:"min_self_delegation"`
	Commission              Commission     `json:"commission" yaml:"commission"`
}

StandardizedValidator is just a copy of Validator in cosmos sdk The field "DelegatorShares"/"MinSelfDelegation" is treated by descending power 8 to decimal

func (StandardizedValidator) MarshalYAML

func (sv StandardizedValidator) MarshalYAML() (interface{}, error)

MarshalYAML implememts the text format for yaml marshaling

func (StandardizedValidator) String

func (sv StandardizedValidator) String() string

String returns a human readable string representation of a StandardizeValidator

type StandardizedValidators

type StandardizedValidators []StandardizedValidator

StandardizedValidators is the type alias of the StandardizedValidator slice

func (StandardizedValidators) MarshalYAML

func (svs StandardizedValidators) MarshalYAML() (interface{}, error)

MarshalYAML implememts the text format for yaml marshaling

func (StandardizedValidators) String

func (svs StandardizedValidators) String() string

String returns a human readable string representation of StandardizeValidators

type SupplyKeeper

type SupplyKeeper interface {
	GetSupplyByDenom(ctx sdk.Context, denom string) sdk.Dec

	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, moduleName string) supplyexported.ModuleAccountI

	// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
	SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI)

	SendCoinsFromModuleToModule(ctx sdk.Context, senderPool, recipientPool string, amt sdk.Coins) error
	UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress,
		amt sdk.SysCoins) error
	DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string,
		amt sdk.SysCoins) error

	BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error
}

SupplyKeeper defines the expected supply Keeper (noalias)

type UnbondingResponses added in v1.7.0

type UnbondingResponses struct {
	UR []CM45UnbondingResp `json:"unbonding_responses"`
}

func FormatCM45UnbondingResponses added in v1.7.0

func FormatCM45UnbondingResponses(ui UndelegationInfo) UnbondingResponses

func NewUnbondingResponses added in v1.7.0

func NewUnbondingResponses(ur []CM45UnbondingResp) UnbondingResponses

type UndelegationInfo

type UndelegationInfo struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	Quantity         sdk.Dec        `json:"quantity" yaml:"quantity"`
	CompletionTime   time.Time      `json:"completion_time"`
}

UndelegationInfo is the struct of the undelegation info

func DefaultUndelegation

func DefaultUndelegation() UndelegationInfo

DefaultUndelegation returns default entity for UndelegationInfo

func MustUnMarshalUndelegationInfo

func MustUnMarshalUndelegationInfo(cdc *codec.Codec, value []byte) UndelegationInfo

MustUnMarshalUndelegationInfo must return the UndelegationInfo object by unmarshaling

func NewUndelegationInfo

func NewUndelegationInfo(delegatorAddr sdk.AccAddress, sharesQuantity Shares, completionTime time.Time) UndelegationInfo

NewUndelegationInfo creates a new delegation object

func UnmarshalUndelegationInfo

func UnmarshalUndelegationInfo(cdc *codec.Codec, value []byte) (undelegationInfo UndelegationInfo, err error)

UnmarshalUndelegationInfo returns the UndelegationInfo object by unmarshaling

func (UndelegationInfo) String

func (ud UndelegationInfo) String() string

String returns a human readable string representation of UndelegationInfo

type Validator

type Validator struct {
	// address of the validator's operator; bech encoded in JSON
	OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"`
	// the consensus public key of the validator; bech encoded in JSON
	ConsPubKey crypto.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"`
	// has the validator been jailed from bonded status?
	Jailed bool `json:"jailed" yaml:"jailed"`
	// validator status (bonded/unbonding/unbonded)
	Status sdk.BondStatus `json:"status" yaml:"status"`
	// delegated tokens (incl. self-delegation)
	Tokens sdk.Int `json:"tokens" yaml:"tokens"`
	// total shares added to a validator
	DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"`
	// description terms for the validator
	Description Description `json:"description" yaml:"description"`
	// if unbonding, height at which this validator has begun unbonding
	UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"`
	// if unbonding, min time for the validator to complete unbonding
	UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"`
	// commission parameters
	Commission Commission `json:"commission" yaml:"commission"`
	// validator's self declared minimum self delegation
	MinSelfDelegation sdk.Dec `json:"min_self_delegation" yaml:"min_self_delegation"`
}

Validator defines the total amount of bond shares and their exchange rate to coins. Slashing results in a decrease in the exchange rate, allowing correct calculation of future undelegations without iterating over delegators. 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 bonded shares multiplied by exchange rate.

func MustUnmarshalValidator

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

MustUnmarshalValidator must return the validator entity by unmarshaling

func NewValidator

func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description, minSelfDelegation sdk.Dec) Validator

NewValidator initializes a new validator

func UnmarshalValidator

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

UnmarshalValidator unmarshals a validator from a store value

func (Validator) ABCIValidatorUpdate

func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate

ABCIValidatorUpdate returns an abci.ValidatorUpdate from a staking validator type with the full validator power

func (Validator) ABCIValidatorUpdateByShares

func (v Validator) ABCIValidatorUpdateByShares() abci.ValidatorUpdate

ABCIValidatorUpdateByShares returns an abci.ValidatorUpdate from a staking validator type with the full validator power based on shares

func (Validator) ABCIValidatorUpdateZero

func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate

ABCIValidatorUpdateZero returns an abci.ValidatorUpdate from a staking validator type with zero power used for validator updates.

func (Validator) BondedTokens

func (v Validator) BondedTokens() sdk.Int

BondedTokens gets the bonded tokens which the validator holds

func (Validator) ConsAddress

func (v Validator) ConsAddress() sdk.ConsAddress

ConsAddress returns the TM validator address

func (Validator) ConsensusPower

func (v Validator) ConsensusPower() int64

ConsensusPower gets the consensus-engine power

func (Validator) ConsensusPowerByShares

func (v Validator) ConsensusPowerByShares() int64

ConsensusPowerByShares gets the consensus-engine power

func (Validator) Export

func (v Validator) Export() ValidatorExported

Export returns the exported format of validator in genesis export

func (Validator) GetBondedTokens

func (v Validator) GetBondedTokens() sdk.Int

func (Validator) GetCommission

func (v Validator) GetCommission() sdk.Dec

func (Validator) GetConsAddr

func (v Validator) GetConsAddr() sdk.ConsAddress

func (Validator) GetConsPubKey

func (v Validator) GetConsPubKey() crypto.PubKey

func (Validator) GetConsensusPower

func (v Validator) GetConsensusPower() int64

func (Validator) GetDelegatorShares

func (v Validator) GetDelegatorShares() sdk.Dec

func (Validator) GetMinSelfDelegation

func (v Validator) GetMinSelfDelegation() sdk.Dec

func (Validator) GetMoniker

func (v Validator) GetMoniker() string

func (Validator) GetOperator

func (v Validator) GetOperator() sdk.ValAddress

func (Validator) GetStatus

func (v Validator) GetStatus() sdk.BondStatus

func (Validator) GetTokens

func (v Validator) GetTokens() sdk.Int

func (Validator) IsBonded

func (v Validator) IsBonded() bool

IsBonded checks if the validator status equals Bonded

func (Validator) IsJailed

func (v Validator) IsJailed() bool

nolint - for ValidatorI

func (Validator) IsUnbonded

func (v Validator) IsUnbonded() bool

IsUnbonded checks if the validator status equals Unbonded

func (Validator) IsUnbonding

func (v Validator) IsUnbonding() bool

IsUnbonding checks if the validator status equals Unbonding

func (Validator) MarshalJSON

func (v Validator) MarshalJSON() ([]byte, error)

MarshalJSON marshals the validator to JSON using Bech32

func (Validator) MarshalYAML

func (v Validator) MarshalYAML() (interface{}, error)

MarshalYAML implements the text format for yaml marshaling due to consensus pubkey

func (Validator) PotentialConsensusPowerByShares

func (v Validator) PotentialConsensusPowerByShares() int64

PotentialConsensusPowerByShares gets potential consensus-engine power based on shares

func (Validator) SetInitialCommission

func (v Validator) SetInitialCommission(commission Commission) (Validator, error)

SetInitialCommission attempts to set a validator's initial commission. An error is returned if the commission is invalid.

func (Validator) SharesFromTokens

func (v Validator) SharesFromTokens(amt sdk.Int) (sdk.Dec, error)

SharesFromTokens returns the shares of a delegation given a bond amount It returns an error if the validator has no tokens No usage found in All Places

func (Validator) SharesFromTokensTruncated

func (v Validator) SharesFromTokensTruncated(amt sdk.Int) (sdk.Dec, error)

SharesFromTokensTruncated returns the truncated shares of a delegation given a bond amount It returns an error if the validator has no tokens No usage found in All Places

func (Validator) Standardize

func (v Validator) Standardize() StandardizedValidator

Standardize converts inner struct Validator to StandardizedValidator which is used to display

func (Validator) String

func (v Validator) String() string

String returns a human readable string representation of a validator.

func (Validator) TestEquivalent

func (v Validator) TestEquivalent(v2 Validator) bool

TestEquivalent is only for the ut

func (Validator) TokensFromShares

func (v Validator) TokensFromShares(shares sdk.Dec) sdk.Dec

TokensFromShares calculates the token worth of provided shares

func (Validator) TokensFromSharesRoundUp

func (v Validator) TokensFromSharesRoundUp(shares sdk.Dec) sdk.Dec

TokensFromSharesRoundUp returns the token worth of provided shares, rounded up No usage found in All Places

func (Validator) TokensFromSharesTruncated

func (v Validator) TokensFromSharesTruncated(shares sdk.Dec) sdk.Dec

TokensFromSharesTruncated calculates the token worth of provided shares, truncated

func (*Validator) UnmarshalFromAmino added in v0.19.16

func (v *Validator) UnmarshalFromAmino(cdc *amino.Codec, data []byte) error

func (*Validator) UnmarshalJSON

func (v *Validator) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the validator from JSON using Bech32

func (Validator) UpdateStatus

func (v Validator) UpdateStatus(newStatus sdk.BondStatus) Validator

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

type ValidatorExported

type ValidatorExported struct {
	OperatorAddress         sdk.ValAddress `json:"operator_address"`
	ConsPubKey              string         `json:"consensus_pubkey"`
	Jailed                  bool           `json:"jailed"`
	Status                  sdk.BondStatus `json:"status" yaml:"status"`
	DelegatorShares         sdk.Dec        `json:"delegator_shares"`
	Description             Description    `json:"description"`
	UnbondingHeight         int64          `json:"unbonding_height"`
	UnbondingCompletionTime time.Time      `json:"unbonding_time"`
	MinSelfDelegation       sdk.Dec        `json:"min_self_delegation"`
}

ValidatorExported is designed for Validator export

func (ValidatorExported) ConsAddress

func (ve ValidatorExported) ConsAddress() sdk.ConsAddress

ConsAddress returns the TM validator address of exported validator

func (ValidatorExported) Import

func (ve ValidatorExported) Import() Validator

Import converts validator exported format to inner one by filling the zero-value of Tokens and Commission

func (ValidatorExported) IsBonded

func (ve ValidatorExported) IsBonded() bool

IsBonded checks if the exported validator status equals Bonded

type ValidatorSet

type ValidatorSet interface {
	// iterate through validators by operator address, execute func for each validator
	IterateValidators(sdk.Context,
		func(index int64, validator stakingexported.ValidatorI) (stop bool))

	// iterate through bonded validators by operator address, execute func for each validator
	IterateBondedValidatorsByPower(sdk.Context,
		func(index int64, validator stakingexported.ValidatorI) (stop bool))

	// iterate through the consensus validator set of the last block by operator address, execute func for each validator
	IterateLastValidators(sdk.Context,
		func(index int64, validator stakingexported.ValidatorI) (stop bool))
	// get a particular validator by operator address
	Validator(sdk.Context, sdk.ValAddress) stakingexported.ValidatorI
	// get a particular validator by consensus address
	ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingexported.ValidatorI
	// total bonded tokens within the validator set
	TotalBondedTokens(sdk.Context) sdk.Dec
	// total staking token supply
	StakingTokenSupply(sdk.Context) sdk.Dec

	// slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction
	// jail a validator
	Jail(sdk.Context, sdk.ConsAddress)
	// unjail a validator
	Unjail(sdk.Context, sdk.ConsAddress)

	// MaxValidators returns the maximum amount of bonded validators
	MaxValidators(sdk.Context) uint16
}

ValidatorSet expected properties for the set of all validators (noalias)

type Validators

type Validators []Validator

Validators is a collection of Validator

func (Validators) Export

func (v Validators) Export() []ValidatorExported

Export returns the exported format of Validators in genesis export

func (Validators) Len added in v1.3.0

func (v Validators) Len() int

Implements sort interface

func (Validators) Less added in v1.3.0

func (v Validators) Less(i, j int) bool

Implements sort interface

func (Validators) Sort added in v1.3.0

func (v Validators) Sort()

Sort Validators sorts validator array in ascending operator address order

func (Validators) Standardize

func (v Validators) Standardize() StandardizedValidators

Standardize converts inner struct Validators to StandardizedValidators which is used to display

func (Validators) String

func (v Validators) String() (out string)

String returns a human readable string representation of Validators

func (Validators) Swap added in v1.3.0

func (v Validators) Swap(i, j int)

Implements sort interface

func (Validators) ToSDKValidators

func (v Validators) ToSDKValidators() (validators []exported.ValidatorI)

ToSDKValidators converts []Validators to []sdk.Validators

func (Validators) ToValAddresses added in v1.6.3

func (v Validators) ToValAddresses() (valAddrs []sdk.ValAddress)

ToValAddresses converts []Validators to []sdk.ValAddress

type WrappedParams added in v1.7.0

type WrappedParams struct {
	Params CM45Params `json:"params" yaml:"params"`
}

WrappedParams is used to wrap the Params, thus making the rest API response compatible with cosmos-sdk

func NewWrappedParams added in v1.7.0

func NewWrappedParams(params CM45Params) WrappedParams

NewWrappedParams creates a new instance of WrappedParams

type WrappedPool added in v1.7.0

type WrappedPool struct {
	P Pool `json:"pool" yaml:"pool"`
}

func NewWrappedPool added in v1.7.0

func NewWrappedPool(p Pool) WrappedPool

type WrappedValidator added in v1.7.0

type WrappedValidator struct {
	V CM45Validator `json:"validator" yaml:"validator"`
}

func NewWrappedValidator added in v1.7.0

func NewWrappedValidator(v CM45Validator) WrappedValidator

type WrappedValidators added in v1.7.0

type WrappedValidators struct {
	Vs []CM45Validator `json:"validators" yaml:"validator"`
}

func NewWrappedValidators added in v1.7.0

func NewWrappedValidators(vs []CM45Validator) WrappedValidators

Jump to

Keyboard shortcuts

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