v0.2.1 Latest Latest

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 54 Imported by: 1



Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.



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

	// StoreKey defines the primary module store key
	StoreKey = ModuleName

	// MemStoreKey defines the in-memory store key
	MemStoreKey = "mem_" + ModuleName

	// RouterKey defines module's messages routing
	RouterKey = ModuleName

	// QuerierRoute defines the module's query routing key
	QuerierRoute = ModuleName
View Source
const (
	TypeMsgCreateValidator       = "create_validator"
	TypeMsgEditValidator         = "edit_validator"
	TypeMsgSetOnline             = "set_online"
	TypeMsgSetOffline            = "set_offline"
	TypeMsgDelegate              = "delegate"
	TypeMsgDelegateNFT           = "delegate_nft"
	TypeMsgRedelegate            = "redelegate"
	TypeMsgRedelegateNFT         = "redelegate_nft"
	TypeMsgUndelegate            = "undelegate"
	TypeMsgUndelegateNFT         = "undelegate_nft"
	TypeMsgCancelRedelegation    = "cancel_redelegation"
	TypeMsgCancelRedelegationNFT = "cancel_redelegation_nft"
	TypeMsgCancelUndelegation    = "cancel_undelegation"
	TypeMsgCancelUndelegationNFT = "cancel_undelegation_nft"
View Source
const (
	// Default maximum number of bonded validators.
	DefaultMaxValidators uint32 = 256

	// Default maximum number of bonded delegations per validator.
	DefaultMaxDelegations uint32 = 1000

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

	// DefaultHistorical entries is 10000. Apps that don't use IBC can ignore this value by not
	// adding the validator module to the application module manager's SetOrderBeginBlockers.
	DefaultHistoricalEntries uint32 = 10000

	// DefaultRedelegationTime reflects a week in nanoseconds as the default redelegating time.
	DefaultRedelegationTime time.Duration = time.Hour * 24 * 7

	// DefaultUndelegationTime reflects a month in nanoseconds as the default unbonding time.
	DefaultUndelegationTime time.Duration = time.Hour * 24 * 7 * 4

	// DefaultSignedBlocksWindow 24 * ~5 sec = ~120 sec window
	DefaultSignedBlocksWindow int64 = 24

	DefaultBaseDenom = cmdcfg.BaseDenom

Validator params default values.

View Source
const (
	BondedPoolName    = "bonded_tokens_pool"
	NotBondedPoolName = "not_bonded_tokens_pool"
View Source
const (
	QueryValidators             = "validators"
	QueryValidator              = "validator"
	QueryDelegatorDelegations   = "delegatorDelegations"
	QueryDelegatorUndelegations = "delegatorUndelegations"
	QueryRedelegations          = "redelegations"
	QueryValidatorDelegations   = "validatorDelegations"
	QueryValidatorRedelegations = "validatorRedelegations"
	QueryValidatorUndelegations = "validatorUndelegations"
	QueryDelegation             = "delegation"
	QueryUndelegation           = "undelegation"
	QueryDelegatorValidators    = "delegatorValidators"
	QueryDelegatorValidator     = "delegatorValidator"
	QueryPool                   = "pool"
	QueryParameters             = "parameters"
	QueryHistoricalInfo         = "historicalInfo"

query endpoints supported by the staking Querier

View Source
const (
	MaxMonikerLength         = 70
	MaxIdentityLength        = 3000
	MaxWebsiteLength         = 140
	MaxSecurityContactLength = 140
	MaxDetailsLength         = 280
View Source
const DoNotModifyDesc = "[do-not-modify]"

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


View Source
var (
	ErrEmptyValidatorAddr              = sdkerrors.Register(ModuleName, 2, "empty validator address")
	ErrNoValidatorFound                = sdkerrors.Register(ModuleName, 3, "validator does not exist")
	ErrValidatorOwnerExists            = sdkerrors.Register(ModuleName, 4, "validator already exist for this operator address; must use new validator operator address")
	ErrValidatorPubKeyExists           = sdkerrors.Register(ModuleName, 5, "validator already exist for this pubkey; must use new validator pubkey")
	ErrValidatorPubKeyTypeNotSupported = sdkerrors.Register(ModuleName, 6, "validator pubkey type is not supported")
	ErrValidatorJailed                 = sdkerrors.Register(ModuleName, 7, "validator for this address is currently jailed")
	ErrBadRemoveValidator              = sdkerrors.Register(ModuleName, 8, "failed to remove validator")
	ErrCommissionNegative              = sdkerrors.Register(ModuleName, 9, "commission must be positive")
	ErrCommissionHuge                  = sdkerrors.Register(ModuleName, 10, "commission cannot be more than 100%")
	ErrCommissionGTMaxRate             = sdkerrors.Register(ModuleName, 11, "commission cannot be more than the max rate")
	ErrCommissionUpdateTime            = sdkerrors.Register(ModuleName, 12, "commission cannot be changed more than once in 24h")
	ErrCommissionChangeRateNegative    = sdkerrors.Register(ModuleName, 13, "commission change rate must be positive")
	ErrCommissionChangeRateGTMaxRate   = sdkerrors.Register(ModuleName, 14, "commission change rate cannot be more than the max rate")
	ErrCommissionGTMaxChangeRate       = sdkerrors.Register(ModuleName, 15, "commission cannot be changed more than max change rate")
	ErrSelfDelegationBelowMinimum      = sdkerrors.Register(ModuleName, 16, "validator's self delegation must be greater than their minimum self delegation")
	ErrMinSelfDelegationDecreased      = sdkerrors.Register(ModuleName, 17, "minimum self delegation cannot be decrease")
	ErrEmptyDelegatorAddr              = sdkerrors.Register(ModuleName, 18, "empty delegator address")
	ErrNoDelegation                    = sdkerrors.Register(ModuleName, 19, "no delegation for (address, validator) tuple")
	ErrBadDelegatorAddr                = sdkerrors.Register(ModuleName, 20, "delegator does not exist with address")
	ErrNoDelegatorForAddress           = sdkerrors.Register(ModuleName, 21, "delegator does not contain delegation")
	ErrInsufficientShares              = sdkerrors.Register(ModuleName, 22, "insufficient delegation shares")
	ErrDelegationValidatorEmpty        = sdkerrors.Register(ModuleName, 23, "cannot delegate to an empty validator")
	ErrNotEnoughDelegationShares       = sdkerrors.Register(ModuleName, 24, "not enough delegation shares")
	ErrNotMature                       = sdkerrors.Register(ModuleName, 25, "entry not mature")
	ErrNoUndelegation                  = sdkerrors.Register(ModuleName, 26, "no unbonding delegation found")
	ErrMaxUndelegationEntries          = sdkerrors.Register(ModuleName, 27, "too many unbonding delegation entries for (delegator, validator) tuple")
	ErrNoRedelegation                  = sdkerrors.Register(ModuleName, 28, "no redelegation found")
	ErrSelfRedelegation                = sdkerrors.Register(ModuleName, 29, "cannot redelegate to the same validator")
	ErrTinyRedelegationAmount          = sdkerrors.Register(ModuleName, 30, "too few tokens to redelegate (truncates to zero tokens)")
	ErrBadRedelegationDst              = sdkerrors.Register(ModuleName, 31, "redelegation destination validator not found")
	ErrTransitiveRedelegation          = sdkerrors.Register(ModuleName, 32, "redelegation to this validator already in progress; first redelegation to this validator must complete before next redelegation")
	ErrMaxRedelegationEntries          = sdkerrors.Register(ModuleName, 33, "too many redelegation entries for (delegator, src-validator, dst-validator) tuple")
	ErrDelegatorShareExRateInvalid     = sdkerrors.Register(ModuleName, 34, "cannot delegate to validators with invalid (zero) ex-rate")
	ErrBothShareMsgsGiven              = sdkerrors.Register(ModuleName, 35, "both shares amount and shares percent provided")
	ErrNeitherShareMsgsGiven           = sdkerrors.Register(ModuleName, 36, "neither shares amount nor shares percent provided")
	ErrInvalidHistoricalInfo           = sdkerrors.Register(ModuleName, 37, "invalid historical info")
	ErrNoHistoricalInfo                = sdkerrors.Register(ModuleName, 38, "no historical info found")
	ErrEmptyValidatorPubKey            = sdkerrors.Register(ModuleName, 39, "empty validator public key")
	ErrCommissionLTMinRate             = sdkerrors.Register(ModuleName, 40, "commission cannot be less than min rate")

x/validator module sentinel errors

TODO: Many of these errors are redundant. They should be removed and replaced by sdkerrors.ErrInvalidRequest.

REF: https://github.com/cosmos/cosmos-sdk/issues/5450

View Source
var (
	ErrInvalidLengthEvents        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvents          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
View Source
var (
	// DefaultMinSignedPerWindow 0.5 of 24 blocks = ~ 60 sec
	DefaultMinSignedPerWindow = sdk.NewDec(1).Quo(sdk.NewDec(2))
	// DefaultSlashFractionDowntime 1% of stake
	DefaultSlashFractionDowntime = sdk.NewDec(1).Quo(sdk.NewDec(100))
	// DefaultSlashFractionDoubleSign 5% of stake
	DefaultSlashFractionDoubleSign = sdk.NewDec(1).Quo(sdk.NewDec(20))
View Source
var (
	KeyMaxValidators     = []byte("MaxValidators")
	KeyMaxDelegations    = []byte("MaxDelegations")
	KeyMaxEntries        = []byte("MaxEntries")
	KeyHistoricalEntries = []byte("HistoricalEntries")
	KeyRedelegationTime  = []byte("RedelegationTime")
	KeyUndelegationTime  = []byte("UndelegationTime")
	KeyBaseDenom         = []byte("BaseDenom")

	KeySignedBlocksWindow      = []byte("SignedBlocksWindow")
	KeyMinSignedPerWindow      = []byte("MinSignedPerWindow")
	KeySlashFractionDowntime   = []byte("SlashFractionDowntime")
	KeySlashFractionDoubleSign = []byte("SlashFractionDoubleSign")
View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
View Source
var (
	BondStatusUnspecified = BondStatus_name[int32(BondStatus_Unspecified)]
	BondStatusUnbonded    = BondStatus_name[int32(BondStatus_Unbonded)]
	BondStatusUnbonding   = BondStatus_name[int32(BondStatus_Unbonding)]
	BondStatusBonded      = BondStatus_name[int32(BondStatus_Bonded)]
View Source
var (
	ErrInvalidLengthValidator        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowValidator          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupValidator = fmt.Errorf("proto: unexpected end of group")
View Source
var BondStatus_name = map[int32]string{
View Source
var BondStatus_value = map[string]int32{

ModuleCdc references the global validator module codec. Note, the codec should ONLY be used in certain instances of tests and for JSON encoding.

The actual codec used for serialization should be provided to modules/validator and defined at the application level.

View Source
var StakeType_name = map[int32]string{
View Source
var StakeType_value = map[string]int32{
	"STAKE_TYPE_COIN":        1,
	"STAKE_TYPE_NFT":         2,


func AddressFromLastValidatorPowerKey added in v0.0.8

func AddressFromLastValidatorPowerKey(key []byte) []byte

AddressFromLastValidatorPowerKey creates the validator operator address from LastValidatorPowerKey.

func GetAllCustomCoinsStaked added in v0.0.8

func GetAllCustomCoinsStaked() []byte

func GetAllDelegationsCount added in v0.1.0

func GetAllDelegationsCount() []byte

GetAllDelegationsCount returns the prefix key for all counts of delegations.

func GetAllDelegationsKey added in v0.0.8

func GetAllDelegationsKey() []byte

GetAllDelegationsKey returns the prefix key for all delegations.

func GetAllREDsKey added in v0.0.8

func GetAllREDsKey() []byte

GetAllREDsKey returns a key prefix for indexing all redelegations.

func GetAllRedelegationsTimeKey added in v0.0.8

func GetAllRedelegationsTimeKey() []byte

GetAllRedelegationsTimeKey creates the prefix for undelegations.

func GetAllUBDsKey added in v0.0.8

func GetAllUBDsKey() []byte

GetAllUBDsKey returns a key prefix for indexing all undelegations.

func GetAllUndelegationsTimeKey added in v0.0.8

func GetAllUndelegationsTimeKey() []byte

GetAllUndelegationsTimeKey creates the prefix for undelegations.

func GetAllValidatorQueueKey added in v0.0.8

func GetAllValidatorQueueKey() []byte

func GetCustomCoinStaked added in v0.0.8

func GetCustomCoinStaked(denom string) []byte

func GetDelegationKey added in v0.0.8

func GetDelegationKey(delegator sdk.AccAddress, validator sdk.ValAddress, denom string) []byte

GetDelegationKey creates the key for the exact delegation in the specified coin.

func GetDelegationKeyFromValIndexKey added in v0.0.8

func GetDelegationKeyFromValIndexKey(indexKey []byte) []byte

GetDelegationKeyFromValIndexKey rearranges the ValIndexKey to get the DelegationKey

func GetDelegationsKey added in v0.0.8

func GetDelegationsKey(delegator sdk.AccAddress, validator sdk.ValAddress) []byte

GetDelegationsKey creates the prefix key for delegations bond with validator.

func GetDelegatorDelegationsKey added in v0.0.8

func GetDelegatorDelegationsKey(delegator sdk.AccAddress) []byte

GetDelegatorDelegationsKey creates the prefix for delegations from the given delegator.

func GetHistoricalInfoKey added in v0.0.8

func GetHistoricalInfoKey(height int64) []byte

GetHistoricalInfoKey returns a key prefix for indexing HistoricalInfo objects.

func GetHistoricalInfosKey added in v0.0.8

func GetHistoricalInfosKey() []byte

GetHistoricalInfosKey returns a key prefix for all HistoricalInfo objects.

func GetLastTotalPowerKey added in v0.0.8

func GetLastTotalPowerKey() []byte

GetLastTotalPowerKey returns key for the total power record.

func GetLastValidatorPowerKey added in v0.0.8

func GetLastValidatorPowerKey(validator sdk.ValAddress) []byte

GetLastValidatorPowerKey creates the bonded validator index key for the given operator address.

func GetLastValidatorPowersKey added in v0.0.8

func GetLastValidatorPowersKey() []byte

GetLastValidatorPowersKey returns prefix key for bonded validators.

func GetMissedBlockKey added in v0.0.8

func GetMissedBlockKey(addr sdk.ConsAddress, height int64) []byte

GetMissedBlockKey returns key for save validator missed blocks

func GetREDByValDstIndexKey added in v0.0.8

func GetREDByValDstIndexKey(delegator sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress) []byte

GetREDByValDstIndexKey creates the index-key for a redelegation, stored by destination-validator-index.

func GetREDByValSrcIndexKey added in v0.0.8

func GetREDByValSrcIndexKey(delegator sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress) []byte

GetREDByValSrcIndexKey creates the index-key for a redelegation, stored by source-validator-index.

func GetREDKey added in v0.0.8

func GetREDKey(delegator sdk.AccAddress, validatorSrc sdk.ValAddress, validatorDst sdk.ValAddress) []byte

GetREDKey returns a key prefix for indexing a redelegation from a delegator and source validator to a destination validator.

func GetREDKeyFromValDstIndexKey added in v0.0.8

func GetREDKeyFromValDstIndexKey(indexKey []byte) []byte

GetREDKeyFromValDstIndexKey rearranges the ValDstIndexKey to get the REDKey

func GetREDKeyFromValSrcIndexKey added in v0.0.8

func GetREDKeyFromValSrcIndexKey(indexKey []byte) []byte

GetREDKeyFromValSrcIndexKey rearranges the ValSrcIndexKey to get the REDKey

func GetREDsByDelToValDstIndexKey added in v0.0.8

func GetREDsByDelToValDstIndexKey(delegator sdk.AccAddress, validatorDst sdk.ValAddress) []byte

GetREDsByDelToValDstIndexKey returns a key prefix for indexing a redelegation from an address to a source validator.

func GetREDsFromValSrcIndexKey added in v0.0.8

func GetREDsFromValSrcIndexKey(validatorSrc sdk.ValAddress) []byte

GetREDsFromValSrcIndexKey returns a key prefix for indexing a redelegation to a source validator.

func GetREDsKey added in v0.0.8

func GetREDsKey(delegator sdk.AccAddress) []byte

GetREDsKey returns a key prefix for indexing a redelegation from a delegator address.

func GetREDsToValDstIndexKey added in v0.0.8

func GetREDsToValDstIndexKey(validatorDst sdk.ValAddress) []byte

GetREDsToValDstIndexKey returns a key prefix for indexing a redelegation to a destination (target) validator.

func GetRedelegationsTimeKey added in v0.0.8

func GetRedelegationsTimeKey(timestamp time.Time) []byte

GetRedelegationsTimeKey returns a key prefix for indexing redelegations based on a completion time.

func GetRewardForBlock added in v0.0.8

func GetRewardForBlock(blockHeight uint64) sdk.Int

func GetStartHeightKey added in v0.0.8

func GetStartHeightKey(addr sdk.ConsAddress) []byte

GetStartHeightKey returns key for save validator first block stake

func GetUBDByValIndexKey added in v0.0.8

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

GetUBDByValIndexKey creates the index-key for an unbonding delegation, stored by validator-index

func GetUBDKey added in v0.0.8

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

GetUBDKey creates the key for an unbonding delegation by delegator and validator addr

func GetUBDKeyFromValIndexKey added in v0.0.8

func GetUBDKeyFromValIndexKey(indexKey []byte) []byte

GetUBDKeyFromValIndexKey rearranges the ValIndexKey to get the UBDKey

func GetUBDsByValIndexKey added in v0.0.8

func GetUBDsByValIndexKey(valAddr sdk.ValAddress) []byte

GetUBDsByValIndexKey creates the prefix keyspace for the indexes of unbonding delegations for a validator

func GetUBDsKey added in v0.0.8

func GetUBDsKey(delegator sdk.AccAddress) []byte

GetUBDsKey creates the prefix for all unbonding delegations from a delegator

func GetUndelegationsTimeKey added in v0.0.8

func GetUndelegationsTimeKey(timestamp time.Time) []byte

GetUndelegationsTimeKey creates the prefix for undelegations based on a completion time.

func GetValidatorAllDelegations added in v0.0.8

func GetValidatorAllDelegations() []byte

GetValidatorAllDelegations returns the prefix for all validators delegations index

func GetValidatorByConsAddrIndexKey added in v0.0.8

func GetValidatorByConsAddrIndexKey(addr sdk.ConsAddress) []byte

GetValidatorByConsAddrIndexKey creates the key for the validator with the given consensus address.

func GetValidatorDelegationsCount added in v0.1.0

func GetValidatorDelegationsCount(valAddr sdk.ValAddress) []byte

func GetValidatorDelegationsKey added in v0.0.8

func GetValidatorDelegationsKey(val sdk.ValAddress) []byte

GetValidatorDelegationsKey create the key for validator all delegations

func GetValidatorDelegatorDelegationKey added in v0.0.8

func GetValidatorDelegatorDelegationKey(val sdk.ValAddress, del sdk.AccAddress, denom string) []byte

GetValidatorDelegatorDelegationKey create a key for validator-delegator-denom delegation

func GetValidatorDelegatorDelegationsKey added in v0.0.8

func GetValidatorDelegatorDelegationsKey(val sdk.ValAddress, del sdk.AccAddress) []byte

GetValidatorDelegatorDelegationsKey create a key for all delegations between delegator and validator

func GetValidatorKey added in v0.0.8

func GetValidatorKey(validator sdk.ValAddress) []byte

GetValidatorKey creates the key for the validator with the given operator address.

func GetValidatorQueueKey added in v0.0.8

func GetValidatorQueueKey(timestamp time.Time, height int64) []byte

GetValidatorQueueKey returns the prefix key used for getting a set of unbonding validators whose unbonding completion occurs at the given time and height.

func GetValidatorRewards added in v0.0.8

func GetValidatorRewards(addr sdk.ValAddress) []byte

func GetValidatorsByPowerIndexKey added in v0.0.8

func GetValidatorsByPowerIndexKey() []byte

GetValidatorsByPowerIndexKey returns the prefix key for the validators sorted by voting power.

func GetValidatorsKey added in v0.0.8

func GetValidatorsKey() []byte

GetValidatorsKey returns prefix key for all validators.

func GetValidatorsRewards added in v0.0.8

func GetValidatorsRewards() []byte

func MustMarshalDelegation added in v0.0.8

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

MustMarshalDelegation returns the delegation bytes. Panics if fails.

func MustMarshalRED added in v0.0.8

func MustMarshalRED(cdc codec.BinaryCodec, red Redelegation) []byte

MustMarshalRED returns the redelegation bytes. Panics if fails.

func MustMarshalUBD added in v0.0.8

func MustMarshalUBD(cdc codec.BinaryCodec, ubd Undelegation) []byte

MustMarshalUBD returns the undelegation bytes. Panics if fails.

func MustMarshalValidator added in v0.0.8

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

func MustMarshalValidatorRewards added in v0.0.8

func MustMarshalValidatorRewards(cdc codec.BinaryCodec, rewards *ValidatorRS) []byte

func ParamKeyTable added in v0.0.8

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable the param key table for launch module.

func ParseValidatorDelegationsCountKey added in v0.1.0

func ParseValidatorDelegationsCountKey(key []byte) sdk.ValAddress

func ParseValidatorPowerKey added in v0.0.8

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

ParseValidatorPowerKey parses the validators operator address from voting power key.

func ParseValidatorQueueKey added in v0.0.8

func ParseValidatorQueueKey(bz []byte) (time.Time, int64, error)

ParseValidatorQueueKey returns the encoded time and height from a key created from GetValidatorQueueKey.

func RegisterInterfaces added in v0.0.8

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

RegisterInterfaces registers concrete implementations of specific interfaces.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler added in v0.0.8

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient added in v0.0.8

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint added in v0.0.8

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer added in v0.0.8

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer added in v0.0.8

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func SetHasIntersection added in v0.0.8

func SetHasIntersection(set []uint32, otherset []uint32) bool

return true if sets have same elements

func SetHasSubset added in v0.0.8

func SetHasSubset(set []uint32, subset []uint32) bool

return true if set has subset of IDs

func SetSubstract added in v0.0.8

func SetSubstract(set []uint32, subset []uint32) []uint32

returns elements of (set-subset)

func ValidateBasic added in v0.0.8

func ValidateBasic(hi HistoricalInfo) error

ValidateBasic will ensure HistoricalInfo is not nil and sorted.


type AccountKeeper added in v0.0.8

type AccountKeeper interface {
	IterateAccounts(ctx sdk.Context, process func(authtypes.AccountI) (stop bool))
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // only used for simulation

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

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

AccountKeeper defines the expected account keeper (noalias)

type BankKeeper added in v0.0.8

type BankKeeper interface {
	GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin

	GetSupply(ctx sdk.Context, denom string) sdk.Coin

	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	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
	MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error

BankKeeper defines the expected interface needed to retrieve account balances.

type BondStatus

type BondStatus int32

BondStatus is the status of a validator.

const (
	// UNSPECIFIED defines an invalid validator status.
	BondStatus_Unspecified BondStatus = 0
	// UNBONDED defines a validator that is not bonded.
	BondStatus_Unbonded BondStatus = 1
	// UNBONDING defines a validator that is unbonding.
	BondStatus_Unbonding BondStatus = 2
	// BONDED defines a validator that is bonded.
	BondStatus_Bonded BondStatus = 3

func (BondStatus) EnumDescriptor

func (BondStatus) EnumDescriptor() ([]byte, []int)

func (BondStatus) String

func (x BondStatus) String() string

type CoinKeeper added in v0.0.8

type CoinKeeper interface {
	GetCoin(ctx sdk.Context, denom string) (coin cointypes.Coin, err error)
	GetCoins(ctx sdk.Context) (coins []cointypes.Coin)
	GetBaseDenom(ctx sdk.Context) string
	GetDecreasingFactor(ctx sdk.Context, coin sdk.Coin) (sdk.Dec, error)
	BurnPoolCoins(ctx sdk.Context, poolName string, coins sdk.Coins) error
	UpdateCoinVR(ctx sdk.Context, denom string, volume sdkmath.Int, reserve sdkmath.Int) error
	IsCoinExists(ctx sdk.Context, denom string) bool

type Delegation

type Delegation struct {
	// delegator is the bech32-encoded address of the delegator.
	Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty"`
	// validator is the bech32-encoded address of the validator.
	Validator string `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator,omitempty"`
	// stake defines the object describing the stake completely.
	Stake Stake `protobuf:"bytes,3,opt,name=stake,proto3" json:"stake"`

Delegation represents the bond with coins/NTFs held by an account. It is owned by particular delegator, and is associated with the voting power of particular validator.

func MustUnmarshalDelegation added in v0.0.8

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

MustUnmarshalDelegation returns the unmarshaled delegation from bytes. Panics if fails.

func NewDelegation added in v0.0.8

func NewDelegation(delegator sdk.AccAddress, validator sdk.ValAddress, stake Stake) Delegation

NewDelegation creates a new delegation object.

func UnmarshalDelegation added in v0.0.8

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

UnmarshalDelegation returns the unmarshaled delegation from bytes.

func (*Delegation) Descriptor

func (*Delegation) Descriptor() ([]byte, []int)

func (*Delegation) Equal added in v0.0.8

func (this *Delegation) Equal(that interface{}) bool

func (Delegation) GetDelegator added in v0.0.8

func (d Delegation) GetDelegator() sdk.AccAddress

GetDelegator returns delegator address.

func (Delegation) GetStake added in v0.0.8

func (d Delegation) GetStake() StakeI

GetStake returns the stake delegated.

func (Delegation) GetValidator added in v0.0.8

func (d Delegation) GetValidator() sdk.ValAddress

GetValidator returns validator address.

func (*Delegation) Marshal

func (m *Delegation) Marshal() (dAtA []byte, err error)

func (*Delegation) MarshalTo

func (m *Delegation) MarshalTo(dAtA []byte) (int, error)

func (*Delegation) MarshalToSizedBuffer

func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Delegation) ProtoMessage

func (*Delegation) ProtoMessage()

func (*Delegation) Reset

func (m *Delegation) Reset()

func (*Delegation) Size

func (m *Delegation) Size() (n int)

func (*Delegation) String

func (m *Delegation) String() string

func (*Delegation) Unmarshal

func (m *Delegation) Unmarshal(dAtA []byte) error

func (*Delegation) XXX_DiscardUnknown

func (m *Delegation) XXX_DiscardUnknown()

func (*Delegation) XXX_Marshal

func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Delegation) XXX_Merge

func (m *Delegation) XXX_Merge(src proto.Message)

func (*Delegation) XXX_Size

func (m *Delegation) XXX_Size() int

func (*Delegation) XXX_Unmarshal

func (m *Delegation) XXX_Unmarshal(b []byte) error

type DelegationI added in v0.0.8

type DelegationI interface {
	GetDelegator() sdk.AccAddress
	GetValidator() sdk.ValAddress
	GetStake() StakeI

DelegationI defines interface for a delegation bonded to a validator.

type DelegationSet added in v0.0.8

type DelegationSet interface {
	GetValidatorSet() ValidatorSet // validator set for which delegation set is based upon

	// iterate through all delegations from one delegator by validator-AccAddress,
	//   execute func for each validator
	IterateDelegations(ctx sdk.Context, delegator sdk.AccAddress,
		fn func(index int64, delegation DelegationI) (stop bool))

DelegationSet expected properties for the set of all delegations for a particular (noalias)

type Delegations added in v0.0.8

type Delegations []Delegation

Delegations is a collection of delegations.

func (Delegations) String added in v0.0.8

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

type DelegatorReward added in v0.0.8

type DelegatorReward struct {
	// delegator is the bech32-encoded address of the delegator.
	Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty"`
	// coins is the complete list of coin stakes rewards.
	Coins []StakeReward `protobuf:"bytes,2,rep,name=coins,proto3" json:"coins"`
	// nfts is the complete list of NFT stakes rewards.
	NFTs []StakeReward `protobuf:"bytes,3,rep,name=nfts,proto3" json:"nfts"`

DelegatorReward contains delegator address and amount of a reward in base coin.

func (*DelegatorReward) Descriptor added in v0.0.8

func (*DelegatorReward) Descriptor() ([]byte, []int)

func (*DelegatorReward) Marshal added in v0.0.8

func (m *DelegatorReward) Marshal() (dAtA []byte, err error)

func (*DelegatorReward) MarshalTo added in v0.0.8

func (m *DelegatorReward) MarshalTo(dAtA []byte) (int, error)

func (*DelegatorReward) MarshalToSizedBuffer added in v0.0.8

func (m *DelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DelegatorReward) ProtoMessage added in v0.0.8

func (*DelegatorReward) ProtoMessage()

func (*DelegatorReward) Reset added in v0.0.8