types

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AddrLen defines a valid address length
	AddrLen = 20
	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32MainPrefix = "dx"

	// Atom in https://github.com/satoshilabs/slips/blob/master/slip-0044.md
	CoinType = 118

	// BIP44Prefix is the parts of the BIP44 HD path that are fixed by
	// what we used during the fundraiser.
	FullFundraiserPath = "44'/118'/0'/0/0"

	// PrefixAccount is the prefix for account keys
	PrefixAccount = "acc"
	// PrefixValidator is the prefix for validator keys
	PrefixValidator = "val"
	// PrefixConsensus is the prefix for consensus keys
	PrefixConsensus = "cons"
	// PrefixPublic is the prefix for public keys
	PrefixPublic = "pub"
	// PrefixOperator is the prefix for operator keys
	PrefixOperator = "oper"

	// PrefixAddress is the prefix for addresses
	PrefixAddress = "addr"

	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32PrefixAccAddr = Bech32MainPrefix
	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
	Bech32PrefixAccPub = Bech32MainPrefix + PrefixPublic
	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
	Bech32PrefixValAddr = Bech32MainPrefix + PrefixValidator + PrefixOperator
	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
	Bech32PrefixValPub = Bech32MainPrefix + PrefixValidator + PrefixOperator + PrefixPublic
	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
	Bech32PrefixConsAddr = Bech32MainPrefix + PrefixValidator + PrefixConsensus
	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
	Bech32PrefixConsPub = Bech32MainPrefix + PrefixValidator + PrefixConsensus + PrefixPublic
)
View Source
const (
	// Default validator codespace
	DefaultCodespace string = ModuleName

	CodeEmptyValidatorAddr           CodeType = 100
	CodeValidatorAddressAlreadyExist CodeType = 101
	CodeValidatorPubKeyAlreadyExist  CodeType = 102
	CodeValidatorDoesNotExist        CodeType = 103
	CodeCommissionNegative           CodeType = 104
	CodeCommissionHuge               CodeType = 105
	CodeValidatorAlreadyOnline       CodeType = 106
	CodeValidatorAlreadyOffline      CodeType = 107

	CodeInvalidStruct CodeType = 200
	CodeAccountNotSet CodeType = 201

	CodeInvalidDelegation           CodeType = 300
	CodeInsufficientShares          CodeType = 301
	CodeDelegatorShareExRateInvalid CodeType = 302
	CodeUnbondingDelegationNotFound CodeType = 303
	CodeBadDelegationAmount         CodeType = 304
	CodeNoDelegatorForAddress       CodeType = 305
	CodeNotEnoughDelegationShares   CodeType = 306

	CodeEmptyPubKey                     CodeType = 400
	CodeValidatorPubKeyTypeNotSupported CodeType = 401

	CodeCoinReserveIsNotSufficient CodeType = 500

	CodeErrInvalidHistoricalInfo CodeType = 600
	CodeValidatorSetEmpty        CodeType = 601
	CodeValidatorSetNotSorted    CodeType = 602

	CodeErrNoHistoricalInfo CodeType = 700

	CodeDelegatorStakeIsTooLow    CodeType = 800
	CodeEmptyDelegatorAddress     CodeType = 801
	CodeOwnerDoesNotOwnSubTokenID CodeType = 802

	CodeInsufficientCoinToPayCommission CodeType = 900
	CodeInsufficientFunds               CodeType = 901
	CodeUpdateBalanceError              CodeType = 902
	CodeErrCalculateCommission          CodeType = 903
	CodeCoinDoesNotExist                CodeType = 904

	CodeInternalError CodeType = 1000
)
View Source
const (
	EventTypeDeclareCandidate     = "declare_candidate"
	EventTypeEditCandidate        = "edit_candidate"
	EventTypeDelegate             = "delegate"
	EventTypeUnbond               = "unbond"
	EventTypeSetOnline            = "set_online"
	EventTypeSetOffline           = "set_offline"
	EventTypeCompleteUnbonding    = "complete_unbonding"
	EventTypeCompleteUnbondingNFT = "complete_unbonding_nft"
	EventTypeProposerReward       = "proposer_reward"
	EventTypeCommissionReward     = "commission_reward"
	EventTypeSlash                = "slash"
	EventTypeEmission             = "emission"
	EventTypeLiveness             = "liveness"
	EventTypeLivenessNFT          = "liveness_nft"
	EventTypeUpdatesValidators    = "updates_validator"
	EventTypeCalcStake            = "calc_stake"
	EventTypeDAOReward            = "dao_reward"
	EventTypeDevelopReward        = "develop_reward"

	AttributeDelPrice                      = "del"
	AttributeKeyValidator                  = "validator"
	AttributeKeyDelegator                  = "delegator"
	AttributeKeyRewardAddress              = "reward_address"
	AttributeKeyCoin                       = "coin"
	AttributeKeyPubKey                     = "pub_key"
	AttributeKeyCompletionTime             = "completion_time"
	AttributeKeyAddress                    = "address"
	AttributeKeyReason                     = "reason"
	AttributeKeyPower                      = "power"
	AttributeKeyStake                      = "stake"
	AttributeKeyValidatorOdCandidate       = "status"
	AttributeKeySlashAmount                = "slash_amount"
	AttributeKeySlashSubTokenID            = "sub_token_id"
	AttributeKeySlashReserve               = "sub_token_id_reserve"
	AttributeKeyMissedBlocks               = "missed_blocks"
	AttributeKeyHeight                     = "height"
	AttributeKeyCommission                 = "commission"
	AttributeKeyDescriptionMoniker         = "moniker"
	AttributeKeyDescriptionIdentity        = "identity"
	AttributeKeyDescriptionWebsite         = "website"
	AttributeKeyDescriptionSecurityContact = "security_contact"
	AttributeKeyDescriptionDetails         = "details"
	AttributeKeyDAOAddress                 = "dao_address"
	AttributeKeyDevelopAddress             = "develop_address"
	AttributeKeyDenom                      = "denom"
	AttributeKeyID                         = "id"
	AttributeKeyQuantity                   = "quantity"
	AttributeKeySubTokenIDs                = "sub_token_ids"

	AttributeValueDoubleSign       = "double_sign"
	AttributeValueMissingSignature = "missing_signature"

	AttributeValueCategory = ModuleName
)

