diff --git a/app/app.go b/app/app.go index a56fa0fd..88fc0f86 100644 --- a/app/app.go +++ b/app/app.go @@ -177,6 +177,9 @@ import ( "github.com/milkyway-labs/milkyway/x/stakeibc" stakeibckeeper "github.com/milkyway-labs/milkyway/x/stakeibc/keeper" stakeibctypes "github.com/milkyway-labs/milkyway/x/stakeibc/types" + "github.com/milkyway-labs/milkyway/x/tickers" + tickerskeeper "github.com/milkyway-labs/milkyway/x/tickers/keeper" + tickerstypes "github.com/milkyway-labs/milkyway/x/tickers/types" "github.com/milkyway-labs/milkyway/x/tokenfactory" tokenfactorykeeper "github.com/milkyway-labs/milkyway/x/tokenfactory/keeper" tokenfactorytypes "github.com/milkyway-labs/milkyway/x/tokenfactory/types" @@ -293,6 +296,7 @@ type MilkyWayApp struct { OperatorsKeeper *operatorskeeper.Keeper PoolsKeeper *poolskeeper.Keeper RestakingKeeper *restakingkeeper.Keeper + TickersKeeper *tickerskeeper.Keeper // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper @@ -357,6 +361,7 @@ func NewMilkyWayApp( // Custom modules servicestypes.StoreKey, operatorstypes.StoreKey, poolstypes.StoreKey, restakingtypes.StoreKey, + tickerstypes.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(forwardingtypes.TransientStoreKey) memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -898,6 +903,12 @@ func NewMilkyWayApp( app.ServicesKeeper, authorityAddr, ) + app.TickersKeeper = tickerskeeper.NewKeeper( + app.appCodec, + runtime.NewKVStoreService(keys[tickerstypes.StoreKey]), + app.AccountKeeper, + authorityAddr, + ) /**** Module Options ****/ @@ -949,6 +960,7 @@ func NewMilkyWayApp( operators.NewAppModule(appCodec, app.OperatorsKeeper), pools.NewAppModule(appCodec, app.PoolsKeeper), restaking.NewAppModule(appCodec, app.RestakingKeeper), + tickers.NewAppModule(appCodec, app.TickersKeeper), ) if err := app.setupIndexer(appOpts, homePath, ac, vc, appCodec); err != nil { @@ -1029,6 +1041,7 @@ func NewMilkyWayApp( recordstypes.ModuleName, ratelimittypes.ModuleName, icacallbackstypes.ModuleName, servicestypes.ModuleName, operatorstypes.ModuleName, poolstypes.ModuleName, restakingtypes.ModuleName, + tickerstypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) diff --git a/proto/milkyway/tickers/v1/genesis.proto b/proto/milkyway/tickers/v1/genesis.proto new file mode 100644 index 00000000..994a7742 --- /dev/null +++ b/proto/milkyway/tickers/v1/genesis.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package milkyway.tickers.v1; + +import "gogoproto/gogo.proto"; +import "milkyway/tickers/v1/params.proto"; + +option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; + +// GenesisState defines the module's genesis state. +message GenesisState { + // Params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; + + map tickers = 2; +} \ No newline at end of file diff --git a/proto/milkyway/tickers/v1/messages.proto b/proto/milkyway/tickers/v1/messages.proto new file mode 100644 index 00000000..d0c16ab2 --- /dev/null +++ b/proto/milkyway/tickers/v1/messages.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +package milkyway.tickers.v1; + +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "milkyway/tickers/v1/params.proto"; + +option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; + +// Msg defines the services module's gRPC message service. +service Msg { + option (cosmos.msg.v1.service) = true; + + rpc RegisterTicker(MsgRegisterTicker) returns (MsgRegisterTickerResponse); + + rpc DeregisterTicker(MsgDeregisterTicker) + returns (MsgDeregisterTickerResponse); + + // UpdateParams defines a (governance) operation for updating the module + // parameters. + // The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +message MsgRegisterTicker { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "tickers/MsgRegisterTicker"; + + // Authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + string denom = 2; + + string ticker = 3; +} + +message MsgRegisterTickerResponse {} + +message MsgDeregisterTicker { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "tickers/MsgDeregisterTicker"; + + // Authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + string denom = 2; +} + +message MsgDeregisterTickerResponse {} + +// MsgUpdateParams defines the message structure for the UpdateParams gRPC +// service method. It allows the authority to update the module parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "tickers/MsgUpdateParams"; + + // Authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ + (gogoproto.moretags) = "yaml:\"authority\"", + (cosmos_proto.scalar) = "cosmos.AddressString" + ]; + + // Params define the parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [ (gogoproto.nullable) = false ]; +} + +// MsgUpdateParamsResponse is the return value of MsgUpdateParams. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/proto/milkyway/tickers/v1/models.proto b/proto/milkyway/tickers/v1/models.proto new file mode 100644 index 00000000..b4af7f4d --- /dev/null +++ b/proto/milkyway/tickers/v1/models.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; +package milkyway.tickers.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; diff --git a/proto/milkyway/tickers/v1/params.proto b/proto/milkyway/tickers/v1/params.proto new file mode 100644 index 00000000..9e2d9fff --- /dev/null +++ b/proto/milkyway/tickers/v1/params.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package milkyway.tickers.v1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; + +// Params defines the parameters for the module. +message Params {} \ No newline at end of file diff --git a/proto/milkyway/tickers/v1/query.proto b/proto/milkyway/tickers/v1/query.proto new file mode 100644 index 00000000..e43ea1d7 --- /dev/null +++ b/proto/milkyway/tickers/v1/query.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; +package milkyway.tickers.v1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "milkyway/tickers/v1/params.proto"; + +option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; + +// Query defines the gRPC querier service. +service Query { + // Params defines a gRPC query method that returns the parameters of the + // module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/milkyway/tickers/v1/params"; + } + + rpc Ticker(QueryTickerRequest) returns (QueryTickerResponse) { + option (google.api.http).get = "/milkyway/tickers/v1/tickers/{denom}"; + } + + rpc Denoms(QueryDenomsRequest) returns (QueryDenomsResponse) { + option (google.api.http).get = "/milkyway/tickers/v1/denoms/{ticker}"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryTickerRequest { string denom = 1; } + +message QueryTickerResponse { string ticker = 1; } + +message QueryDenomsRequest { + string ticker = 1; + + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +message QueryDenomsResponse { + repeated string denoms = 1; + + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/x/tickers/client/cli/query.go b/x/tickers/client/cli/query.go new file mode 100644 index 00000000..8c26d8c7 --- /dev/null +++ b/x/tickers/client/cli/query.go @@ -0,0 +1,129 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cobra" + + "github.com/milkyway-labs/milkyway/x/tickers/types" +) + +// GetQueryCmd returns the command allowing to perform queries +func GetQueryCmd() *cobra.Command { + queryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + queryCmd.AddCommand( + GetCmdQueryParams(), + GetCmdQueryTicker(), + GetCmdQueryDenoms(), + ) + + return queryCmd +} + +// GetCmdQueryParams returns the command to query the module params +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query the module parameters", + Example: fmt.Sprintf(`%s query %s params`, version.AppName, types.ModuleName), + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryTicker returns the command allowing to query the ticker by a denom +func GetCmdQueryTicker() *cobra.Command { + cmd := &cobra.Command{ + Use: "ticker [denom]", + Short: "Query the ticker of a given denom", + Example: fmt.Sprintf(`%s query %s ticker umilk`, version.AppName, types.ModuleName), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + denom := args[0] + + res, err := queryClient.Ticker(cmd.Context(), &types.QueryTickerRequest{Denom: denom}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryDenoms returns the command allowing to query all the denoms for +// a given ticker +func GetCmdQueryDenoms() *cobra.Command { + cmd := &cobra.Command{ + Use: "denoms [ticker]", + Short: "Query all the denoms of a given ticker", + Example: fmt.Sprintf(`%s query %s denoms MILK`, version.AppName, types.ModuleName), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + ticker := args[0] + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := queryClient.Denoms(cmd.Context(), &types.QueryDenomsRequest{ + Ticker: ticker, Pagination: pageReq, + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "denoms") + + return cmd +} diff --git a/x/tickers/client/cli/tx.go b/x/tickers/client/cli/tx.go new file mode 100644 index 00000000..4c45d69d --- /dev/null +++ b/x/tickers/client/cli/tx.go @@ -0,0 +1,23 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/milkyway-labs/milkyway/x/tickers/types" +) + +// GetTxCmd returns a new command to perform transactions +func GetTxCmd() *cobra.Command { + txCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Tickers transaction subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + txCmd.AddCommand() + + return txCmd +} diff --git a/x/tickers/keeper/alias_functions.go b/x/tickers/keeper/alias_functions.go new file mode 100644 index 00000000..d4dbd061 --- /dev/null +++ b/x/tickers/keeper/alias_functions.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/collections" +) + +func (k *Keeper) SetTicker(ctx context.Context, denom, ticker string) error { + if err := k.Tickers.Set(ctx, denom, ticker); err != nil { + return err + } + if err := k.TickerIndexes.Set(ctx, collections.Join(ticker, denom)); err != nil { + return err + } + return nil +} + +func (k *Keeper) GetTicker(ctx context.Context, denom string) (string, error) { + return k.Tickers.Get(ctx, denom) +} + +func (k *Keeper) RemoveTicker(ctx context.Context, denom string) error { + ticker, err := k.GetTicker(ctx, denom) + if err != nil { + return err + } + if err := k.Tickers.Remove(ctx, denom); err != nil { + return err + } + return k.TickerIndexes.Remove(ctx, collections.Join(ticker, denom)) +} diff --git a/x/tickers/keeper/genesis.go b/x/tickers/keeper/genesis.go new file mode 100644 index 00000000..a6a3dd30 --- /dev/null +++ b/x/tickers/keeper/genesis.go @@ -0,0 +1,39 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/milkyway-labs/milkyway/x/tickers/types" +) + +// ExportGenesis returns the GenesisState associated with the given context +func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + params, err := k.Params.Get(ctx) + if err != nil { + panic(err) + } + + tickers := types.Tickers{} + _ = k.Tickers.Walk(ctx, nil, func(denom, ticker string) (stop bool, err error) { + tickers[denom] = ticker + return false, nil + }) + + return types.NewGenesisState(params, tickers) +} + +// -------------------------------------------------------------------------------------------------------------------- + +// InitGenesis initializes the state from a GenesisState +func (k *Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { + // Store params + if err := k.Params.Set(ctx, state.Params); err != nil { + panic(err) + } + + for denom, ticker := range state.Tickers { + if err := k.SetTicker(ctx, denom, ticker); err != nil { + panic(err) + } + } +} diff --git a/x/tickers/keeper/grpc_query.go b/x/tickers/keeper/grpc_query.go new file mode 100644 index 00000000..36604a3a --- /dev/null +++ b/x/tickers/keeper/grpc_query.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/collections" + "github.com/cosmos/cosmos-sdk/types/query" + + "github.com/milkyway-labs/milkyway/x/tickers/types" +) + +var _ types.QueryServer = queryServer{} + +type queryServer struct { + k *Keeper +} + +func NewQueryServer(k *Keeper) types.QueryServer { + return queryServer{k: k} +} + +func (q queryServer) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + params, err := q.k.Params.Get(ctx) + if err != nil { + return nil, err + } + return &types.QueryParamsResponse{Params: params}, nil +} + +func (q queryServer) Ticker(ctx context.Context, req *types.QueryTickerRequest) (*types.QueryTickerResponse, error) { + ticker, err := q.k.Tickers.Get(ctx, req.Denom) + if err != nil { + return nil, err + } + return &types.QueryTickerResponse{Ticker: ticker}, nil +} + +func (q queryServer) Denoms(ctx context.Context, req *types.QueryDenomsRequest) (*types.QueryDenomsResponse, error) { + denoms, pageRes, err := query.CollectionPaginate(ctx, q.k.TickerIndexes, req.Pagination, func(key collections.Pair[string, string], _ collections.NoValue) (string, error) { + return key.K2(), nil + }, query.WithCollectionPaginationPairPrefix[string, string](req.Ticker)) + if err != nil { + return nil, err + } + return &types.QueryDenomsResponse{Denoms: denoms, Pagination: pageRes}, nil +} diff --git a/x/tickers/keeper/invariants.go b/x/tickers/keeper/invariants.go new file mode 100644 index 00000000..5dcc7528 --- /dev/null +++ b/x/tickers/keeper/invariants.go @@ -0,0 +1,9 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// RegisterInvariants registers all module invariants +func RegisterInvariants(ir sdk.InvariantRegistry, keeper *Keeper) { +} diff --git a/x/tickers/keeper/keeper.go b/x/tickers/keeper/keeper.go new file mode 100644 index 00000000..106c8ecc --- /dev/null +++ b/x/tickers/keeper/keeper.go @@ -0,0 +1,67 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/collections" + corestoretypes "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/milkyway-labs/milkyway/x/tickers/types" +) + +type Keeper struct { + cdc codec.Codec + storeService corestoretypes.KVStoreService + + accountKeeper types.AccountKeeper + + Schema collections.Schema + Params collections.Item[types.Params] + Tickers collections.Map[string, string] // denom => ticker + TickerIndexes collections.KeySet[collections.Pair[string, string]] // ticker + denom => nil + + authority string +} + +func NewKeeper( + cdc codec.Codec, + storeService corestoretypes.KVStoreService, + accountKeeper types.AccountKeeper, + authority string, +) *Keeper { + sb := collections.NewSchemaBuilder(storeService) + k := &Keeper{ + cdc: cdc, + storeService: storeService, + accountKeeper: accountKeeper, + + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + Tickers: collections.NewMap( + sb, types.TickerKeyPrefix, "tickers", collections.StringKey, collections.StringValue), + TickerIndexes: collections.NewKeySet( + sb, types.TickerIndexKeyPrefix, "ticker_indexes", + collections.PairKeyCodec(collections.StringKey, collections.StringKey)), + + authority: authority, + } + schema, err := sb.Build() + if err != nil { + panic(err) + } + k.Schema = schema + return k +} + +// GetAuthority returns the module's authority. +func (k *Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k *Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return sdkCtx.Logger().With("module", "x/"+types.ModuleName) +} diff --git a/x/tickers/keeper/msg_server.go b/x/tickers/keeper/msg_server.go new file mode 100644 index 00000000..eee985db --- /dev/null +++ b/x/tickers/keeper/msg_server.go @@ -0,0 +1,62 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/milkyway-labs/milkyway/x/tickers/types" +) + +var _ types.MsgServer = msgServer{} + +type msgServer struct { + *Keeper +} + +func NewMsgServer(k *Keeper) types.MsgServer { + return &msgServer{Keeper: k} +} + +func (k msgServer) RegisterTicker(ctx context.Context, msg *types.MsgRegisterTicker) (*types.MsgRegisterTickerResponse, error) { + if k.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + if err := k.SetTicker(ctx, msg.Denom, msg.Ticker); err != nil { + return nil, err + } + + return &types.MsgRegisterTickerResponse{}, nil +} + +func (k msgServer) DeregisterTicker(ctx context.Context, msg *types.MsgDeregisterTicker) (*types.MsgDeregisterTickerResponse, error) { + if k.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + if err := k.RemoveTicker(ctx, msg.Denom); err != nil { + return nil, err + } + + return &types.MsgDeregisterTickerResponse{}, nil +} + +// UpdateParams defines the rpc method for Msg/UpdateParams +func (k msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + if err := msg.Params.Validate(); err != nil { + return nil, err + } + + // store params + if err := k.Params.Set(ctx, msg.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/tickers/module.go b/x/tickers/module.go new file mode 100644 index 00000000..5e2b8818 --- /dev/null +++ b/x/tickers/module.go @@ -0,0 +1,144 @@ +package tickers + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/milkyway-labs/milkyway/x/tickers/client/cli" + "github.com/milkyway-labs/milkyway/x/tickers/keeper" + "github.com/milkyway-labs/milkyway/x/tickers/types" +) + +const ( + consensusVersion = 1 +) + +var ( + _ appmodule.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err != nil { + panic(err) + } +} + +// GetTxCmd returns the module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the module. +type AppModule struct { + AppModuleBasic + + // To ensure setting hooks properly, keeper must be a reference + keeper *keeper.Keeper +} + +func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// Name returns the module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// RegisterServices registers a GRPC query service to respond to the module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServer(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(am.keeper)) +} + +// RegisterInvariants registers the module's invariants. +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { + keeper.RegisterInvariants(ir, am.keeper) +} + +// InitGenesis performs the module's genesis initialization It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + cdc.MustUnmarshalJSON(gs, &genState) + am.keeper.InitGenesis(ctx, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return consensusVersion } + +func (am AppModule) IsOnePerModuleType() {} + +func (am AppModule) IsAppModule() {} diff --git a/x/tickers/types/codec.go b/x/tickers/types/codec.go new file mode 100644 index 00000000..1c15f79d --- /dev/null +++ b/x/tickers/types/codec.go @@ -0,0 +1,38 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "tickers/MsgUpdateParams") +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + // AminoCdc references the global 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 the module and + // defined at the application level. + AminoCdc = codec.NewLegacyAmino() +) + +func init() { + RegisterLegacyAminoCodec(AminoCdc) + cryptocodec.RegisterCrypto(AminoCdc) + sdk.RegisterLegacyAminoCodec(AminoCdc) +} diff --git a/x/tickers/types/errors.go b/x/tickers/types/errors.go new file mode 100644 index 00000000..025b9a47 --- /dev/null +++ b/x/tickers/types/errors.go @@ -0,0 +1,4 @@ +package types + +var ( +) diff --git a/x/tickers/types/events.go b/x/tickers/types/events.go new file mode 100644 index 00000000..09bc8026 --- /dev/null +++ b/x/tickers/types/events.go @@ -0,0 +1,6 @@ +package types + +// DONTCOVER + +const ( +) diff --git a/x/tickers/types/expected_keepers.go b/x/tickers/types/expected_keepers.go new file mode 100644 index 00000000..cd1e263f --- /dev/null +++ b/x/tickers/types/expected_keepers.go @@ -0,0 +1,13 @@ +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type AccountKeeper interface { + NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI + HasAccount(ctx context.Context, addr sdk.AccAddress) bool + SetAccount(ctx context.Context, acc sdk.AccountI) +} diff --git a/x/tickers/types/genesis.go b/x/tickers/types/genesis.go new file mode 100644 index 00000000..ff590bf8 --- /dev/null +++ b/x/tickers/types/genesis.go @@ -0,0 +1,33 @@ +package types + +import ( + "fmt" +) + +type Tickers = map[string]string + +// NewGenesisState returns a new GenesisState instance +func NewGenesisState(params Params, tickers Tickers) *GenesisState { + return &GenesisState{ + Params: params, + Tickers: Tickers{}, + } +} + +// DefaultGenesis returns a default GenesisState +func DefaultGenesis() *GenesisState { + return NewGenesisState(DefaultParams(), Tickers{}) +} + +// -------------------------------------------------------------------------------------------------------------------- + +// Validate validates the GenesisState and returns an error if it is invalid. +func (data *GenesisState) Validate() error { + // Validate params + err := data.Params.Validate() + if err != nil { + return fmt.Errorf("invalid params: %s", err) + } + + return nil +} diff --git a/x/tickers/types/genesis.pb.go b/x/tickers/types/genesis.pb.go new file mode 100644 index 00000000..09a78c4d --- /dev/null +++ b/x/tickers/types/genesis.pb.go @@ -0,0 +1,489 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: milkyway/tickers/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the module's genesis state. +type GenesisState struct { + // Params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Tickers map[string]string `protobuf:"bytes,2,rep,name=tickers,proto3" json:"tickers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_71c0403dd5d2d0d9, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetTickers() map[string]string { + if m != nil { + return m.Tickers + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "milkyway.tickers.v1.GenesisState") + proto.RegisterMapType((map[string]string)(nil), "milkyway.tickers.v1.GenesisState.TickersEntry") +} + +func init() { proto.RegisterFile("milkyway/tickers/v1/genesis.proto", fileDescriptor_71c0403dd5d2d0d9) } + +var fileDescriptor_71c0403dd5d2d0d9 = []byte{ + // 269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0xcd, 0xcc, 0xc9, + 0xae, 0x2c, 0x4f, 0xac, 0xd4, 0x2f, 0xc9, 0x4c, 0xce, 0x4e, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0xd4, + 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, + 0x29, 0xd1, 0x83, 0x2a, 0xd1, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, + 0x83, 0x58, 0x10, 0xa5, 0x52, 0x0a, 0xd8, 0x4c, 0x2b, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x1a, 0xa6, + 0x74, 0x9e, 0x91, 0x8b, 0xc7, 0x1d, 0x62, 0x7c, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x25, 0x17, + 0x1b, 0x44, 0x81, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0xb4, 0x1e, 0x16, 0xeb, 0xf4, 0x02, + 0xc0, 0x4a, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0x6a, 0x10, 0xf2, 0xe0, 0x62, 0x87, + 0x2a, 0x91, 0x60, 0x52, 0x60, 0xd6, 0xe0, 0x36, 0xd2, 0xc3, 0xaa, 0x17, 0xd9, 0x3a, 0xbd, 0x10, + 0x88, 0xb8, 0x6b, 0x5e, 0x49, 0x51, 0x65, 0x10, 0x4c, 0xbb, 0x94, 0x15, 0x17, 0x0f, 0xb2, 0x84, + 0x90, 0x00, 0x17, 0x73, 0x76, 0x6a, 0x25, 0xd8, 0x45, 0x9c, 0x41, 0x20, 0xa6, 0x90, 0x08, 0x17, + 0x6b, 0x59, 0x62, 0x4e, 0x69, 0xaa, 0x04, 0x13, 0x58, 0x0c, 0xc2, 0xb1, 0x62, 0xb2, 0x60, 0x74, + 0xf2, 0x3e, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, + 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xc3, 0xf4, 0xcc, 0x92, + 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x98, 0xc3, 0x74, 0x73, 0x12, 0x93, 0x8a, 0xe1, + 0x3c, 0xfd, 0x0a, 0x78, 0x40, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x43, 0xc9, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xa1, 0xcb, 0x07, 0x97, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Tickers) > 0 { + for k := range m.Tickers { + v := m.Tickers[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintGenesis(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintGenesis(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenesis(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Tickers) > 0 { + for k, v := range m.Tickers { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovGenesis(uint64(len(k))) + 1 + len(v) + sovGenesis(uint64(len(v))) + n += mapEntrySize + 1 + sovGenesis(uint64(mapEntrySize)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tickers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tickers == nil { + m.Tickers = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenesis + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenesis + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthGenesis + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthGenesis + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Tickers[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/tickers/types/keys.go b/x/tickers/types/keys.go new file mode 100644 index 00000000..a427b617 --- /dev/null +++ b/x/tickers/types/keys.go @@ -0,0 +1,17 @@ +package types + +import ( + "cosmossdk.io/collections" +) + +const ( + ModuleName = "tickers" + StoreKey = ModuleName +) + +var ( + ParamsKey = collections.NewPrefix(0x01) + + TickerKeyPrefix = collections.NewPrefix(0x11) + TickerIndexKeyPrefix = collections.NewPrefix(0x12) +) diff --git a/x/tickers/types/messages.go b/x/tickers/types/messages.go new file mode 100644 index 00000000..ded50006 --- /dev/null +++ b/x/tickers/types/messages.go @@ -0,0 +1,66 @@ +package types + +import ( + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var ( + _ sdk.Msg = &MsgRegisterTicker{} + _ sdk.Msg = &MsgDeregisterTicker{} + _ sdk.Msg = &MsgUpdateParams{} +) + +func NewMsgRegisterTicker(authority, denom, ticker string) *MsgRegisterTicker { + return &MsgRegisterTicker{ + Authority: authority, + Denom: denom, + Ticker: ticker, + } +} + +func (msg *MsgRegisterTicker) Validate() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address") + } + if err := sdk.ValidateDenom(msg.Denom); err != nil { + return err + } + // TODO: validate ticker + return nil +} + +func NewMsgDeregisterTicker(authority, denom string) *MsgDeregisterTicker { + return &MsgDeregisterTicker{ + Authority: authority, + Denom: denom, + } +} + +func (msg *MsgDeregisterTicker) Validate() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address") + } + if err := sdk.ValidateDenom(msg.Denom); err != nil { + return err + } + return nil +} + +func NewMsgUpdateParams(authority string, params Params) *MsgUpdateParams { + return &MsgUpdateParams{ + Authority: authority, + Params: params, + } +} + +func (msg *MsgUpdateParams) Validate() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address") + } + if err := msg.Params.Validate(); err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid params: %s", err.Error()) + } + return nil +} diff --git a/x/tickers/types/messages.pb.go b/x/tickers/types/messages.pb.go new file mode 100644 index 00000000..1a8cc126 --- /dev/null +++ b/x/tickers/types/messages.pb.go @@ -0,0 +1,1420 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: milkyway/tickers/v1/messages.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type MsgRegisterTicker struct { + // Authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + Ticker string `protobuf:"bytes,3,opt,name=ticker,proto3" json:"ticker,omitempty"` +} + +func (m *MsgRegisterTicker) Reset() { *m = MsgRegisterTicker{} } +func (m *MsgRegisterTicker) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterTicker) ProtoMessage() {} +func (*MsgRegisterTicker) Descriptor() ([]byte, []int) { + return fileDescriptor_5880bc6d23f66fb1, []int{0} +} +func (m *MsgRegisterTicker) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterTicker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterTicker.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterTicker) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterTicker.Merge(m, src) +} +func (m *MsgRegisterTicker) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterTicker) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterTicker.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterTicker proto.InternalMessageInfo + +func (m *MsgRegisterTicker) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgRegisterTicker) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *MsgRegisterTicker) GetTicker() string { + if m != nil { + return m.Ticker + } + return "" +} + +type MsgRegisterTickerResponse struct { +} + +func (m *MsgRegisterTickerResponse) Reset() { *m = MsgRegisterTickerResponse{} } +func (m *MsgRegisterTickerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterTickerResponse) ProtoMessage() {} +func (*MsgRegisterTickerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5880bc6d23f66fb1, []int{1} +} +func (m *MsgRegisterTickerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterTickerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterTickerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterTickerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterTickerResponse.Merge(m, src) +} +func (m *MsgRegisterTickerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterTickerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterTickerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterTickerResponse proto.InternalMessageInfo + +type MsgDeregisterTicker struct { + // Authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *MsgDeregisterTicker) Reset() { *m = MsgDeregisterTicker{} } +func (m *MsgDeregisterTicker) String() string { return proto.CompactTextString(m) } +func (*MsgDeregisterTicker) ProtoMessage() {} +func (*MsgDeregisterTicker) Descriptor() ([]byte, []int) { + return fileDescriptor_5880bc6d23f66fb1, []int{2} +} +func (m *MsgDeregisterTicker) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeregisterTicker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeregisterTicker.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDeregisterTicker) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeregisterTicker.Merge(m, src) +} +func (m *MsgDeregisterTicker) XXX_Size() int { + return m.Size() +} +func (m *MsgDeregisterTicker) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeregisterTicker.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeregisterTicker proto.InternalMessageInfo + +func (m *MsgDeregisterTicker) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgDeregisterTicker) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type MsgDeregisterTickerResponse struct { +} + +func (m *MsgDeregisterTickerResponse) Reset() { *m = MsgDeregisterTickerResponse{} } +func (m *MsgDeregisterTickerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDeregisterTickerResponse) ProtoMessage() {} +func (*MsgDeregisterTickerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5880bc6d23f66fb1, []int{3} +} +func (m *MsgDeregisterTickerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeregisterTickerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeregisterTickerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDeregisterTickerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeregisterTickerResponse.Merge(m, src) +} +func (m *MsgDeregisterTickerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDeregisterTickerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeregisterTickerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeregisterTickerResponse proto.InternalMessageInfo + +// MsgUpdateParams defines the message structure for the UpdateParams gRPC +// service method. It allows the authority to update the module parameters. +type MsgUpdateParams struct { + // Authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + // Params define the parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_5880bc6d23f66fb1, []int{4} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse is the return value of MsgUpdateParams. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5880bc6d23f66fb1, []int{5} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgRegisterTicker)(nil), "milkyway.tickers.v1.MsgRegisterTicker") + proto.RegisterType((*MsgRegisterTickerResponse)(nil), "milkyway.tickers.v1.MsgRegisterTickerResponse") + proto.RegisterType((*MsgDeregisterTicker)(nil), "milkyway.tickers.v1.MsgDeregisterTicker") + proto.RegisterType((*MsgDeregisterTickerResponse)(nil), "milkyway.tickers.v1.MsgDeregisterTickerResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "milkyway.tickers.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "milkyway.tickers.v1.MsgUpdateParamsResponse") +} + +func init() { + proto.RegisterFile("milkyway/tickers/v1/messages.proto", fileDescriptor_5880bc6d23f66fb1) +} + +var fileDescriptor_5880bc6d23f66fb1 = []byte{ + // 503 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xce, 0xb5, 0x34, 0x52, 0x0f, 0x04, 0xad, 0x1b, 0x91, 0xc4, 0x11, 0x6e, 0x65, 0x21, 0x54, + 0x45, 0xa9, 0x4d, 0x8a, 0x84, 0x44, 0x36, 0x22, 0x26, 0x50, 0x24, 0x64, 0x60, 0x61, 0x41, 0x97, + 0xe4, 0x74, 0xb1, 0x9a, 0xf3, 0x59, 0x7e, 0xd7, 0x82, 0x37, 0xc4, 0xc8, 0x84, 0xc4, 0x8f, 0x60, + 0xcd, 0xc0, 0x4f, 0x60, 0xa8, 0x98, 0x2a, 0x26, 0xa6, 0x0a, 0x25, 0x43, 0x76, 0x7e, 0x01, 0xaa, + 0xef, 0xec, 0x86, 0x38, 0x95, 0xbc, 0x74, 0xb1, 0xfc, 0xbd, 0xfb, 0xde, 0xfb, 0xbe, 0x4f, 0xef, + 0x6c, 0x6c, 0x73, 0x7f, 0x7c, 0x14, 0xbf, 0x27, 0xb1, 0x2b, 0xfd, 0xc1, 0x11, 0x8d, 0xc0, 0x3d, + 0x69, 0xbb, 0x9c, 0x02, 0x10, 0x46, 0xc1, 0x09, 0x23, 0x21, 0x85, 0xb1, 0x93, 0x72, 0x1c, 0xcd, + 0x71, 0x4e, 0xda, 0xe6, 0x36, 0xe1, 0x7e, 0x20, 0xdc, 0xe4, 0xa9, 0x78, 0x66, 0x7d, 0x20, 0x80, + 0x0b, 0x78, 0x97, 0x20, 0x57, 0x01, 0x7d, 0x54, 0x55, 0xc8, 0xe5, 0xc0, 0x12, 0x01, 0x60, 0xfa, + 0xa0, 0xc2, 0x04, 0x13, 0xaa, 0xe1, 0xe2, 0x4d, 0x57, 0xf7, 0x56, 0xb9, 0x0a, 0x49, 0x44, 0xb8, + 0x1e, 0x68, 0x7f, 0x43, 0x78, 0xbb, 0x07, 0xcc, 0xa3, 0xcc, 0x07, 0x49, 0xa3, 0xd7, 0x09, 0xcd, + 0x78, 0x8c, 0x37, 0xc9, 0xb1, 0x1c, 0x89, 0xc8, 0x97, 0x71, 0x0d, 0xed, 0xa1, 0xfd, 0xcd, 0x6e, + 0xed, 0xd7, 0xf7, 0x83, 0x8a, 0xf6, 0xf2, 0x74, 0x38, 0x8c, 0x28, 0xc0, 0x2b, 0x19, 0xf9, 0x01, + 0xf3, 0x2e, 0xa9, 0x46, 0x05, 0x6f, 0x0c, 0x69, 0x20, 0x78, 0x6d, 0xed, 0xa2, 0xc7, 0x53, 0xc0, + 0xb8, 0x8b, 0xcb, 0x4a, 0xbe, 0xb6, 0x9e, 0x94, 0x35, 0xea, 0xb4, 0x3e, 0xcd, 0x27, 0xcd, 0xcb, + 0xee, 0xcf, 0xf3, 0x49, 0xb3, 0x9e, 0xfa, 0xcc, 0x79, 0xb2, 0x1b, 0xb8, 0x9e, 0x2b, 0x7a, 0x14, + 0x42, 0x11, 0x00, 0xb5, 0xbf, 0x22, 0xbc, 0xd3, 0x03, 0xf6, 0x8c, 0x46, 0xd7, 0x18, 0xa4, 0xe3, + 0xe4, 0x0d, 0x37, 0x16, 0x0c, 0x2f, 0xab, 0xdb, 0xf7, 0x70, 0x63, 0x45, 0x39, 0x33, 0xfd, 0x03, + 0xe1, 0x3b, 0x3d, 0x60, 0x6f, 0xc2, 0x21, 0x91, 0xf4, 0x65, 0xb2, 0x15, 0xe3, 0x79, 0xde, 0x70, + 0xeb, 0xef, 0xf9, 0xee, 0x56, 0x4c, 0xf8, 0xb8, 0x63, 0x67, 0x47, 0x76, 0x91, 0x10, 0x4f, 0x70, + 0x59, 0xed, 0x3a, 0x49, 0x71, 0xf3, 0xb0, 0xe1, 0xac, 0xb8, 0x80, 0x8e, 0x12, 0xee, 0xde, 0x38, + 0x3d, 0xdf, 0x2d, 0x79, 0xba, 0xa1, 0xd3, 0xcc, 0x27, 0xad, 0x2e, 0x24, 0x5d, 0xb4, 0x6c, 0xd7, + 0x71, 0x75, 0xa9, 0x94, 0x26, 0x3c, 0xfc, 0xb9, 0x86, 0xd7, 0x7b, 0xc0, 0x8c, 0x11, 0xbe, 0xbd, + 0x74, 0xc3, 0x1e, 0xac, 0xf4, 0x92, 0x5b, 0xb0, 0xe9, 0x14, 0xe3, 0xa5, 0x8a, 0x46, 0x80, 0xb7, + 0x72, 0x97, 0x60, 0xff, 0xaa, 0x19, 0xcb, 0x4c, 0xf3, 0x61, 0x51, 0x66, 0xa6, 0xd7, 0xc7, 0xb7, + 0xfe, 0xdb, 0xdf, 0xfd, 0xab, 0x26, 0x2c, 0xb2, 0xcc, 0x56, 0x11, 0x56, 0xaa, 0x61, 0x6e, 0x7c, + 0x9c, 0x4f, 0x9a, 0xa8, 0xfb, 0xe2, 0x74, 0x6a, 0xa1, 0xb3, 0xa9, 0x85, 0xfe, 0x4c, 0x2d, 0xf4, + 0x65, 0x66, 0x95, 0xce, 0x66, 0x56, 0xe9, 0xf7, 0xcc, 0x2a, 0xbd, 0x6d, 0x33, 0x5f, 0x8e, 0x8e, + 0xfb, 0xce, 0x40, 0x70, 0x37, 0x1d, 0x7c, 0x30, 0x26, 0x7d, 0xc8, 0x90, 0xfb, 0x21, 0xfb, 0x03, + 0xc8, 0x38, 0xa4, 0xd0, 0x2f, 0x27, 0x9f, 0xff, 0xa3, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x2f, + 0x40, 0xf1, 0x73, 0xb8, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + RegisterTicker(ctx context.Context, in *MsgRegisterTicker, opts ...grpc.CallOption) (*MsgRegisterTickerResponse, error) + DeregisterTicker(ctx context.Context, in *MsgDeregisterTicker, opts ...grpc.CallOption) (*MsgDeregisterTickerResponse, error) + // UpdateParams defines a (governance) operation for updating the module + // parameters. + // The authority defaults to the x/gov module account. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) RegisterTicker(ctx context.Context, in *MsgRegisterTicker, opts ...grpc.CallOption) (*MsgRegisterTickerResponse, error) { + out := new(MsgRegisterTickerResponse) + err := c.cc.Invoke(ctx, "/milkyway.tickers.v1.Msg/RegisterTicker", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DeregisterTicker(ctx context.Context, in *MsgDeregisterTicker, opts ...grpc.CallOption) (*MsgDeregisterTickerResponse, error) { + out := new(MsgDeregisterTickerResponse) + err := c.cc.Invoke(ctx, "/milkyway.tickers.v1.Msg/DeregisterTicker", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/milkyway.tickers.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + RegisterTicker(context.Context, *MsgRegisterTicker) (*MsgRegisterTickerResponse, error) + DeregisterTicker(context.Context, *MsgDeregisterTicker) (*MsgDeregisterTickerResponse, error) + // UpdateParams defines a (governance) operation for updating the module + // parameters. + // The authority defaults to the x/gov module account. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) RegisterTicker(ctx context.Context, req *MsgRegisterTicker) (*MsgRegisterTickerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterTicker not implemented") +} +func (*UnimplementedMsgServer) DeregisterTicker(ctx context.Context, req *MsgDeregisterTicker) (*MsgDeregisterTickerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeregisterTicker not implemented") +} +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_RegisterTicker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterTicker) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterTicker(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.tickers.v1.Msg/RegisterTicker", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterTicker(ctx, req.(*MsgRegisterTicker)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DeregisterTicker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeregisterTicker) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeregisterTicker(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.tickers.v1.Msg/DeregisterTicker", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeregisterTicker(ctx, req.(*MsgDeregisterTicker)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.tickers.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "milkyway.tickers.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterTicker", + Handler: _Msg_RegisterTicker_Handler, + }, + { + MethodName: "DeregisterTicker", + Handler: _Msg_DeregisterTicker_Handler, + }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "milkyway/tickers/v1/messages.proto", +} + +func (m *MsgRegisterTicker) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterTicker) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterTicker) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Ticker) > 0 { + i -= len(m.Ticker) + copy(dAtA[i:], m.Ticker) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Ticker))) + i-- + dAtA[i] = 0x1a + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterTickerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterTickerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterTickerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDeregisterTicker) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDeregisterTicker) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeregisterTicker) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDeregisterTickerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDeregisterTickerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeregisterTickerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMessages(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintMessages(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintMessages(dAtA []byte, offset int, v uint64) int { + offset -= sovMessages(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgRegisterTicker) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + l = len(m.Ticker) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + return n +} + +func (m *MsgRegisterTickerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeregisterTicker) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + return n +} + +func (m *MsgDeregisterTickerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovMessages(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovMessages(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovMessages(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMessages(x uint64) (n int) { + return sovMessages(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgRegisterTicker) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterTicker: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterTicker: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ticker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterTickerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterTickerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterTickerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeregisterTicker) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeregisterTicker: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeregisterTicker: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDeregisterTickerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeregisterTickerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeregisterTickerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMessages + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMessages + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMessages + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipMessages(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMessages + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMessages(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMessages + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMessages + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMessages + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthMessages + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMessages + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMessages + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMessages = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMessages = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMessages = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/tickers/types/models.pb.go b/x/tickers/types/models.pb.go new file mode 100644 index 00000000..c07ab0ac --- /dev/null +++ b/x/tickers/types/models.pb.go @@ -0,0 +1,37 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: milkyway/tickers/v1/models.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("milkyway/tickers/v1/models.proto", fileDescriptor_2bfa7eea6b576fb0) } + +var fileDescriptor_2bfa7eea6b576fb0 = []byte{ + // 144 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0xcd, 0xcc, 0xc9, + 0xae, 0x2c, 0x4f, 0xac, 0xd4, 0x2f, 0xc9, 0x4c, 0xce, 0x4e, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0xd4, + 0xcf, 0xcd, 0x4f, 0x49, 0xcd, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xa9, + 0xd0, 0x83, 0xaa, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, 0x83, + 0x58, 0x10, 0xa5, 0x4e, 0xde, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, + 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, + 0x98, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x33, 0x4f, 0x37, 0x27, + 0x31, 0xa9, 0x18, 0xce, 0xd3, 0xaf, 0x80, 0xbb, 0xa0, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, + 0x6c, 0xa6, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xbb, 0xe2, 0xf3, 0x36, 0xa2, 0x00, 0x00, 0x00, +} diff --git a/x/tickers/types/params.go b/x/tickers/types/params.go new file mode 100644 index 00000000..6a610796 --- /dev/null +++ b/x/tickers/types/params.go @@ -0,0 +1,16 @@ +package types + +// NewParams creates a new Params object +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return Params{} +} + +// Validate checks that the parameters have valid values. +func (p *Params) Validate() error { + return nil +} diff --git a/x/tickers/types/params.pb.go b/x/tickers/types/params.pb.go new file mode 100644 index 00000000..b7f8f2a4 --- /dev/null +++ b/x/tickers/types/params.pb.go @@ -0,0 +1,269 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: milkyway/tickers/v1/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_588e07b884040c49, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Params)(nil), "milkyway.tickers.v1.Params") +} + +func init() { proto.RegisterFile("milkyway/tickers/v1/params.proto", fileDescriptor_588e07b884040c49) } + +var fileDescriptor_588e07b884040c49 = []byte{ + // 189 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0xcd, 0xcc, 0xc9, + 0xae, 0x2c, 0x4f, 0xac, 0xd4, 0x2f, 0xc9, 0x4c, 0xce, 0x4e, 0x2d, 0x2a, 0xd6, 0x2f, 0x33, 0xd4, + 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xa9, + 0xd0, 0x83, 0xaa, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, 0x83, + 0x58, 0x10, 0xa5, 0x52, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x10, 0x09, 0x08, 0x07, + 0x2a, 0x25, 0x07, 0xe1, 0xe9, 0x27, 0x25, 0x16, 0xa7, 0xea, 0x97, 0x19, 0x26, 0xa5, 0x96, 0x24, + 0x1a, 0xea, 0x27, 0xe7, 0x67, 0xe6, 0x41, 0xe4, 0x95, 0x38, 0xb8, 0xd8, 0x02, 0xc0, 0xb6, 0x3a, + 0x79, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, + 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x61, 0x7a, 0x66, 0x49, + 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xcc, 0x51, 0xba, 0x39, 0x89, 0x49, 0xc5, 0x70, + 0x9e, 0x7e, 0x05, 0xdc, 0x1b, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xd3, 0x8d, 0x01, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x2e, 0x6f, 0x78, 0x2e, 0xe7, 0x00, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/tickers/types/query.pb.go b/x/tickers/types/query.pb.go new file mode 100644 index 00000000..d5efc939 --- /dev/null +++ b/x/tickers/types/query.pb.go @@ -0,0 +1,1425 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: milkyway/tickers/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_92da30624cf2f87c, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_92da30624cf2f87c, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryTickerRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryTickerRequest) Reset() { *m = QueryTickerRequest{} } +func (m *QueryTickerRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTickerRequest) ProtoMessage() {} +func (*QueryTickerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_92da30624cf2f87c, []int{2} +} +func (m *QueryTickerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTickerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTickerRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTickerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTickerRequest.Merge(m, src) +} +func (m *QueryTickerRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTickerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTickerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTickerRequest proto.InternalMessageInfo + +func (m *QueryTickerRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +type QueryTickerResponse struct { + Ticker string `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker,omitempty"` +} + +func (m *QueryTickerResponse) Reset() { *m = QueryTickerResponse{} } +func (m *QueryTickerResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTickerResponse) ProtoMessage() {} +func (*QueryTickerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_92da30624cf2f87c, []int{3} +} +func (m *QueryTickerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTickerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTickerResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTickerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTickerResponse.Merge(m, src) +} +func (m *QueryTickerResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTickerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTickerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTickerResponse proto.InternalMessageInfo + +func (m *QueryTickerResponse) GetTicker() string { + if m != nil { + return m.Ticker + } + return "" +} + +type QueryDenomsRequest struct { + Ticker string `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDenomsRequest) Reset() { *m = QueryDenomsRequest{} } +func (m *QueryDenomsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDenomsRequest) ProtoMessage() {} +func (*QueryDenomsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_92da30624cf2f87c, []int{4} +} +func (m *QueryDenomsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDenomsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDenomsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryDenomsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDenomsRequest.Merge(m, src) +} +func (m *QueryDenomsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDenomsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDenomsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDenomsRequest proto.InternalMessageInfo + +func (m *QueryDenomsRequest) GetTicker() string { + if m != nil { + return m.Ticker + } + return "" +} + +func (m *QueryDenomsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryDenomsResponse struct { + Denoms []string `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDenomsResponse) Reset() { *m = QueryDenomsResponse{} } +func (m *QueryDenomsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDenomsResponse) ProtoMessage() {} +func (*QueryDenomsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_92da30624cf2f87c, []int{5} +} +func (m *QueryDenomsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDenomsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDenomsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryDenomsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDenomsResponse.Merge(m, src) +} +func (m *QueryDenomsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDenomsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDenomsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDenomsResponse proto.InternalMessageInfo + +func (m *QueryDenomsResponse) GetDenoms() []string { + if m != nil { + return m.Denoms + } + return nil +} + +func (m *QueryDenomsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "milkyway.tickers.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "milkyway.tickers.v1.QueryParamsResponse") + proto.RegisterType((*QueryTickerRequest)(nil), "milkyway.tickers.v1.QueryTickerRequest") + proto.RegisterType((*QueryTickerResponse)(nil), "milkyway.tickers.v1.QueryTickerResponse") + proto.RegisterType((*QueryDenomsRequest)(nil), "milkyway.tickers.v1.QueryDenomsRequest") + proto.RegisterType((*QueryDenomsResponse)(nil), "milkyway.tickers.v1.QueryDenomsResponse") +} + +func init() { proto.RegisterFile("milkyway/tickers/v1/query.proto", fileDescriptor_92da30624cf2f87c) } + +var fileDescriptor_92da30624cf2f87c = []byte{ + // 472 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x41, 0x6b, 0xd4, 0x40, + 0x18, 0x4d, 0x5a, 0x1b, 0x70, 0xbc, 0x4d, 0x17, 0x29, 0x5b, 0x4d, 0xcb, 0x28, 0x6d, 0x29, 0x76, + 0x86, 0xd4, 0x93, 0xd7, 0x22, 0x7a, 0xf0, 0xb2, 0x06, 0x4f, 0xde, 0x26, 0xeb, 0x10, 0x43, 0x37, + 0x99, 0x34, 0x33, 0x1b, 0x0d, 0xa5, 0x20, 0xde, 0xbc, 0x09, 0xfe, 0x03, 0x7f, 0x4d, 0x8f, 0x05, + 0x2f, 0x9e, 0x44, 0x76, 0xfd, 0x21, 0x92, 0xf9, 0x26, 0xdd, 0x0d, 0xcd, 0x66, 0x6f, 0x99, 0xc9, + 0xfb, 0xde, 0x7b, 0xdf, 0x7b, 0x09, 0xda, 0x4b, 0x93, 0xc9, 0x79, 0xf5, 0x89, 0x57, 0x4c, 0x27, + 0xe3, 0x73, 0x51, 0x28, 0x56, 0x06, 0xec, 0x62, 0x2a, 0x8a, 0x8a, 0xe6, 0x85, 0xd4, 0x12, 0x6f, + 0x37, 0x00, 0x6a, 0x01, 0xb4, 0x0c, 0x86, 0x83, 0x58, 0xc6, 0xd2, 0xbc, 0x67, 0xf5, 0x13, 0x40, + 0x87, 0x8f, 0x62, 0x29, 0xe3, 0x89, 0x60, 0x3c, 0x4f, 0x18, 0xcf, 0x32, 0xa9, 0xb9, 0x4e, 0x64, + 0xa6, 0xec, 0xdb, 0xe3, 0xb1, 0x54, 0xa9, 0x54, 0x2c, 0xe2, 0x4a, 0x80, 0x02, 0x2b, 0x83, 0x48, + 0x68, 0x1e, 0xb0, 0x9c, 0xc7, 0x49, 0x66, 0xc0, 0x16, 0xbb, 0xdf, 0xe5, 0x2a, 0xe7, 0x05, 0x4f, + 0x2d, 0x1b, 0x19, 0x20, 0xfc, 0xb6, 0xe6, 0x18, 0x99, 0xcb, 0x50, 0x5c, 0x4c, 0x85, 0xd2, 0x64, + 0x84, 0xb6, 0x5b, 0xb7, 0x2a, 0x97, 0x99, 0x12, 0xf8, 0x05, 0xf2, 0x60, 0x78, 0xc7, 0xdd, 0x77, + 0x8f, 0x1e, 0x9c, 0xee, 0xd2, 0x8e, 0xa5, 0x28, 0x0c, 0x9d, 0xdd, 0xbb, 0xfe, 0xb3, 0xe7, 0x84, + 0x76, 0x80, 0x1c, 0x5b, 0x9d, 0x77, 0x06, 0x67, 0x75, 0xf0, 0x00, 0x6d, 0x7d, 0x10, 0x99, 0x4c, + 0x0d, 0xdf, 0xfd, 0x10, 0x0e, 0xe4, 0xc4, 0xaa, 0x37, 0x58, 0xab, 0xfe, 0x10, 0x79, 0xa0, 0x62, + 0xd1, 0xf6, 0x44, 0xb4, 0xa5, 0x7e, 0x59, 0x0f, 0x37, 0x2b, 0xac, 0x42, 0xe3, 0x57, 0x08, 0x2d, + 0x62, 0xda, 0xd9, 0x30, 0x7b, 0x1c, 0x50, 0xc8, 0x94, 0xd6, 0x99, 0x52, 0x68, 0xcd, 0x66, 0x4a, + 0x47, 0x3c, 0x16, 0x96, 0x33, 0x5c, 0x9a, 0x24, 0xa5, 0x35, 0xd9, 0xa8, 0x2e, 0x4c, 0x9a, 0x25, + 0xea, 0x88, 0x36, 0x6b, 0x59, 0x38, 0xe1, 0xd7, 0x1d, 0xb2, 0x87, 0x6b, 0x65, 0x81, 0x74, 0x59, + 0xf7, 0xf4, 0xe7, 0x26, 0xda, 0x32, 0xc2, 0xf8, 0x8b, 0x8b, 0x3c, 0xc8, 0x1a, 0x1f, 0x76, 0x16, + 0x71, 0xb7, 0xd8, 0xe1, 0xd1, 0x7a, 0x20, 0x68, 0x92, 0x27, 0x5f, 0x7f, 0xfd, 0xfb, 0xb1, 0xf1, + 0x18, 0xef, 0xb2, 0xd5, 0xdf, 0x10, 0xfe, 0xe6, 0x22, 0x0f, 0x5a, 0xea, 0xb3, 0xd0, 0xea, 0xbc, + 0xcf, 0x42, 0xbb, 0x70, 0xf2, 0xcc, 0x58, 0x38, 0xc0, 0x4f, 0x3b, 0x2d, 0x34, 0x8f, 0x97, 0x26, + 0xe1, 0x2b, 0xe3, 0x05, 0xca, 0xe8, 0xf3, 0xd2, 0xfa, 0x48, 0xfa, 0xbc, 0xb4, 0x7b, 0x5d, 0xe3, + 0x05, 0x4a, 0x66, 0x97, 0x70, 0x75, 0x75, 0xf6, 0xe6, 0x7a, 0xe6, 0xbb, 0x37, 0x33, 0xdf, 0xfd, + 0x3b, 0xf3, 0xdd, 0xef, 0x73, 0xdf, 0xb9, 0x99, 0xfb, 0xce, 0xef, 0xb9, 0xef, 0xbc, 0x0f, 0xe2, + 0x44, 0x7f, 0x9c, 0x46, 0x74, 0x2c, 0xd3, 0x5b, 0xa6, 0x93, 0x09, 0x8f, 0xd4, 0x82, 0xf7, 0xf3, + 0x2d, 0xb3, 0xae, 0x72, 0xa1, 0x22, 0xcf, 0xfc, 0xa9, 0xcf, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, + 0x93, 0xeb, 0x52, 0xc4, 0x63, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// 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. +type QueryClient interface { + // Params defines a gRPC query method that returns the parameters of the + // module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + Ticker(ctx context.Context, in *QueryTickerRequest, opts ...grpc.CallOption) (*QueryTickerResponse, error) + Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/milkyway.tickers.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Ticker(ctx context.Context, in *QueryTickerRequest, opts ...grpc.CallOption) (*QueryTickerResponse, error) { + out := new(QueryTickerResponse) + err := c.cc.Invoke(ctx, "/milkyway.tickers.v1.Query/Ticker", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) { + out := new(QueryDenomsResponse) + err := c.cc.Invoke(ctx, "/milkyway.tickers.v1.Query/Denoms", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params defines a gRPC query method that returns the parameters of the + // module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + Ticker(context.Context, *QueryTickerRequest) (*QueryTickerResponse, error) + Denoms(context.Context, *QueryDenomsRequest) (*QueryDenomsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Ticker(ctx context.Context, req *QueryTickerRequest) (*QueryTickerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ticker not implemented") +} +func (*UnimplementedQueryServer) Denoms(ctx context.Context, req *QueryDenomsRequest) (*QueryDenomsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Denoms not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.tickers.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Ticker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTickerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Ticker(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.tickers.v1.Query/Ticker", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Ticker(ctx, req.(*QueryTickerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Denoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDenomsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Denoms(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/milkyway.tickers.v1.Query/Denoms", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Denoms(ctx, req.(*QueryDenomsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "milkyway.tickers.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Ticker", + Handler: _Query_Ticker_Handler, + }, + { + MethodName: "Denoms", + Handler: _Query_Denoms_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "milkyway/tickers/v1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTickerRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTickerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTickerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTickerResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTickerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTickerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Ticker) > 0 { + i -= len(m.Ticker) + copy(dAtA[i:], m.Ticker) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Ticker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDenomsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDenomsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDenomsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Ticker) > 0 { + i -= len(m.Ticker) + copy(dAtA[i:], m.Ticker) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Ticker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDenomsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryDenomsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDenomsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Denoms) > 0 { + for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denoms[iNdEx]) + copy(dAtA[i:], m.Denoms[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denoms[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTickerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTickerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Ticker) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDenomsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Ticker) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDenomsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Denoms) > 0 { + for _, s := range m.Denoms { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTickerRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTickerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTickerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTickerResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTickerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTickerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ticker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDenomsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryDenomsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ticker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDenomsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryDenomsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/tickers/types/query.pb.gw.go b/x/tickers/types/query.pb.gw.go new file mode 100644 index 00000000..5aafb05b --- /dev/null +++ b/x/tickers/types/query.pb.gw.go @@ -0,0 +1,373 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: milkyway/tickers/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Ticker_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTickerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := client.Ticker(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Ticker_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTickerRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + } + + msg, err := server.Ticker(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Denoms_0 = &utilities.DoubleArray{Encoding: map[string]int{"ticker": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_Denoms_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["ticker"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "ticker") + } + + protoReq.Ticker, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ticker", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Denoms_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Denoms(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Denoms_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["ticker"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "ticker") + } + + protoReq.Ticker, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "ticker", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Denoms_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Denoms(ctx, &protoReq) + return msg, metadata, err + +} + +// 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 RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Ticker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Ticker_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Ticker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Denoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Denoms_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Denoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// 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 RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Ticker_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Ticker_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Ticker_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Denoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Denoms_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Denoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"milkyway", "tickers", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Ticker_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"milkyway", "tickers", "v1", "denom"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Denoms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"milkyway", "tickers", "v1", "denoms", "ticker"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Ticker_0 = runtime.ForwardResponseMessage + + forward_Query_Denoms_0 = runtime.ForwardResponseMessage +)