types

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName defines the module's name.
	ModuleName = "dyncomm"
	// StoreKey is the string store representation
	StoreKey     = ModuleName
	RouterKey    = ModuleName
	QuerierRoute = ModuleName
)
View Source
const (
	QueryParameters = "parameters"
)

query endpoints supported by the oracle Querier

Variables

View Source
var (
	ErrInvalidLengthDyncomm        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDyncomm          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupDyncomm = 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 (
	KeyMaxZero       = []byte("MaxZero")
	KeySlopeBase     = []byte("SlopeBase")
	KeySlopeVpImpact = []byte("SlopeVpImpact")
	KeyCap           = []byte("Cap")
)

Parameter keys

View Source
var (
	DefaultMaxZero       = sdk.NewDecWithPrec(5, 1)  // StrathColes A = 0.5
	DefaultSlopeBase     = sdk.NewDecWithPrec(2, 0)  // StrathColes B = 2
	DefaultSlopeVpImpact = sdk.NewDecWithPrec(10, 0) // StrathColes C = 10
	DefaultCap           = sdk.NewDecWithPrec(2, 1)  // StrathColes D = 20%
)

Default dyncomm parameter values

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 MinCommissionRatesPrefix = []byte{0x01} // prefix for each MinCommissionRate entry

MinCommissionRatesPrefix store prefixes

View Source
var (

	// ModuleCdc references the global x/oracle module codec. Note, the codec should
	// ONLY be used in certain instances of tests and for JSON encoding as Amino is
	// still used for that purpose.
	//
	// The actual codec used for serialization should be provided to x/staking and
	// defined at the application level.
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func GetMinCommissionRatesKey

func GetMinCommissionRatesKey(addr string) []byte

MinCommissionRates - stored by *validator addr*

func ParamKeyTable

func ParamKeyTable() paramstypes.KeyTable

ParamKeyTable returns the parameter key table.

func RegisterInterfaces

func RegisterInterfaces(_ codectypes.InterfaceRegistry)

RegisterInterfaces associates protoName with AccountI and VestingAccount Interfaces and creates a registry of it's concrete implementations

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(_ *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the account interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization

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 GenesisState

type GenesisState struct {
	// params defines all the paramaters of the module.
	Params                   Params                    `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	ValidatorCommissionRates []ValidatorCommissionRate `protobuf:"bytes,2,rep,name=validator_commission_rates,json=validatorCommissionRates,proto3" json:"validator_commission_rates"`
}

GenesisState defines the dyncomm module's genesis state.

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState gets raw genesis raw message for testing

func NewGenesisState

func NewGenesisState(params Params, rates []ValidatorCommissionRate) *GenesisState

NewGenesisState creates a new GenesisState object

func (*GenesisState) Descriptor

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

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetValidatorCommissionRates

func (m *GenesisState) GetValidatorCommissionRates() []ValidatorCommissionRate

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

type Params struct {
	MaxZero       github_com_cosmos_cosmos_sdk_types.Dec `` /* 138-byte string literal not displayed */
	SlopeBase     github_com_cosmos_cosmos_sdk_types.Dec `` /* 146-byte string literal not displayed */
	SlopeVpImpact github_com_cosmos_cosmos_sdk_types.Dec `` /* 165-byte string literal not displayed */
	Cap           github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=cap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"cap" yaml:"cap"`
}

Params defines the parameters for the dyncomm module.

func DefaultParams

func DefaultParams() Params

DefaultParams creates default dyncomm module parameters

func (*Params) Descriptor

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

func (*Params) Equal

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

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() paramstypes.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of market module's parameters.

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 (p Params) String() string

String implements fmt.Stringer interface

func (*Params) Unmarshal

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

func (Params) Validate

func (p Params) Validate() error

Validate a set of params

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 QueryClient

type QueryClient interface {
	// Params queries all parameters.
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
	Rate(ctx context.Context, in *QueryRateRequest, opts ...grpc.CallOption) (*QueryRateResponse, 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 Query/Params RPC 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 {
	// params defines the parameters of the module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

QueryParamsResponse is the response type for the Query/Params RPC 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 QueryRateRequest

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

QueryRateRequest is the request type for the Query/Rate RPC method.

func (*QueryRateRequest) Descriptor

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

func (*QueryRateRequest) GetValidatorAddr

func (m *QueryRateRequest) GetValidatorAddr() string

func (*QueryRateRequest) Marshal

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

func (*QueryRateRequest) MarshalTo

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

func (*QueryRateRequest) MarshalToSizedBuffer

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

func (*QueryRateRequest) ProtoMessage

func (*QueryRateRequest) ProtoMessage()

func (*QueryRateRequest) Reset

func (m *QueryRateRequest) Reset()

func (*QueryRateRequest) Size

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

func (*QueryRateRequest) String

func (m *QueryRateRequest) String() string

func (*QueryRateRequest) Unmarshal

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

func (*QueryRateRequest) XXX_DiscardUnknown

func (m *QueryRateRequest) XXX_DiscardUnknown()

func (*QueryRateRequest) XXX_Marshal

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

func (*QueryRateRequest) XXX_Merge

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

func (*QueryRateRequest) XXX_Size

func (m *QueryRateRequest) XXX_Size() int

func (*QueryRateRequest) XXX_Unmarshal

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

type QueryRateResponse

type QueryRateResponse struct {
	Rate   *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate,omitempty"`
	Target *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=target,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"target,omitempty"`
}

QueryRateResponse is the response type for the Query/Rate RPC method.

func (*QueryRateResponse) Descriptor

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

func (*QueryRateResponse) Marshal

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

func (*QueryRateResponse) MarshalTo

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

func (*QueryRateResponse) MarshalToSizedBuffer

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

func (*QueryRateResponse) ProtoMessage

func (*QueryRateResponse) ProtoMessage()

func (*QueryRateResponse) Reset

func (m *QueryRateResponse) Reset()

func (*QueryRateResponse) Size

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

func (*QueryRateResponse) String

func (m *QueryRateResponse) String() string

func (*QueryRateResponse) Unmarshal

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

func (*QueryRateResponse) XXX_DiscardUnknown

func (m *QueryRateResponse) XXX_DiscardUnknown()

func (*QueryRateResponse) XXX_Marshal

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

func (*QueryRateResponse) XXX_Merge

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

func (*QueryRateResponse) XXX_Size

func (m *QueryRateResponse) XXX_Size() int

func (*QueryRateResponse) XXX_Unmarshal

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

type QueryServer

type QueryServer interface {
	// Params queries all parameters.
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
	Rate(context.Context, *QueryRateRequest) (*QueryRateResponse, error)
}

QueryServer is the server API for Query service.

type StakingKeeper

type StakingKeeper interface {
	MinCommissionRate(ctx sdk.Context) sdk.Dec
	GetLastTotalPower(ctx sdk.Context) math.Int
	PowerReduction(ctx sdk.Context) math.Int
	IterateValidators(sdk.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool))
	SetValidator(ctx sdk.Context, validator stakingtypes.Validator)
}

AccountKeeper is expected keeper for auth module

type UnimplementedQueryServer

type UnimplementedQueryServer struct{}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Params

func (*UnimplementedQueryServer) Rate

type ValidatorCommissionRate

type ValidatorCommissionRate struct {
	ValidatorAddress     string                                  `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"`
	MinCommissionRate    *github_com_cosmos_cosmos_sdk_types.Dec `` /* 164-byte string literal not displayed */
	TargetCommissionRate *github_com_cosmos_cosmos_sdk_types.Dec `` /* 173-byte string literal not displayed */
}

MinDynCommission defines a validator - min commission rate pair to be enforced by the blockchain

func (*ValidatorCommissionRate) Descriptor

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

func (*ValidatorCommissionRate) GetValidatorAddress

func (m *ValidatorCommissionRate) GetValidatorAddress() string

func (*ValidatorCommissionRate) Marshal

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

func (*ValidatorCommissionRate) MarshalTo

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

func (*ValidatorCommissionRate) MarshalToSizedBuffer

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

func (*ValidatorCommissionRate) ProtoMessage

func (*ValidatorCommissionRate) ProtoMessage()

func (*ValidatorCommissionRate) Reset

func (m *ValidatorCommissionRate) Reset()

func (*ValidatorCommissionRate) Size

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

func (*ValidatorCommissionRate) String

func (m *ValidatorCommissionRate) String() string

func (*ValidatorCommissionRate) Unmarshal

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

func (*ValidatorCommissionRate) XXX_DiscardUnknown

func (m *ValidatorCommissionRate) XXX_DiscardUnknown()

func (*ValidatorCommissionRate) XXX_Marshal

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

func (*ValidatorCommissionRate) XXX_Merge

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

func (*ValidatorCommissionRate) XXX_Size

func (m *ValidatorCommissionRate) XXX_Size() int

func (*ValidatorCommissionRate) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

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