validator module event types

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

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

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

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	QuerierRoute = ModuleName

	LastTotalPowerKey                   = 0x02
	ValidatorsByConsAddrKey             = 0x03
	ValidatorsByPowerIndexKey           = 0x04
	ValidatorQueueKey                   = 0x05
	LastValidatorPowerKey               = 0x06
	ValidatorsKey                       = 0x07
	DelegationKey                       = 0x08
	UnbondingDelegationKey              = 0x09
	UnbondingDelegationByValIndexKey    = 0x0a
	UnbondingQueueKey                   = 0x0b
	ValidatorSigningInfoKey             = 0x10
	ValidatorMissedBlockBitArrayKey     = 0x11
	AddrPubkeyRelationKey               = 0x12
	HistoricalInfoKey                   = 0x13
	DelegationNFTKey                    = 0x14
	UnbondingDelegationNFTKey           = 0x15
	UnbondingDelegationNFTByValIndexKey = 0x16
	UnbondingNFTQueueKey                = 0x17
	DelegatedCoinKey                    = 0x18
)
View Source
const (
	// DefaultUnbondingTime reflects three weeks in seconds as the default
	// unbonding time.
	DefaultUnbondingTime = time.Minute * 2

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

	// Default maximum entries in a UBD/RED pair
	DefaultMaxEntries uint16 = 7

	// DefaultHistorical entries is 0 since it must only be non-zero for
	// IBC connected chains
	DefaultHistoricalEntries uint16 = 0

	DefaultBondDenom string = "tdel"

	DefaultMaxDelegations uint16 = 1000
)

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"
	QueryDelegatorDelegations          = "delegatorDelegations"
	QueryDelegatorUnbondingDelegations = "delegatorUnbondingDelegations"
	QueryValidatorDelegations          = "validatorDelegations"
	QueryValidatorUnbondingDelegations = "validatorUnbondingDelegations"
	QueryDelegation                    = "delegation"
	QueryUnbondingDelegation           = "unbondingDelegation"
	QueryDelegatorValidators           = "delegatorValidators"
	QueryDelegatorValidator            = "delegatorValidator"
	QueryPool                          = "pool"
	QueryParameters                    = "parameters"
	QueryHistoricalInfo                = "historicalInfo"
	QueryDelegatedCoins                = "delegatedCoins"
	QueryDelegatedCoin                 = "delegatedCoin"
)

query endpoints supported by the validator Querier

View Source
const (
	SignedBlocksWindow int64 = 24
	MinSignedPerWindow int64 = 12
)
View Source
const (
	MaxMonikerLength         = 70
	MaxIdentityLength        = 3000
	MaxWebsiteLength         = 140
	MaxSecurityContactLength = 140
	MaxDetailsLength         = 280
)

nolint

View Source
const (
	Unbonded  BondStatus = 0x00
	Unbonding BondStatus = 0x01
	Bonded    BondStatus = 0x02

	BondStatusUnbonded  = "Unbonded"
	BondStatusUnbonding = "Unbonding"
	BondStatusBonded    = "Bonded"
)

staking constants

View Source
const DeclareCandidateConst = "declare_candidate"
View Source
const DelegateConst = "delegate"
View Source
const DelegateNFTConst = "delegate_nft"
View Source
const DoNotModifyDesc = "[do-not-modify]"

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

View Source
const EditCandidateConst = "edit_candidate"
View Source
const SetOfflineConst = "set_offline"
View Source
const SetOnlineConst = "set_online"
View Source
const UnbondConst = "unbond"
View Source
const UnbondNFTConst = "unbond_nft"

Variables

View Source
var (
	KeyUnbondingTime     = []byte("UnbondingTime")
	KeyMaxValidators     = []byte("MaxValidators")
	KeyMaxEntries        = []byte("KeyMaxEntries")
	KeyBondDenom         = []byte("BondDenom")
	KeyHistoricalEntries = []byte("HistoricalEntries")
	KeyMaxDelegations    = []byte("MaxDelegations")
)

nolint - Keys for parameter access

View Source
var (
	SlashFractionDowntime   = sdk.NewDec(1).Quo(sdk.NewDec(100))
	SlashFractionDoubleSign = sdk.NewDec(1).Quo(sdk.NewDec(20))
)
View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

View Source
var PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))

PowerReduction is the amount of staking tokens required for 1 unit of consensus-engine power

Functions

func AddressFromLastValidatorPowerKey

func AddressFromLastValidatorPowerKey(key []byte) []byte

Get the validator operator address from LastValidatorPowerKey

func ErrAccountNotSet

func ErrAccountNotSet() *sdkerrors.Error

func ErrBadDelegationAmount

func ErrBadDelegationAmount() *sdkerrors.Error

func ErrCalculateCommission

func ErrCalculateCommission(error string) *sdkerrors.Error

func ErrCoinDoesNotExist

func ErrCoinDoesNotExist(symbol string) *sdkerrors.Error

func ErrCoinReserveIsNotSufficient

func ErrCoinReserveIsNotSufficient(reserve string, amount string) *sdkerrors.Error

func ErrCommissionHuge

func ErrCommissionHuge() *sdkerrors.Error

func ErrCommissionNegative

func ErrCommissionNegative() *sdkerrors.Error

func ErrDelegatorShareExRateInvalid

func ErrDelegatorShareExRateInvalid() *sdkerrors.Error

func ErrDelegatorStakeIsTooLow

func ErrDelegatorStakeIsTooLow() *sdkerrors.Error

func ErrEmptyDelegatorAddr

func ErrEmptyDelegatorAddr() *sdkerrors.Error

func ErrEmptyPubKey

func ErrEmptyPubKey() *sdkerrors.Error

func ErrEmptyValidatorAddr

func ErrEmptyValidatorAddr() *sdkerrors.Error

func ErrInsufficientCoinToPayCommission

func ErrInsufficientCoinToPayCommission(commission string) *sdkerrors.Error

func ErrInsufficientFunds

func ErrInsufficientFunds(funds string) *sdkerrors.Error

func ErrInsufficientShares

func ErrInsufficientShares() *sdkerrors.Error

