types

package
v8.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	EventTypeValidatorIncentivesReward       = "validator_incentives_reward"
	EventTypeTotalValidatorIncentivesRewards = "total_validator_incentives_rewards"

	AttributeKeyValidator = "validator"
)
View Source
const (
	// ModuleName is the module name constant used in many places
	ModuleName = "incentives"

	// StoreKey is the store key string for incentives
	StoreKey = ModuleName

	// RouterKey is the message route for incentives
	RouterKey = ModuleName

	// QuerierRoute is the querier route for incentives
	QuerierRoute = ModuleName
)
View Source
const DefaultParamspace = ModuleName

Variables

View Source
var (
	ErrInvalidDistributionPerBlock             = errorsmod.Register(ModuleName, 1, "invalid distribution per block")
	ErrInvalidValidatorMaxDistributionPerBlock = errorsmod.Register(ModuleName, 2, "invalid validator distribution per block")
	ErrInvalidValidatorIncentivesMaxFraction   = errorsmod.Register(ModuleName, 3, "invalid validator incentives max fraction")
	ErrInvalidValidatorIncentivesSetSizeLimit  = errorsmod.Register(ModuleName, 4, "invalid validator incentives set size limit")
)
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 (
	KeyDistributionPerBlock             = []byte("DistributionPerBlock")
	KeyIncentivesCutoffHeight           = []byte("IncentivesCutoffHeight")
	KeyValidatorMaxDistributionPerBlock = []byte("ValidatorMaxDistributionPerBlock")
	KeyValidatorIncentivesCutoffHeight  = []byte("ValidatorIncentivesCutoffHeight")
	KeyValidatorIncentivesMaxFraction   = []byte("ValidatorIncentivesMaxFraction")
	KeyValidatorIncentivesSetSizeLimit  = []byte("ValidatorIncentivesSetSizeLimit")
)

Parameter keys

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 Query_serviceDesc = _Query_serviceDesc

Functions

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable returns the parameter key table.

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers the incentives proto files

func RegisterQueryHandler

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

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

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

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

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type BankKeeper

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

	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error

	BlockedAddr(addr sdk.AccAddress) bool
}

BankKeeper defines the expected interface needed to retrieve account balances.

type DistributionKeeper

type DistributionKeeper interface {
	GetFeePool(ctx sdk.Context) (feePool distributiontypes.FeePool)
	SetFeePool(ctx sdk.Context, feePool distributiontypes.FeePool)
	GetValidatorOutstandingRewards(ctx sdk.Context, valAddr sdk.ValAddress) (rewards distributiontypes.ValidatorOutstandingRewards)
	SetValidatorOutstandingRewards(ctx sdk.Context, valAddr sdk.ValAddress, rewards distributiontypes.ValidatorOutstandingRewards)
	GetValidatorCurrentRewards(ctx sdk.Context, valAddr sdk.ValAddress) (rewards distributiontypes.ValidatorCurrentRewards)
	SetValidatorCurrentRewards(ctx sdk.Context, valAddr sdk.ValAddress, rewards distributiontypes.ValidatorCurrentRewards)
	GetValidatorAccumulatedCommission(ctx sdk.Context, valAddr sdk.ValAddress) (commission distributiontypes.ValidatorAccumulatedCommission)
	SetValidatorAccumulatedCommission(ctx sdk.Context, valAddr sdk.ValAddress, commission distributiontypes.ValidatorAccumulatedCommission)
}

DistributionKeeper defines the expected distribution keeper methods

type GenesisState

type GenesisState struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState get raw genesis raw message for testing

func (*GenesisState) Descriptor

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

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) Marshal

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

func (*GenesisState) MarshalTo

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

func (*GenesisState) MarshalToSizedBuffer

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

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

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

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

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

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs a basic stateless validation of the genesis fields.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

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

func (*GenesisState) XXX_Merge

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

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

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

type MintKeeper