func ErrInternal

func ErrInternal(error string) *sdkerrors.Error

func ErrInvalidHistoricalInfo

func ErrInvalidHistoricalInfo() *sdkerrors.Error

func ErrInvalidStruct

func ErrInvalidStruct() *sdkerrors.Error

func ErrNoDelegation

func ErrNoDelegation() *sdkerrors.Error

func ErrNoDelegatorForAddress

func ErrNoDelegatorForAddress() *sdkerrors.Error

func ErrNoHistoricalInfo

func ErrNoHistoricalInfo(height string) *sdkerrors.Error

func ErrNoValidatorFound

func ErrNoValidatorFound() *sdkerrors.Error

func ErrNotEnoughDelegationShares

func ErrNotEnoughDelegationShares(shares string) *sdkerrors.Error

func ErrOwnerDoesNotOwnSubTokenID

func ErrOwnerDoesNotOwnSubTokenID(owner string, subTokenID string) *sdkerrors.Error

func ErrUnbondingDelegationNotFound

func ErrUnbondingDelegationNotFound() *sdkerrors.Error

func ErrUpdateBalance

func ErrUpdateBalance(error string) *sdkerrors.Error

func ErrValidatorAlreadyOffline

func ErrValidatorAlreadyOffline() *sdkerrors.Error

func ErrValidatorAlreadyOnline

func ErrValidatorAlreadyOnline() *sdkerrors.Error

func ErrValidatorOwnerExists

func ErrValidatorOwnerExists() *sdkerrors.Error

func ErrValidatorPubKeyExists

func ErrValidatorPubKeyExists() *sdkerrors.Error

func ErrValidatorPubKeyTypeNotSupported

func ErrValidatorPubKeyTypeNotSupported(PKeyType string, AllowedTypes string) *sdkerrors.Error

func ErrValidatorSetEmpty

func ErrValidatorSetEmpty() *sdkerrors.Error

func ErrValidatorSetNotSorted

func ErrValidatorSetNotSorted() *sdkerrors.Error

func GetAddrPubkeyRelationKey

func GetAddrPubkeyRelationKey(address []byte) []byte

get pubkey relation key used to get the pubkey from the address

func GetDelegateCoinKey

func GetDelegateCoinKey(symbol string) []byte

func GetDelegationKey

func GetDelegationKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress, coin string) []byte

gets the key for delegator bond with validator VALUE: staking/Delegation

func GetDelegationNFTKey

func GetDelegationNFTKey(delAddr sdk.AccAddress, valAddr sdk.ValAddress, tokenID, denom string) []byte

func GetDelegationsKey

func GetDelegationsKey(delAddr sdk.AccAddress) []byte

gets the prefix for a delegator for all validators

func GetDelegationsNFTKey

func GetDelegationsNFTKey(delAddr sdk.AccAddress) []byte

func GetHistoricalInfoKey

func GetHistoricalInfoKey(height int64) []byte

GetHistoricalInfoKey gets the key for the historical info

func GetLastValidatorPowerKey

func GetLastValidatorPowerKey(valAddress sdk.ValAddress) []byte

get the bonded validator index key for an operator address

func GetRewardForBlock

func GetRewardForBlock(blockHeight uint64) sdk.Int

func GetUBDByValIndexKey

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

gets the index-key for an unbonding delegation, stored by validator-index VALUE: none (key rearrangement used)

func GetUBDKey

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

gets the key for an unbonding delegation by delegator and validator addr VALUE: staking/UnbondingDelegation

func GetUBDKeyFromValIndexKey

func GetUBDKeyFromValIndexKey(IndexKey []byte) []byte

rearranges the ValIndexKey to get the UBDKey

func GetUBDsByValIndexKey

func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte

gets the prefix keyspace for the indexes of unbonding delegations for a validator

func GetUBDsKey

func GetUBDsKey(delAddr sdk.AccAddress) []byte

gets the prefix for all unbonding delegations from a delegator

func GetUnbondingDelegationNFTByValIndexKey

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

gets the index-key for an unbonding delegation, stored by validator-index VALUE: none (key rearrangement used)

func GetUnbondingDelegationNFTKey

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

gets the key for an unbonding delegation by delegator and validator addr VALUE: staking/UnbondingDelegation

func GetUnbondingDelegationNFTKeyFromValIndexKey

func GetUnbondingDelegationNFTKeyFromValIndexKey(IndexKey []byte) []byte

rearranges the ValIndexKey to get the UBDKey

func GetUnbondingDelegationNFTTimeKey

func GetUnbondingDelegationNFTTimeKey(timestamp time.Time) []byte

gets the prefix for all unbonding delegations from a delegator

func GetUnbondingDelegationNFTsByValIndexKey

func GetUnbondingDelegationNFTsByValIndexKey(valAddr sdk.ValAddress) []byte

gets the prefix keyspace for the indexes of unbonding delegations for a validator

func GetUnbondingDelegationNFTsKey

func GetUnbondingDelegationNFTsKey(delAddr sdk.AccAddress) []byte

gets the prefix for all unbonding delegations from a delegator

func GetUnbondingDelegationTimeKey

func GetUnbondingDelegationTimeKey(timestamp time.Time) []byte

gets the prefix for all unbonding delegations from a delegator

func GetValidatorByConsAddrKey

func GetValidatorByConsAddrKey(addr sdk.ConsAddress) []byte

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

func GetValidatorKey

func GetValidatorKey(addr sdk.ValAddress) []byte

func GetValidatorMissedBlockBitArrayKey

func GetValidatorMissedBlockBitArrayKey(v sdk.ConsAddress, i int64) []byte

stored by *Consensus* address (not operator address)

func GetValidatorMissedBlockBitArrayPrefixKey

func GetValidatorMissedBlockBitArrayPrefixKey(v sdk.ConsAddress) []byte

stored by *Consensus* address (not operator address)

func GetValidatorQueueTimeKey

func GetValidatorQueueTimeKey(timestamp time.Time) []byte

gets the prefix for all unbonding delegations from a delegator

func GetValidatorSigningInfoKey

func GetValidatorSigningInfoKey(v sdk.ConsAddress) []byte

stored by *Consensus* address (not operator address)

func GetValidatorsByPowerIndexKey

func GetValidatorsByPowerIndexKey(validator Validator, power sdk.Int) []byte

get 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 MustMarshalBaseUBD

func MustMarshalBaseUBD(cdc *codec.Codec, ubd BaseUnbondingDelegation) []byte

func MustMarshalDelegateCoin

func MustMarshalDelegateCoin(cdc *codec.Codec, amount sdk.Int) []byte

func MustMarshalDelegation

func MustMarshalDelegation(cdc *codec.Codec, delegation Delegation) []byte

return the delegation

func MustMarshalDelegationNFT

func MustMarshalDelegationNFT(cdc *codec.Codec, delegation DelegationNFT) []byte

func MustMarshalHistoricalInfo

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

MustMarshalHistoricalInfo wll marshal historical info and panic on error

func MustMarshalNFTUBD

func MustMarshalNFTUBD(cdc *codec.Codec, ubd NFTUnbondingDelegation) []byte

func MustMarshalUBD

func MustMarshalUBD(cdc *codec.Codec, ubd UnbondingDelegation) []byte

return the unbonding delegation

func MustUnmarshalDelegateCoin

func MustUnmarshalDelegateCoin(cdc *codec.Codec, value []byte) sdk.Int

func ParseValidatorPowerRankKey

func ParseValidatorPowerRankKey(key []byte) (operAddr []byte)

parse the validators operator address from power rank key

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec

func TokensFromConsensusPower

func TokensFromConsensusPower(power int64) sdk.Int

TokensFromConsensusPower - convert input power to tokens

func TokensToConsensusPower

func TokensToConsensusPower(tokens sdk.Int) int64

TokensToConsensusPower - convert input tokens to potential consensus-engine power

func ValidateBasic

func ValidateBasic(hi HistoricalInfo) error

ValidateBasic will ensure HistoricalInfo is not nil and sorted

Types

type BaseUnbondingDelegation

type BaseUnbondingDelegation struct {
	DelegatorAddress sdk.AccAddress             `json:"delegator_address" yaml:"delegator_address"` // delegator
	ValidatorAddress sdk.ValAddress             `json:"validator_address" yaml:"validator_address"` // validator unbonding from operator addr
	Entries          []UnbondingDelegationEntry `json:"entries" yaml:"entries"`                     // unbonding delegation entries
}

func MustUnmarshalBaseUBD

func MustUnmarshalBaseUBD(cdc *codec.Codec, value []byte) BaseUnbondingDelegation

func UnmarshalBaseUBD

func UnmarshalBaseUBD(cdc *codec.Codec, value []byte) (ubd BaseUnbondingDelegation, err error)

type BaseUnbondingDelegations

type BaseUnbondingDelegations []BaseUnbondingDelegation

type BondStatus

type BondStatus byte

BondStatus is the status of a validator

func (BondStatus) Equal

func (b BondStatus) Equal(b2 BondStatus) bool

Equal compares two BondStatus instances

func (BondStatus) String

func (b BondStatus) String() string

String implements the Stringer interface for BondStatus.

type CodeType

type CodeType = uint32

Local code type

type Commission

type Commission struct {
	Rate sdk.Dec
}

type DVPair

type DVPair struct {
	DelegatorAddress sdk.AccAddress
	ValidatorAddress sdk.ValAddress
}

DVPair is struct that just has a delegator-validator pair with no other data. It is intended to be used as a marshalable pointer. For example, a DVPair can be used to construct the key to getting an UnbondingDelegation from state.

type Delegation

type Delegation struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
	Coin             sdk.Coin       `json:"coin" yaml:"coin"`
	TokensBase       sdk.Int        `json:"tokens_base" yaml:"tokens_base"`
}

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 validator.

func MustUnmarshalDelegation

func MustUnmarshalDelegation(cdc *codec.Codec, value []byte) Delegation

return the delegation

func NewDelegation

func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, coin sdk.Coin) Delegation

NewDelegation creates a new delegation object

func UnmarshalDelegation

func UnmarshalDelegation(cdc *codec.Codec, value []byte) (delegation Delegation, err error)

return the delegation

func (Delegation) Equal

func (d Delegation) Equal(d2 Delegation) bool

nolint

func (Delegation) GetCoin

func (d Delegation) GetCoin() sdk.Coin

func (Delegation) GetDelegatorAddr

func (d Delegation) GetDelegatorAddr() sdk.AccAddress

nolint - for Delegation

func (Delegation) GetTokensBase

func (d Delegation) GetTokensBase() sdk.Int

func (Delegation) GetValidatorAddr

func (d Delegation) GetValidatorAddr() sdk.ValAddress

func (Delegation) SetTokensBase

func (d Delegation) SetTokensBase(tokensBase sdk.Int) exported.DelegationI

func (Delegation) String

func (d Delegation) String() string

String returns a human readable string representation of a Delegation.

type DelegationNFT

type DelegationNFT struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"`
	ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
	Denom            string         `json:"denom" yaml:"denom"`
	TokenID          string         `json:"token_id" yaml:"token_id"`
	SubTokenIDs      []int64        `json:"sub_token_ids" yaml:"sub_token_ids"`
	Coin             sdk.Coin       `json:"coin" yaml:"coin"`
}

func MustUnmarshalDelegationNFT

func MustUnmarshalDelegationNFT(cdc *codec.Codec, value []byte) DelegationNFT

return the delegation

func NewDelegationNFT

func NewDelegationNFT(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, tokenID, denom string, subTokenIDs []int64, coin sdk.Coin) DelegationNFT

func UnmarshalDelegationNFT

func UnmarshalDelegationNFT(cdc *codec.Codec, value []byte) (delegation DelegationNFT, err error)

return the delegation

func (DelegationNFT) GetCoin

func (d DelegationNFT) GetCoin() sdk.Coin

func (DelegationNFT) GetDelegatorAddr

func (d DelegationNFT) GetDelegatorAddr() sdk.AccAddress

func (DelegationNFT) GetTokensBase

func (d DelegationNFT) GetTokensBase() sdk.Int

func (DelegationNFT) GetValidatorAddr

func (d DelegationNFT) GetValidatorAddr() sdk.ValAddress