type MintKeeper interface {
	GetParams(ctx sdk.Context) minttypes.Params
	StakingTokenSupply(ctx sdk.Context) math.Int
	BondedRatio(ctx sdk.Context) sdk.Dec
}

MintKeeper defines the expected mint keeper methods

type Params

type Params struct {
	// DistributionPerBlock defines the coin to be sent to the distribution module from the community pool every block
	DistributionPerBlock types.Coin `protobuf:"bytes,1,opt,name=distribution_per_block,json=distributionPerBlock,proto3" json:"distribution_per_block"`
	// IncentivesCutoffHeight defines the block height after which the incentives module will stop sending coins to the distribution module from
	// the community pool
	IncentivesCutoffHeight uint64 `` /* 130-byte string literal not displayed */
	// ValidatorMaxDistributionPerBlock defines the maximum coins to be sent directly to voters in the last block from the community pool every block. Leftover coins remain in the community pool.
	ValidatorMaxDistributionPerBlock types.Coin `` /* 153-byte string literal not displayed */
	// ValidatorIncentivesCutoffHeight defines the block height after which the validator incentives will be stopped
	ValidatorIncentivesCutoffHeight uint64 `` /* 159-byte string literal not displayed */
	// ValidatorIncentivesMaxFraction defines the maximum fraction of the validator distribution per block that can be sent to a single validator
	ValidatorIncentivesMaxFraction github_com_cosmos_cosmos_sdk_types.Dec `` /* 195-byte string literal not displayed */
	// ValidatorIncentivesSetSizeLimit defines the max number of validators to apportion the validator distribution per block to
	ValidatorIncentivesSetSizeLimit uint64 `` /* 161-byte string literal not displayed */
}

Params incentives parameters

func DefaultParams

func DefaultParams() Params

DefaultParams returns default incentives parameters

func (*Params) Descriptor

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

func (*Params) GetDistributionPerBlock

func (m *Params) GetDistributionPerBlock() types.Coin

func (*Params) GetIncentivesCutoffHeight

func (m *Params) GetIncentivesCutoffHeight() uint64

func (*Params) GetValidatorIncentivesCutoffHeight

func (m *Params) GetValidatorIncentivesCutoffHeight() uint64

func (*Params) GetValidatorIncentivesSetSizeLimit

func (m *Params) GetValidatorIncentivesSetSizeLimit() uint64

func (*Params) GetValidatorMaxDistributionPerBlock

func (m *Params) GetValidatorMaxDistributionPerBlock() types.Coin

func (*Params) Marshal

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

func (*Params) MarshalTo

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

func (*Params) MarshalToSizedBuffer

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

func (*Params) ParamSetPairs

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

ParamSetPairs returns the parameter set pairs.

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

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

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

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

func (*Params) ValidateBasic

func (p *Params) ValidateBasic() error

ValidateBasic performs basic validation on incentives parameters.

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

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

func (*Params) XXX_Merge

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

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

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

type QueryAPYRequest

type QueryAPYRequest struct {
}

QueryAPYRequest is the request type for the QueryAPY gRPC method.

func (*QueryAPYRequest) Descriptor

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

func (*QueryAPYRequest) Marshal

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

func (*QueryAPYRequest) MarshalTo

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

func (*QueryAPYRequest) MarshalToSizedBuffer

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

func (*QueryAPYRequest) ProtoMessage

func (*QueryAPYRequest) ProtoMessage()

func (*QueryAPYRequest) Reset

func (m *QueryAPYRequest) Reset()

func (*QueryAPYRequest) Size

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

func (*QueryAPYRequest) String

func (m *QueryAPYRequest) String() string

func (*QueryAPYRequest) Unmarshal

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

func (*QueryAPYRequest) XXX_DiscardUnknown

func (m *QueryAPYRequest) XXX_DiscardUnknown()

func (*QueryAPYRequest) XXX_Marshal

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

func (*QueryAPYRequest) XXX_Merge

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

func (*QueryAPYRequest) XXX_Size

func (m *QueryAPYRequest) XXX_Size() int

func (*QueryAPYRequest) XXX_Unmarshal

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