func (DelegationNFT) SetTokensBase

func (d DelegationNFT) SetTokensBase(_ sdk.Int) exported.DelegationI

type DelegationResponse

type DelegationResponse struct {
	Delegations    `json:"delegations"`
	DelegationsNFT `json:"delegations_nft"`
}

DelegationResponse is equivalent to Delegation except that it contains a balance in addition to shares which is more suitable for client responses.

func NewDelegationResp

func NewDelegationResp(delegations Delegations, delegationsNFT DelegationsNFT) DelegationResponse

func (DelegationResponse) MarshalJSON

func (d DelegationResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. This is so we can achieve a flattened structure while embedding other types.

func (*DelegationResponse) UnmarshalJSON

func (d *DelegationResponse) UnmarshalJSON(bz []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. This is so we can achieve a flattened structure while embedding other types.

type DelegationResponses

type DelegationResponses []DelegationResponse

DelegationResponses is a collection of DelegationResp

func (DelegationResponses) String

func (d DelegationResponses) String() (out string)

String implements the Stringer interface for DelegationResponses.

type Delegations

type Delegations []Delegation

Delegations is a collection of delegations

func GetBaseDelegations

func GetBaseDelegations(delegations []exported.DelegationI) Delegations

func (Delegations) String

func (d Delegations) String() (out string)

type DelegationsNFT

type DelegationsNFT []DelegationNFT

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
	SecurityContact string `json:"security_contact" yaml:"security_contact"` // optional security contact info
	Details         string `json:"details" yaml:"details"`                   // optional details
}

Description - description fields for a validator

func NewDescription

func NewDescription(moniker, identity, website, securityContact, 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) 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           Validators            `json:"validators" yaml:"validators"`
	Delegations          Delegations           `json:"delegations" yaml:"delegations"`
	DelegationsNFT       DelegationsNFT        `json:"delegations_nft" yaml:"delegations_nft"`
	UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations" yaml:"unbonding_delegations"`
	Exported             bool                  `json:"exported" yaml:"exported"`
}

GenesisState - all staking state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

get raw genesis raw message for testing

func NewGenesisState

func NewGenesisState(params Params, validators []Validator, delegations Delegations, delegationsNFT DelegationsNFT) GenesisState

type HistoricalInfo

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

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

MustUnmarshalHistoricalInfo wll unmarshal historical info and panic on error

func NewHistoricalInfo

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

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

UnmarshalHistoricalInfo will unmarshal historical info and return any error

type LastValidatorPower

type LastValidatorPower struct {
	Address sdk.ValAddress
	Power   int64
}

Last validator power, needed for validator set update logic

type MsgDeclareCandidate

type MsgDeclareCandidate struct {
	Commission    sdk.Dec        `json:"commission" yaml:"commission"`
	ValidatorAddr sdk.ValAddress `json:"validator_addr" yaml:"validator_addr"`
	RewardAddr    sdk.AccAddress `json:"reward_addr" yaml:"reward_addr"`
	PubKey        crypto.PubKey  `json:"pub_key" yaml:"pub_key"`
	Stake         sdk.Coin       `json:"stake" yaml:"stake"`
	Description   Description    `json:"description"`
}

func NewMsgDeclareCandidate

func NewMsgDeclareCandidate(validatorAddr sdk.ValAddress, pubKey crypto.PubKey, commission sdk.Dec, stake sdk.Coin, description Description, rewardAddress sdk.AccAddress) MsgDeclareCandidate

func (MsgDeclareCandidate) GetSignBytes

func (msg MsgDeclareCandidate) GetSignBytes() []byte

func (MsgDeclareCandidate) GetSigners

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

func (MsgDeclareCandidate) Route

func (msg MsgDeclareCandidate) Route() string

func (MsgDeclareCandidate) Type

func (msg MsgDeclareCandidate) Type() string

func (MsgDeclareCandidate) ValidateBasic

func (msg MsgDeclareCandidate) ValidateBasic() error

quick validity check

type MsgDelegate

type MsgDelegate struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address"`
	ValidatorAddress sdk.ValAddress `json:"validator_address"`
	Coin             sdk.Coin       `json:"coin"`
}

func NewMsgDelegate

func NewMsgDelegate(validatorAddr sdk.ValAddress, delegatorAddr sdk.AccAddress, coin sdk.Coin) MsgDelegate

func (MsgDelegate) GetSignBytes

func (msg MsgDelegate) GetSignBytes() []byte

func (MsgDelegate) GetSigners

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

func (MsgDelegate) Route

func (msg MsgDelegate) Route() string

func (MsgDelegate) Type

func (msg MsgDelegate) Type() string

func (MsgDelegate) ValidateBasic

func (msg MsgDelegate) ValidateBasic() error

type MsgDelegateNFT

type MsgDelegateNFT struct {
	DelegatorAddress sdk.AccAddress `json:"delegator_address"`
	ValidatorAddress sdk.ValAddress `json:"validator_address"`
	TokenID          string         `json:"id"`
	Denom            string         `json:"denom"`
	SubTokenIDs      []int64        `json:"sub_token_ids"`
}

func NewMsgDelegateNFT

func NewMsgDelegateNFT(validatorAddr sdk.ValAddress, delegatorAddr sdk.AccAddress, tokenID, denom string, subTokenIDs []int64) MsgDelegateNFT

func (MsgDelegateNFT) GetSignBytes

func (msg MsgDelegateNFT) GetSignBytes() []byte

func (MsgDelegateNFT) GetSigners

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

func (MsgDelegateNFT) Route

func (msg MsgDelegateNFT) Route() string

func (MsgDelegateNFT) Type

func (msg MsgDelegateNFT) Type() string

func (MsgDelegateNFT) ValidateBasic

func (msg MsgDelegateNFT) ValidateBasic() error

type MsgEditCandidate

type MsgEditCandidate struct {
	ValidatorAddress sdk.ValAddress `json:"validator_address"`
	RewardAddress    sdk.AccAddress `json:"reward_address"`
	Description      Description    `json:"description"`
}

func NewMsgEditCandidate

func NewMsgEditCandidate(validatorAddress sdk.ValAddress, rewardAddress sdk.AccAddress, description Description) MsgEditCandidate

func (MsgEditCandidate) GetSignBytes

func (msg MsgEditCandidate) GetSignBytes() []byte

func (MsgEditCandidate) GetSigners

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

func (MsgEditCandidate) Route

func (msg MsgEditCandidate) Route() string

func (MsgEditCandidate) Type

func (msg MsgEditCandidate) Type() string

func (MsgEditCandidate) ValidateBasic

func (msg MsgEditCandidate) ValidateBasic() error

type MsgSetOffline

type MsgSetOffline struct {
	ValidatorAddress sdk.ValAddress `json:"validator_address"`
}

func NewMsgSetOffline

func NewMsgSetOffline(validatorAddr sdk.ValAddress) MsgSetOffline

func (MsgSetOffline) GetSignBytes

func (msg MsgSetOffline) GetSignBytes() []byte

func (MsgSetOffline) GetSigners

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

func (MsgSetOffline) Route

func (msg MsgSetOffline) Route() string

func (MsgSetOffline) Type

func (msg MsgSetOffline) Type() string

func (MsgSetOffline) ValidateBasic

func (msg MsgSetOffline) ValidateBasic() error

type MsgSetOnline

type MsgSetOnline struct {
	ValidatorAddress sdk.ValAddress `json:"validator_address"`
}

func NewMsgSetOnline

func NewMsgSetOnline(validatorAddr sdk.ValAddress) MsgSetOnline

func (MsgSetOnline) GetSignBytes

func (msg MsgSetOnline) GetSignBytes() []byte

func (MsgSetOnline) GetSigners

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

func (MsgSetOnline) Route

func (msg MsgSetOnline) Route() string

func (MsgSetOnline) Type

func (msg MsgSetOnline) Type() string

func (MsgSetOnline) ValidateBasic

func (msg MsgSetOnline) ValidateBasic() error

type MsgUnbond

type MsgUnbond struct {
	ValidatorAddress sdk.ValAddress `json:"validator_address"`
	DelegatorAddress sdk.AccAddress `json:"delegator_address"`
	Coin             sdk.Coin       `json:"coin"`
}

func NewMsgUnbond

func NewMsgUnbond(validatorAddr sdk.ValAddress, delegatorAddr sdk.AccAddress, coin sdk.Coin) MsgUnbond

func (MsgUnbond) GetSignBytes

func (msg MsgUnbond) GetSignBytes() []byte

func (MsgUnbond) GetSigners

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

func (MsgUnbond) Route

func (msg MsgUnbond) Route() string

func (MsgUnbond) Type

func (msg MsgUnbond) Type() string

func (MsgUnbond) ValidateBasic

func (msg MsgUnbond) ValidateBasic() error

type MsgUnbondNFT

type MsgUnbondNFT struct {
	ValidatorAddress sdk.ValAddress `json:"validator_address"`
	DelegatorAddress sdk.AccAddress `json:"delegator_address"`
	TokenID          string         `json:"id"`
	Denom            string         `json:"denom"`
	SubTokenIDs      []int64        `json:"sub_token_ids"`
}

func NewMsgUnbondNFT

func NewMsgUnbondNFT(validatorAddr sdk.ValAddress, delegatorAddr sdk.AccAddress, tokenID, denom string, subTokenIDs []int64) MsgUnbondNFT

func (MsgUnbondNFT) GetSignBytes

func (msg MsgUnbondNFT) GetSignBytes() []byte

func (MsgUnbondNFT) GetSigners

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

func (MsgUnbondNFT) Route

func (msg MsgUnbondNFT) Route() string

func (MsgUnbondNFT) Type

func (msg MsgUnbondNFT) Type() string

func (MsgUnbondNFT) ValidateBasic

func (msg MsgUnbondNFT) ValidateBasic() error

type NFTUnbondingDelegation

type NFTUnbondingDelegation struct {
	DelegatorAddress sdk.AccAddress                `json:"delegator_address" yaml:"delegator_address"` // delegator
	ValidatorAddress sdk.ValAddress                `json:"validator_address" yaml:"validator_address"` // validator unbonding from operator addr
	Entries          []UnbondingDelegationNFTEntry `json:"entries" yaml:"entries"`                     // unbonding delegation entries
}

func MustUnmarshalNFTUBD

func MustUnmarshalNFTUBD(cdc *codec.Codec, value []byte) NFTUnbondingDelegation

func UnmarshalNFTUBD

func UnmarshalNFTUBD(cdc *codec.Codec, value []byte) (ubd NFTUnbondingDelegation, err error)

type NFTUnbondingDelegations

type NFTUnbondingDelegations []NFTUnbondingDelegation

type ParamSubspace

type ParamSubspace interface {
	WithKeyTable(table params.KeyTable) params.Subspace
	Get(ctx sdk.Context, key []byte, ptr interface{})
	GetParamSet(ctx sdk.Context, ps params.ParamSet)
	SetParamSet(ctx sdk.Context, ps params.ParamSet)
}

ParamSubspace defines the expected Subspace interfacace

type Params

type Params struct {
	UnbondingTime time.Duration `json:"unbonding_time" yaml:"unbonding_time"` // time duration of unbonding
	MaxValidators uint16        `json:"max_validators" yaml:"max_validators"` // maximum number of validators (max uint16 = 65535)
	MaxEntries    uint16        `json:"max_entries" yaml:"max_entries"`       // max entries for either unbonding delegation or redelegation (per pair/trio)
	// note: we need to be a bit careful about potential overflow here, since this is user-determined
	BondDenom         string `json:"bond_denom" yaml:"bond_denom"`                 // bondable coin denomination
	HistoricalEntries uint16 `json:"historical_entries" yaml:"historical_entries"` // number of historical entries to persist
	MaxDelegations    uint16 `json:"max_delegations" yaml:"max_delegations"`
}

Params defines the high level settings for staking

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

unmarshal the current staking params value from store key or panic

func NewParams

func NewParams(unbondingTime time.Duration, maxValidators, maxEntries, historicalEntries uint16,
	bondDenom string, maxDelegations uint16) Params

NewParams creates a new Params instance

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

unmarshal the current staking params value from store key

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

Implements params.ParamSet

func (Params) String

func (p Params) String() string