type QueryAPYResponse

type QueryAPYResponse struct {
	Apy string `protobuf:"bytes,1,opt,name=apy,proto3" json:"apy,omitempty"`
}

QueryAPYRequest is the response type for the QueryAPY gRPC method.

func (*QueryAPYResponse) Descriptor

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

func (*QueryAPYResponse) GetApy

func (m *QueryAPYResponse) GetApy() string

func (*QueryAPYResponse) Marshal

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

func (*QueryAPYResponse) MarshalTo

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

func (*QueryAPYResponse) MarshalToSizedBuffer

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

func (*QueryAPYResponse) ProtoMessage

func (*QueryAPYResponse) ProtoMessage()

func (*QueryAPYResponse) Reset

func (m *QueryAPYResponse) Reset()

func (*QueryAPYResponse) Size

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

func (*QueryAPYResponse) String

func (m *QueryAPYResponse) String() string

func (*QueryAPYResponse) Unmarshal

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

func (*QueryAPYResponse) XXX_DiscardUnknown

func (m *QueryAPYResponse) XXX_DiscardUnknown()

func (*QueryAPYResponse) XXX_Marshal

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

func (*QueryAPYResponse) XXX_Merge

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

func (*QueryAPYResponse) XXX_Size

func (m *QueryAPYResponse) XXX_Size() int

func (*QueryAPYResponse) XXX_Unmarshal

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

type QueryClient

type QueryClient interface {
	// QueryParams queries the allocation module parameters.
	QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
	// QueryAPY queries the APY returned from the incentives module.
	QueryAPY(ctx context.Context, in *QueryAPYRequest, opts ...grpc.CallOption) (*QueryAPYResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryParamsRequest

type QueryParamsRequest struct {
}

QueryParamsRequest is the request type for the QueryParams gRPC method.

func (*QueryParamsRequest) Descriptor

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

func (*QueryParamsRequest) Marshal

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

func (*QueryParamsRequest) MarshalTo

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

func (*QueryParamsRequest) MarshalToSizedBuffer

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

func (*QueryParamsRequest) ProtoMessage

func (*QueryParamsRequest) ProtoMessage()

func (*QueryParamsRequest) Reset

func (m *QueryParamsRequest) Reset()

func (*QueryParamsRequest) Size

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

func (*QueryParamsRequest) String

func (m *QueryParamsRequest) String() string

func (*QueryParamsRequest) Unmarshal

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

func (*QueryParamsRequest) XXX_DiscardUnknown

func (m *QueryParamsRequest) XXX_DiscardUnknown()

func (*QueryParamsRequest) XXX_Marshal

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

func (*QueryParamsRequest) XXX_Merge

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

func (*QueryParamsRequest) XXX_Size

func (m *QueryParamsRequest) XXX_Size() int

func (*QueryParamsRequest) XXX_Unmarshal

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

type QueryParamsResponse

type QueryParamsResponse struct {
	// allocation parameters
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

QueryParamsRequest is the response type for the QueryParams gRPC method.

func (*QueryParamsResponse) Descriptor

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

func (*QueryParamsResponse) GetParams

func (m *QueryParamsResponse) GetParams() Params

func (*QueryParamsResponse) Marshal

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

func (*QueryParamsResponse) MarshalTo

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

func (*QueryParamsResponse) MarshalToSizedBuffer

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

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

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

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

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

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

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

func (*QueryParamsResponse) XXX_Merge

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

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

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

type QueryServer

type QueryServer interface {
	// QueryParams queries the allocation module parameters.
	QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
	// QueryAPY queries the APY returned from the incentives module.
	QueryAPY(context.Context, *QueryAPYRequest) (*QueryAPYResponse, error)
}

QueryServer is the server API for Query service.

type StakingKeeper

type StakingKeeper interface {
	ValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) stakingtypes.ValidatorI
}

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) QueryAPY

func (*UnimplementedQueryServer) QueryParams

Jump to

Keyboard shortcuts

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