String returns a human readable string representation of the parameters.

func (Params) Validate

func (p Params) Validate() error

validate a set of params

type Pool

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

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

func NewPool

func NewPool(notBonded, bonded sdk.Coins) 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 a pool.

type QueryBondsParams

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

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

func NewQueryBondsParams

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

type QueryDelegatorParams

type QueryDelegatorParams struct {
	DelegatorAddr sdk.AccAddress
}

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

func NewQueryDelegatorParams

func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams

type QueryHistoricalInfoParams

type QueryHistoricalInfoParams struct {
	Height int64
}

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

func NewQueryHistoricalInfoParams

func NewQueryHistoricalInfoParams(height int64) QueryHistoricalInfoParams

NewQueryHistoricalInfoParams creates a new QueryHistoricalInfoParams instance

type QueryValidatorParams

type QueryValidatorParams struct {
	ValidatorAddr sdk.ValAddress
}

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

func NewQueryValidatorParams

func NewQueryValidatorParams(validatorAddr sdk.ValAddress) QueryValidatorParams

type QueryValidatorsParams

type QueryValidatorsParams struct {
	Page, Limit int
	Status      string
}

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

func NewQueryValidatorsParams

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

type Stake

type Stake struct {
	Delegator sdk.AccAddress `json:"delegator"`
	Coin      sdk.Coin       `json:"coin"`
}

type SupplyKeeper

type SupplyKeeper interface {
	GetSupply(ctx sdk.Context) supplyexported.SupplyI

	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.Coins) error
	DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error

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

supplyKeeper defines the expected supply Keeper (noalias)

type UnbondingDelegation

type UnbondingDelegation struct {
	DelegatorAddress sdk.AccAddress                       `json:"delegator_address" yaml:"delegator_address"` // delegator
	ValidatorAddress sdk.ValAddress                       `json:"validator_address" yaml:"validator_address"` // validator unbonding from operator addr
	Entries          []exported.UnbondingDelegationEntryI `json:"entries" yaml:"entries"`                     // unbonding delegation entries
}

UnbondingDelegation stores all of a single delegator's unbonding bonds for a single validator in an time-ordered list

func MustUnmarshalUBD

func MustUnmarshalUBD(cdc *codec.Codec, value []byte) UnbondingDelegation

unmarshal a unbonding delegation from a store value

func NewUnbondingDelegation

func NewUnbondingDelegation(delegatorAddr sdk.AccAddress,
	validatorAddr sdk.ValAddress,
	entry exported.UnbondingDelegationEntryI) UnbondingDelegation

NewUnbondingDelegation - create a new unbonding delegation object

func UnmarshalUBD

func UnmarshalUBD(cdc *codec.Codec, value []byte) (ubd UnbondingDelegation, err error)

unmarshal a unbonding delegation from a store value

func (*UnbondingDelegation) AddEntry

func (d *UnbondingDelegation) AddEntry(creationHeight int64,
	minTime time.Time, balance sdk.Coin)

AddEntry - append entry to the unbonding delegation

func (*UnbondingDelegation) AddNFTEntry

func (d *UnbondingDelegation) AddNFTEntry(creationHeight int64, minTime time.Time, tokenID, denom string, subTokenIDs []int64, balance sdk.Coin)

func (UnbondingDelegation) Equal

nolint inefficient but only used in testing

func (UnbondingDelegation) GetEvents

func (d UnbondingDelegation) GetEvents(ctxTime time.Time) sdk.Events

func (*UnbondingDelegation) RemoveEntry

func (d *UnbondingDelegation) RemoveEntry(i int64)

RemoveEntry - remove entry at index i to the unbonding delegation

func (UnbondingDelegation) String

func (d UnbondingDelegation) String() string

String returns a human readable string representation of an UnbondingDelegation.

type UnbondingDelegationEntry

type UnbondingDelegationEntry struct {
	CreationHeight int64     `json:"creation_height" yaml:"creation_height"` // height which the unbonding took place
	CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the unbonding delegation will complete
	InitialBalance sdk.Coin  `json:"initial_balance" yaml:"initial_balance"` // atoms initially scheduled to receive at completion
	Balance        sdk.Coin  `json:"balance" yaml:"balance"`                 // atoms to receive at completion
}

UnbondingDelegationEntry - entry to an UnbondingDelegation

func NewUnbondingDelegationEntry

func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time,
	balance sdk.Coin) UnbondingDelegationEntry

NewUnbondingDelegation - create a new unbonding delegation object

func (UnbondingDelegationEntry) GetBalance

func (e UnbondingDelegationEntry) GetBalance() sdk.Coin

func (UnbondingDelegationEntry) GetCompletionTime

func (e UnbondingDelegationEntry) GetCompletionTime() time.Time

func (UnbondingDelegationEntry) GetCreationHeight

func (e UnbondingDelegationEntry) GetCreationHeight() int64

func (UnbondingDelegationEntry) GetEvent

func (e UnbondingDelegationEntry) GetEvent() sdk.Event

func (UnbondingDelegationEntry) GetInitialBalance

func (e UnbondingDelegationEntry) GetInitialBalance() sdk.Coin

func (UnbondingDelegationEntry) IsMature

func (e UnbondingDelegationEntry) IsMature(currentTime time.Time) bool

IsMature - is the current entry mature

func (UnbondingDelegationEntry) String

func (e UnbondingDelegationEntry) String() string

type UnbondingDelegationNFTEntry

type UnbondingDelegationNFTEntry struct {
	CreationHeight int64     `json:"creation_height" yaml:"creation_height"` // height which the unbonding took place
	CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the unbonding delegation will complete
	Denom          string    `json:"denom" yaml:"denom"`
	TokenID        string    `json:"token_id" yaml:"token_id"`
	SubTokenIDs    []int64   `json:"sub_token_ids" yaml:"sub_token_ids"`
	Balance        sdk.Coin  `json:"balance"`
}

func NewUnbondingDelegationNFTEntry

func NewUnbondingDelegationNFTEntry(creationHeight int64, completionTime time.Time, denom string, tokenID string, subTokenIDs []int64, balance sdk.Coin) UnbondingDelegationNFTEntry

func (UnbondingDelegationNFTEntry) GetBalance

func (u UnbondingDelegationNFTEntry) GetBalance() sdk.Coin

func (UnbondingDelegationNFTEntry) GetCompletionTime

func (u UnbondingDelegationNFTEntry) GetCompletionTime() time.Time

func (UnbondingDelegationNFTEntry) GetCreationHeight

func (u UnbondingDelegationNFTEntry) GetCreationHeight() int64

func (UnbondingDelegationNFTEntry) GetEvent

func (u UnbondingDelegationNFTEntry) GetEvent() sdk.Event

func (UnbondingDelegationNFTEntry) GetInitialBalance

func (u UnbondingDelegationNFTEntry) GetInitialBalance() sdk.Coin

func (UnbondingDelegationNFTEntry) IsMature

func (u UnbondingDelegationNFTEntry) IsMature(currentTime time.Time) bool

type UnbondingDelegationResponse

type UnbondingDelegationResponse struct {
	BaseUnbondingDelegations `json:"base_unbonding_delegations"`
	NFTUnbondingDelegations  `json:"nft_unbonding_delegation"`
}

type UnbondingDelegations

type UnbondingDelegations []UnbondingDelegation

UnbondingDelegations is a collection of UnbondingDelegation

func (UnbondingDelegations) String

func (ubds UnbondingDelegations) String() (out string)

type Validator

type Validator struct {
	ValAddress              sdk.ValAddress `json:"val_address" yaml:"val_address"`
	PubKey                  crypto.PubKey  `json:"pub_key" yaml:"pub_key"`
	Tokens                  sdk.Int        `json:"stake_coins" yaml:"stake_coins"`
	Status                  BondStatus     `json:"status" yaml:"status"`
	Commission              sdk.Dec        `json:"commission" yaml:"commission"`
	Jailed                  bool           `json:"jailed" yaml:"jailed"`
	UnbondingCompletionTime time.Time      `json:"unbonding_completion_time" yaml:"unbonding_completion_time"`
	UnbondingHeight         int64          `json:"unbonding_height" yaml:"unbonding_height"`
	Description             Description    `json:"description" yaml:"description"`
	AccumRewards            sdk.Int        `json:"accum_rewards" yaml:"accum_rewards"`
	RewardAddress           sdk.AccAddress `json:"reward_address" yaml:"reward_address"`
	Online                  bool           `json:"online" yaml:"online"`
}

func MustUnmarshalValidator

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

unmarshal a validator from a store value

func NewValidator

func NewValidator(valAddress sdk.ValAddress, pubKey crypto.PubKey, commission sdk.Dec, rewardAddress sdk.AccAddress, description Description) Validator

func UnmarshalValidator

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

unmarshal 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) 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) AddAccumReward

func (v Validator) AddAccumReward(reward sdk.Int) Validator

func (Validator) BondedTokens

func (v Validator) BondedTokens() sdk.Int

get the bonded tokens which the validator holds

func (Validator) ConsensusPower

func (v Validator) ConsensusPower() int64

get the consensus-engine power a reduction of 10^6 from validator tokens is applied

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

for exported

func (Validator) GetMoniker

func (v Validator) GetMoniker() string

func (Validator) GetOperator

func (v Validator) GetOperator() sdk.ValAddress

func (Validator) GetStatus

func (v Validator) GetStatus() BondStatus

func (Validator) GetTokens

func (v Validator) GetTokens() sdk.Int

func (Validator) InvalidExRate

func (v Validator) InvalidExRate() bool

In some situations, the exchange rate becomes invalid, e.g. if Validator loses all tokens due to slashing. In this case, make all future delegations invalid.

func (Validator) IsBonded

func (v Validator) IsBonded() bool

IsBonded checks if the validator status equals Bonded

func (Validator) IsJailed

func (v Validator) IsJailed() bool

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)

custom marshal yaml function due to consensus pubkey

func (Validator) PotentialConsensusPower

func (v Validator) PotentialConsensusPower() int64

potential consensus-engine power

func (Validator) RemoveTokens

func (v Validator) RemoveTokens(tokens sdk.Int) Validator

RemoveTokens removes tokens from a validator

func (Validator) SharesFromTokens

func (v Validator) SharesFromTokens(tokens sdk.Int, valTokens sdk.Int, delTokens sdk.Dec) (sdk.Dec, error)

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

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 BondStatus) Validator

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

type ValidatorHooks

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

	AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)         // Must be called when a validator is bonded
	AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) // Must be called when a validator begins unbonding

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

StakingHooks event hooks for staking validator object (noalias)

type ValidatorSigningInfo

type ValidatorSigningInfo struct {
	Address             sdk.ConsAddress `json:"address" yaml:"address"`                             // validator consensus address
	StartHeight         int64           `json:"start_height" yaml:"start_height"`                   // height at which validator was first a candidate OR was unjailed
	IndexOffset         int64           `json:"index_offset" yaml:"index_offset"`                   // index offset into signed block bit array
	JailedUntil         time.Time       `json:"jailed_until" yaml:"jailed_until"`                   // timestamp validator cannot be unjailed until
	Tombstoned          bool            `json:"tombstoned" yaml:"tombstoned"`                       // whether or not a validator has been tombstoned (killed out of validator set)
	MissedBlocksCounter int64           `json:"missed_blocks_counter" yaml:"missed_blocks_counter"` // missed blocks counter (to avoid scanning the array every time)
}

Signing info for a validator

func NewValidatorSigningInfo

func NewValidatorSigningInfo(
	condAddr sdk.ConsAddress, startHeight, indexOffset int64,
	jailedUntil time.Time, tombstoned bool, missedBlocksCounter int64,
) ValidatorSigningInfo

Construct a new `ValidatorSigningInfo` struct

func (ValidatorSigningInfo) String

func (i ValidatorSigningInfo) String() string

Return human readable signing info

type Validators

type Validators []Validator

func (Validators) Len

func (v Validators) Len() int

Implements sort interface

func (Validators) Less

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

Implements sort interface

func (Validators) Sort

func (v Validators) Sort()

Sort Validators sorts validator array in ascending operator address order

func (Validators) String

func (v Validators) String() string

func (Validators) Swap

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

Implements sort interface

Jump to

Keyboard shortcuts

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