From 1f4cdd3b20a489ccb45639e67b5760b0d39b5b88 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 22 Nov 2022 15:01:10 -0500 Subject: [PATCH 1/2] feat(CL): swaprouter code gen (merge to `main`) --- .../osmosis/swaprouter/v1beta1/genesis.proto | 27 + .../swaprouter/v1beta1/module_route.proto | 29 + proto/osmosis/swaprouter/v1beta1/query.proto | 89 + proto/osmosis/swaprouter/v1beta1/query.yml | 25 + proto/osmosis/swaprouter/v1beta1/tx.proto | 72 + x/swaprouter/client/grpc/grpc_query.go | 62 + x/swaprouter/client/query_proto_wrap.go | 49 + x/swaprouter/client/queryproto/query.pb.go | 1931 +++++++++++++++++ x/swaprouter/client/queryproto/query.pb.gw.go | 456 ++++ x/swaprouter/types/genesis.pb.go | 558 +++++ x/swaprouter/types/module_route.pb.go | 348 +++ x/swaprouter/types/tx.pb.go | 1710 +++++++++++++++ 12 files changed, 5356 insertions(+) create mode 100644 proto/osmosis/swaprouter/v1beta1/genesis.proto create mode 100644 proto/osmosis/swaprouter/v1beta1/module_route.proto create mode 100644 proto/osmosis/swaprouter/v1beta1/query.proto create mode 100644 proto/osmosis/swaprouter/v1beta1/query.yml create mode 100644 proto/osmosis/swaprouter/v1beta1/tx.proto create mode 100644 x/swaprouter/client/grpc/grpc_query.go create mode 100644 x/swaprouter/client/query_proto_wrap.go create mode 100644 x/swaprouter/client/queryproto/query.pb.go create mode 100644 x/swaprouter/client/queryproto/query.pb.gw.go create mode 100644 x/swaprouter/types/genesis.pb.go create mode 100644 x/swaprouter/types/module_route.pb.go create mode 100644 x/swaprouter/types/tx.pb.go diff --git a/proto/osmosis/swaprouter/v1beta1/genesis.proto b/proto/osmosis/swaprouter/v1beta1/genesis.proto new file mode 100644 index 00000000000..1fa396ff77e --- /dev/null +++ b/proto/osmosis/swaprouter/v1beta1/genesis.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package osmosis.swaprouter.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/duration.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v13/x/swaprouter/types"; + +// Params holds parameters for the swaprouter module +message Params { + repeated cosmos.base.v1beta1.Coin pool_creation_fee = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"pool_creation_fee\"", + (gogoproto.nullable) = false + ]; +} + +// GenesisState defines the swaprouter module's genesis state. +message GenesisState { + // the next_pool_id + uint64 next_pool_id = 1; + // params is the container of swaprouter parameters. + Params params = 2 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/osmosis/swaprouter/v1beta1/module_route.proto b/proto/osmosis/swaprouter/v1beta1/module_route.proto new file mode 100644 index 00000000000..76817f53246 --- /dev/null +++ b/proto/osmosis/swaprouter/v1beta1/module_route.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package osmosis.swaprouter.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v13/x/swaprouter/types"; + +// PoolType is an enumeration of all supported pool types. +enum PoolType { + option (gogoproto.goproto_enum_prefix) = false; + + // Balancer is the standard xy=k curve. Its pool model is defined in x/gamm. + Balancer = 0; + // Stableswap is the Solidly cfmm stable swap curve. Its pool model is defined + // in x/gamm. + StableSwap = 1; + // Concentrated is the pool model specific to concentrated liquidity. It is + // defined in x/concentrated-liquidity. + Concentrated = 2; +} + +// ModuleRouter defines a route encapsulating pool type. +// It is used as the value of a mapping from pool id to the pool type, +// allowing the swap router to know which module to route swaps to given the +// pool id. +message ModuleRoute { + // pool_type specifies the type of the pool + PoolType pool_type = 1; +} diff --git a/proto/osmosis/swaprouter/v1beta1/query.proto b/proto/osmosis/swaprouter/v1beta1/query.proto new file mode 100644 index 00000000000..721f26da686 --- /dev/null +++ b/proto/osmosis/swaprouter/v1beta1/query.proto @@ -0,0 +1,89 @@ +syntax = "proto3"; +package osmosis.swaprouter.v1beta1; + +import "gogoproto/gogo.proto"; +import "osmosis/swaprouter/v1beta1/genesis.proto"; +import "osmosis/swaprouter/v1beta1/tx.proto"; + +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v13/x/swaprouter/client/queryproto"; + +service Query { + rpc Params(ParamsRequest) returns (ParamsResponse) { + option (google.api.http).get = "/osmosis/swaprouter/v1beta1/Params"; + } + + // Estimates swap amount out given in. + rpc EstimateSwapExactAmountIn(EstimateSwapExactAmountInRequest) + returns (EstimateSwapExactAmountInResponse) { + option (google.api.http).get = + "/osmosis/gamm/v1beta1/{pool_id}/estimate/swap_exact_amount_in"; + } + + // Estimates swap amount in given out. + rpc EstimateSwapExactAmountOut(EstimateSwapExactAmountOutRequest) + returns (EstimateSwapExactAmountOutResponse) { + option (google.api.http).get = + "/osmosis/gamm/v1beta1/{pool_id}/estimate/swap_exact_amount_out"; + } + + rpc NumPools(NumPoolsRequest) returns (NumPoolsResponse) { + option (google.api.http).get = "/osmosis/swaprouter/v1beta1/num_pools"; + } +} + +//=============================== Params +message ParamsRequest {} +message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } + +//=============================== EstimateSwapExactAmountIn +message EstimateSwapExactAmountInRequest { + // TODO: CHANGE THIS TO RESERVED IN A PATCH RELEASE + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string token_in = 3 [ (gogoproto.moretags) = "yaml:\"token_in\"" ]; + repeated SwapAmountInRoute routes = 4 [ + (gogoproto.moretags) = "yaml:\"routes\"", + (gogoproto.nullable) = false + ]; +} + +message EstimateSwapExactAmountInResponse { + string token_out_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_out_amount\"", + (gogoproto.nullable) = false + ]; +} + +//=============================== EstimateSwapExactAmountOut +message EstimateSwapExactAmountOutRequest { + // TODO: CHANGE THIS TO RESERVED IN A PATCH RELEASE + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + repeated SwapAmountOutRoute routes = 3 [ + (gogoproto.moretags) = "yaml:\"routes\"", + (gogoproto.nullable) = false + ]; + string token_out = 4 [ (gogoproto.moretags) = "yaml:\"token_out\"" ]; +} + +message EstimateSwapExactAmountOutResponse { + string token_in_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_in_amount\"", + (gogoproto.nullable) = false + ]; +} + +//=============================== NumPools +message NumPoolsRequest {} +message NumPoolsResponse { + uint64 num_pools = 1 [ (gogoproto.moretags) = "yaml:\"num_pools\"" ]; +} diff --git a/proto/osmosis/swaprouter/v1beta1/query.yml b/proto/osmosis/swaprouter/v1beta1/query.yml new file mode 100644 index 00000000000..49a084ab39b --- /dev/null +++ b/proto/osmosis/swaprouter/v1beta1/query.yml @@ -0,0 +1,25 @@ +keeper: + path: "github.com/osmosis-labs/osmosis/v13/x/swaprouter" + struct: "Keeper" +client_path: "github.com/osmosis-labs/osmosis/v13/x/swaprouter/client" +queries: + Params: + proto_wrapper: + query_func: "k.GetParams" + cli: + cmd: "GetParams" + EstimateSwapExactAmountIn: + proto_wrapper: + query_func: "k.EstimateSwapExactAmountIn" + cli: + cmd: "EstimateSwapExactAmountIn" + EstimateSwapExactAmountOut: + proto_wrapper: + query_func: "k.EstimateSwapExactAmountOut" + cli: + cmd: "EstimateSwapExactAmountOut" + NumPools: + proto_wrapper: + query_func: "k.NumPools" + cli: + cmd: "NumPools" diff --git a/proto/osmosis/swaprouter/v1beta1/tx.proto b/proto/osmosis/swaprouter/v1beta1/tx.proto new file mode 100644 index 00000000000..3aeab8eb6f4 --- /dev/null +++ b/proto/osmosis/swaprouter/v1beta1/tx.proto @@ -0,0 +1,72 @@ +syntax = "proto3"; +package osmosis.swaprouter.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v13/x/swaprouter/types"; + +service Msg { + rpc SwapExactAmountIn(MsgSwapExactAmountIn) + returns (MsgSwapExactAmountInResponse); + rpc SwapExactAmountOut(MsgSwapExactAmountOut) + returns (MsgSwapExactAmountOutResponse); +} + +// ===================== MsgSwapExactAmountIn +message SwapAmountInRoute { + uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string token_out_denom = 2 + [ (gogoproto.moretags) = "yaml:\"token_out_denom\"" ]; +} + +message MsgSwapExactAmountIn { + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + repeated SwapAmountInRoute routes = 2 [ (gogoproto.nullable) = false ]; + cosmos.base.v1beta1.Coin token_in = 3 [ + (gogoproto.moretags) = "yaml:\"token_in\"", + (gogoproto.nullable) = false + ]; + string token_out_min_amount = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_out_min_amount\"", + (gogoproto.nullable) = false + ]; +} + +message MsgSwapExactAmountInResponse { + string token_out_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_out_amount\"", + (gogoproto.nullable) = false + ]; +} + +// ===================== MsgSwapExactAmountOut +message SwapAmountOutRoute { + uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ]; + string token_in_denom = 2 + [ (gogoproto.moretags) = "yaml:\"token_out_denom\"" ]; +} + +message MsgSwapExactAmountOut { + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + repeated SwapAmountOutRoute routes = 2 [ (gogoproto.nullable) = false ]; + string token_in_max_amount = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_in_max_amount\"", + (gogoproto.nullable) = false + ]; + cosmos.base.v1beta1.Coin token_out = 4 [ + (gogoproto.moretags) = "yaml:\"token_out\"", + (gogoproto.nullable) = false + ]; +} + +message MsgSwapExactAmountOutResponse { + string token_in_amount = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"token_in_amount\"", + (gogoproto.nullable) = false + ]; +} diff --git a/x/swaprouter/client/grpc/grpc_query.go b/x/swaprouter/client/grpc/grpc_query.go new file mode 100644 index 00000000000..3b6f67f0d71 --- /dev/null +++ b/x/swaprouter/client/grpc/grpc_query.go @@ -0,0 +1,62 @@ +package grpc + +// THIS FILE IS GENERATED CODE, DO NOT EDIT +// SOURCE AT `proto/osmosis/swaprouter/v1beta1/query.yml` + +import ( + context "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/osmosis-labs/osmosis/v13/x/swaprouter/client" + "github.com/osmosis-labs/osmosis/v13/x/swaprouter/client/queryproto" +) + +type Querier struct { + Q client.Querier +} + +var _ queryproto.QueryServer = Querier{} + +func (q Querier) Params(grpcCtx context.Context, + req *queryproto.ParamsRequest, +) (*queryproto.ParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(grpcCtx) + return q.Q.Params(ctx, *req) +} + +func (q Querier) NumPools(grpcCtx context.Context, + req *queryproto.NumPoolsRequest, +) (*queryproto.NumPoolsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(grpcCtx) + return q.Q.NumPools(ctx, *req) +} + +func (q Querier) EstimateSwapExactAmountOut(grpcCtx context.Context, + req *queryproto.EstimateSwapExactAmountOutRequest, +) (*queryproto.EstimateSwapExactAmountOutResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(grpcCtx) + return q.Q.EstimateSwapExactAmountOut(ctx, *req) +} + +func (q Querier) EstimateSwapExactAmountIn(grpcCtx context.Context, + req *queryproto.EstimateSwapExactAmountInRequest, +) (*queryproto.EstimateSwapExactAmountInResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(grpcCtx) + return q.Q.EstimateSwapExactAmountIn(ctx, *req) +} + diff --git a/x/swaprouter/client/query_proto_wrap.go b/x/swaprouter/client/query_proto_wrap.go new file mode 100644 index 00000000000..b75f289a815 --- /dev/null +++ b/x/swaprouter/client/query_proto_wrap.go @@ -0,0 +1,49 @@ +package client + +import ( + "math/big" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/osmosis-labs/osmosis/v13/x/swaprouter/client/queryproto" +) + +// This file should evolve to being code gen'd, off of `proto/swaprouter/v1beta/query.yml` + +type Querier struct { +} + +var sdkIntMaxValue = sdk.NewInt(0) + +func init() { + maxInt := big.NewInt(2) + maxInt = maxInt.Exp(maxInt, big.NewInt(256), nil) + + _sdkIntMaxValue, ok := sdk.NewIntFromString(maxInt.Sub(maxInt, big.NewInt(1)).String()) + if !ok { + panic("Failed to calculate the max value of sdk.Int") + } + + sdkIntMaxValue = _sdkIntMaxValue +} + +func (q Querier) Params(ctx sdk.Context, + req queryproto.ParamsRequest, +) (*queryproto.ParamsResponse, error) { + panic("not implemented") +} + +// EstimateSwapExactAmountIn estimates input token amount for a swap. +func (q Querier) EstimateSwapExactAmountIn(ctx sdk.Context, req queryproto.EstimateSwapExactAmountInRequest) (*queryproto.EstimateSwapExactAmountInResponse, error) { + panic("not implemented") +} + +// EstimateSwapExactAmountOut estimates token output amount for a swap. +func (q Querier) EstimateSwapExactAmountOut(ctx sdk.Context, req queryproto.EstimateSwapExactAmountOutRequest) (*queryproto.EstimateSwapExactAmountOutResponse, error) { + panic("not implemented") +} + +// NumPools returns total number of pools. +func (q Querier) NumPools(ctx sdk.Context, _ queryproto.NumPoolsRequest) (*queryproto.NumPoolsResponse, error) { + panic("not implemented") +} diff --git a/x/swaprouter/client/queryproto/query.pb.go b/x/swaprouter/client/queryproto/query.pb.go new file mode 100644 index 00000000000..3db4cd56998 --- /dev/null +++ b/x/swaprouter/client/queryproto/query.pb.go @@ -0,0 +1,1931 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/swaprouter/v1beta1/query.proto + +package queryproto + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + types "github.com/osmosis-labs/osmosis/v13/x/swaprouter/types" + _ "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 + +// =============================== Params +type ParamsRequest struct { +} + +func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } +func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } +func (*ParamsRequest) ProtoMessage() {} +func (*ParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4d9de31afe32e1e0, []int{0} +} +func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParamsRequest.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 *ParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamsRequest.Merge(m, src) +} +func (m *ParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *ParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo + +type ParamsResponse struct { + Params types.Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } +func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } +func (*ParamsResponse) ProtoMessage() {} +func (*ParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4d9de31afe32e1e0, []int{1} +} +func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParamsResponse.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 *ParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamsResponse.Merge(m, src) +} +func (m *ParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *ParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo + +func (m *ParamsResponse) GetParams() types.Params { + if m != nil { + return m.Params + } + return types.Params{} +} + +// =============================== EstimateSwapExactAmountIn +type EstimateSwapExactAmountInRequest struct { + // TODO: CHANGE THIS TO RESERVED IN A PATCH RELEASE + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"` + TokenIn string `protobuf:"bytes,3,opt,name=token_in,json=tokenIn,proto3" json:"token_in,omitempty" yaml:"token_in"` + Routes []types.SwapAmountInRoute `protobuf:"bytes,4,rep,name=routes,proto3" json:"routes" yaml:"routes"` +} + +func (m *EstimateSwapExactAmountInRequest) Reset() { *m = EstimateSwapExactAmountInRequest{} } +func (m *EstimateSwapExactAmountInRequest) String() string { return proto.CompactTextString(m) } +func (*EstimateSwapExactAmountInRequest) ProtoMessage() {} +func (*EstimateSwapExactAmountInRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4d9de31afe32e1e0, []int{2} +} +func (m *EstimateSwapExactAmountInRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EstimateSwapExactAmountInRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EstimateSwapExactAmountInRequest.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 *EstimateSwapExactAmountInRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_EstimateSwapExactAmountInRequest.Merge(m, src) +} +func (m *EstimateSwapExactAmountInRequest) XXX_Size() int { + return m.Size() +} +func (m *EstimateSwapExactAmountInRequest) XXX_DiscardUnknown() { + xxx_messageInfo_EstimateSwapExactAmountInRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_EstimateSwapExactAmountInRequest proto.InternalMessageInfo + +func (m *EstimateSwapExactAmountInRequest) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *EstimateSwapExactAmountInRequest) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *EstimateSwapExactAmountInRequest) GetTokenIn() string { + if m != nil { + return m.TokenIn + } + return "" +} + +func (m *EstimateSwapExactAmountInRequest) GetRoutes() []types.SwapAmountInRoute { + if m != nil { + return m.Routes + } + return nil +} + +type EstimateSwapExactAmountInResponse struct { + TokenOutAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=token_out_amount,json=tokenOutAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_out_amount" yaml:"token_out_amount"` +} + +func (m *EstimateSwapExactAmountInResponse) Reset() { *m = EstimateSwapExactAmountInResponse{} } +func (m *EstimateSwapExactAmountInResponse) String() string { return proto.CompactTextString(m) } +func (*EstimateSwapExactAmountInResponse) ProtoMessage() {} +func (*EstimateSwapExactAmountInResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4d9de31afe32e1e0, []int{3} +} +func (m *EstimateSwapExactAmountInResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EstimateSwapExactAmountInResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EstimateSwapExactAmountInResponse.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 *EstimateSwapExactAmountInResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_EstimateSwapExactAmountInResponse.Merge(m, src) +} +func (m *EstimateSwapExactAmountInResponse) XXX_Size() int { + return m.Size() +} +func (m *EstimateSwapExactAmountInResponse) XXX_DiscardUnknown() { + xxx_messageInfo_EstimateSwapExactAmountInResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_EstimateSwapExactAmountInResponse proto.InternalMessageInfo + +// =============================== EstimateSwapExactAmountOut +type EstimateSwapExactAmountOutRequest struct { + // TODO: CHANGE THIS TO RESERVED IN A PATCH RELEASE + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"` + Routes []types.SwapAmountOutRoute `protobuf:"bytes,3,rep,name=routes,proto3" json:"routes" yaml:"routes"` + TokenOut string `protobuf:"bytes,4,opt,name=token_out,json=tokenOut,proto3" json:"token_out,omitempty" yaml:"token_out"` +} + +func (m *EstimateSwapExactAmountOutRequest) Reset() { *m = EstimateSwapExactAmountOutRequest{} } +func (m *EstimateSwapExactAmountOutRequest) String() string { return proto.CompactTextString(m) } +func (*EstimateSwapExactAmountOutRequest) ProtoMessage() {} +func (*EstimateSwapExactAmountOutRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4d9de31afe32e1e0, []int{4} +} +func (m *EstimateSwapExactAmountOutRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EstimateSwapExactAmountOutRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EstimateSwapExactAmountOutRequest.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 *EstimateSwapExactAmountOutRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_EstimateSwapExactAmountOutRequest.Merge(m, src) +} +func (m *EstimateSwapExactAmountOutRequest) XXX_Size() int { + return m.Size() +} +func (m *EstimateSwapExactAmountOutRequest) XXX_DiscardUnknown() { + xxx_messageInfo_EstimateSwapExactAmountOutRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_EstimateSwapExactAmountOutRequest proto.InternalMessageInfo + +func (m *EstimateSwapExactAmountOutRequest) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *EstimateSwapExactAmountOutRequest) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *EstimateSwapExactAmountOutRequest) GetRoutes() []types.SwapAmountOutRoute { + if m != nil { + return m.Routes + } + return nil +} + +func (m *EstimateSwapExactAmountOutRequest) GetTokenOut() string { + if m != nil { + return m.TokenOut + } + return "" +} + +type EstimateSwapExactAmountOutResponse struct { + TokenInAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=token_in_amount,json=tokenInAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_in_amount" yaml:"token_in_amount"` +} + +func (m *EstimateSwapExactAmountOutResponse) Reset() { *m = EstimateSwapExactAmountOutResponse{} } +func (m *EstimateSwapExactAmountOutResponse) String() string { return proto.CompactTextString(m) } +func (*EstimateSwapExactAmountOutResponse) ProtoMessage() {} +func (*EstimateSwapExactAmountOutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4d9de31afe32e1e0, []int{5} +} +func (m *EstimateSwapExactAmountOutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EstimateSwapExactAmountOutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EstimateSwapExactAmountOutResponse.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 *EstimateSwapExactAmountOutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_EstimateSwapExactAmountOutResponse.Merge(m, src) +} +func (m *EstimateSwapExactAmountOutResponse) XXX_Size() int { + return m.Size() +} +func (m *EstimateSwapExactAmountOutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_EstimateSwapExactAmountOutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_EstimateSwapExactAmountOutResponse proto.InternalMessageInfo + +// =============================== NumPools +type NumPoolsRequest struct { +} + +func (m *NumPoolsRequest) Reset() { *m = NumPoolsRequest{} } +func (m *NumPoolsRequest) String() string { return proto.CompactTextString(m) } +func (*NumPoolsRequest) ProtoMessage() {} +func (*NumPoolsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4d9de31afe32e1e0, []int{6} +} +func (m *NumPoolsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NumPoolsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NumPoolsRequest.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 *NumPoolsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NumPoolsRequest.Merge(m, src) +} +func (m *NumPoolsRequest) XXX_Size() int { + return m.Size() +} +func (m *NumPoolsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NumPoolsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NumPoolsRequest proto.InternalMessageInfo + +type NumPoolsResponse struct { + NumPools uint64 `protobuf:"varint,1,opt,name=num_pools,json=numPools,proto3" json:"num_pools,omitempty" yaml:"num_pools"` +} + +func (m *NumPoolsResponse) Reset() { *m = NumPoolsResponse{} } +func (m *NumPoolsResponse) String() string { return proto.CompactTextString(m) } +func (*NumPoolsResponse) ProtoMessage() {} +func (*NumPoolsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4d9de31afe32e1e0, []int{7} +} +func (m *NumPoolsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NumPoolsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NumPoolsResponse.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 *NumPoolsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NumPoolsResponse.Merge(m, src) +} +func (m *NumPoolsResponse) XXX_Size() int { + return m.Size() +} +func (m *NumPoolsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NumPoolsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NumPoolsResponse proto.InternalMessageInfo + +func (m *NumPoolsResponse) GetNumPools() uint64 { + if m != nil { + return m.NumPools + } + return 0 +} + +func init() { + proto.RegisterType((*ParamsRequest)(nil), "osmosis.swaprouter.v1beta1.ParamsRequest") + proto.RegisterType((*ParamsResponse)(nil), "osmosis.swaprouter.v1beta1.ParamsResponse") + proto.RegisterType((*EstimateSwapExactAmountInRequest)(nil), "osmosis.swaprouter.v1beta1.EstimateSwapExactAmountInRequest") + proto.RegisterType((*EstimateSwapExactAmountInResponse)(nil), "osmosis.swaprouter.v1beta1.EstimateSwapExactAmountInResponse") + proto.RegisterType((*EstimateSwapExactAmountOutRequest)(nil), "osmosis.swaprouter.v1beta1.EstimateSwapExactAmountOutRequest") + proto.RegisterType((*EstimateSwapExactAmountOutResponse)(nil), "osmosis.swaprouter.v1beta1.EstimateSwapExactAmountOutResponse") + proto.RegisterType((*NumPoolsRequest)(nil), "osmosis.swaprouter.v1beta1.NumPoolsRequest") + proto.RegisterType((*NumPoolsResponse)(nil), "osmosis.swaprouter.v1beta1.NumPoolsResponse") +} + +func init() { + proto.RegisterFile("osmosis/swaprouter/v1beta1/query.proto", fileDescriptor_4d9de31afe32e1e0) +} + +var fileDescriptor_4d9de31afe32e1e0 = []byte{ + // 811 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x41, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0xd3, 0x6c, 0x36, 0x9d, 0x55, 0x9b, 0xee, 0xb0, 0x40, 0xd6, 0x42, 0x71, 0x18, 0x60, + 0xc9, 0x76, 0x89, 0xad, 0xb4, 0x37, 0x44, 0x4b, 0x89, 0x14, 0x44, 0x2e, 0xb4, 0x98, 0x1b, 0x2a, + 0x8a, 0x26, 0xc9, 0x60, 0xac, 0xc6, 0x33, 0x6e, 0x66, 0xdc, 0x36, 0x42, 0x5c, 0x38, 0x21, 0x21, + 0x24, 0x24, 0x10, 0xe2, 0x27, 0xf5, 0x58, 0x89, 0x0b, 0xe2, 0x10, 0x50, 0xc3, 0x2f, 0x88, 0xf8, + 0x01, 0xc8, 0x33, 0x63, 0x27, 0xad, 0x14, 0x37, 0x14, 0x71, 0x8a, 0x33, 0xef, 0x7b, 0x6f, 0xbe, + 0xef, 0x7b, 0xef, 0xd9, 0xe0, 0x19, 0xe3, 0x01, 0xe3, 0x3e, 0x77, 0xf8, 0x39, 0x0e, 0x47, 0x2c, + 0x12, 0x64, 0xe4, 0x9c, 0x35, 0x7b, 0x44, 0xe0, 0xa6, 0x73, 0x1a, 0x91, 0xd1, 0xd8, 0x0e, 0x47, + 0x4c, 0x30, 0x68, 0x6a, 0x9c, 0x3d, 0xc7, 0xd9, 0x1a, 0x67, 0x3e, 0xf1, 0x98, 0xc7, 0x24, 0xcc, + 0x89, 0x9f, 0x54, 0x86, 0x59, 0xcf, 0xa8, 0xec, 0x11, 0x4a, 0xe2, 0x62, 0x0a, 0xf9, 0x46, 0x06, + 0x52, 0x5c, 0x68, 0x50, 0xb5, 0x2f, 0x51, 0x4e, 0x0f, 0x73, 0x92, 0x46, 0xfb, 0xcc, 0xa7, 0x3a, + 0xbe, 0xbd, 0x18, 0x97, 0xcc, 0x53, 0x54, 0x88, 0x3d, 0x9f, 0x62, 0xe1, 0xb3, 0x04, 0xfb, 0x9a, + 0xc7, 0x98, 0x37, 0x24, 0x0e, 0x0e, 0x7d, 0x07, 0x53, 0xca, 0x84, 0x0c, 0x26, 0x74, 0x9e, 0xea, + 0xa8, 0xfc, 0xd7, 0x8b, 0xbe, 0x70, 0x30, 0x1d, 0x27, 0x21, 0x75, 0x49, 0x57, 0x89, 0x55, 0x7f, + 0x74, 0xc8, 0xba, 0x9d, 0x25, 0xfc, 0x80, 0x70, 0x81, 0x83, 0x50, 0x01, 0x50, 0x19, 0x6c, 0x1c, + 0xe1, 0x11, 0x0e, 0xb8, 0x4b, 0x4e, 0x23, 0xc2, 0x05, 0x72, 0xc1, 0x66, 0x72, 0xc0, 0x43, 0x46, + 0x39, 0x81, 0x07, 0xa0, 0x18, 0xca, 0x93, 0x8a, 0x51, 0x33, 0xea, 0x8f, 0x76, 0x90, 0xbd, 0xdc, + 0x75, 0x5b, 0xe5, 0xb6, 0x0a, 0x97, 0x13, 0x2b, 0xe7, 0xea, 0x3c, 0xf4, 0x6d, 0x1e, 0xd4, 0xda, + 0x5c, 0xf8, 0x01, 0x16, 0xe4, 0xd3, 0x73, 0x1c, 0xb6, 0x2f, 0x70, 0x5f, 0x7c, 0x10, 0xb0, 0x88, + 0x8a, 0x0e, 0xd5, 0x17, 0xc3, 0xe7, 0xa0, 0xc8, 0x09, 0x1d, 0x90, 0x91, 0xbc, 0x66, 0xbd, 0xf5, + 0x78, 0x36, 0xb1, 0x36, 0xc6, 0x38, 0x18, 0xbe, 0x8b, 0xd4, 0x39, 0x72, 0x35, 0x00, 0xbe, 0x00, + 0x0f, 0x43, 0xc6, 0x86, 0x5d, 0x7f, 0x50, 0xc9, 0xd7, 0x8c, 0x7a, 0xa1, 0x05, 0x67, 0x13, 0x6b, + 0x53, 0x61, 0x75, 0x00, 0xb9, 0xc5, 0xf8, 0xa9, 0x33, 0x80, 0x36, 0x28, 0x09, 0x76, 0x42, 0x68, + 0xd7, 0xa7, 0x95, 0x35, 0x59, 0xf9, 0xa5, 0xd9, 0xc4, 0x2a, 0x2b, 0x74, 0x12, 0x41, 0xee, 0x43, + 0xf9, 0xd8, 0xa1, 0xf0, 0x18, 0x14, 0xa5, 0x26, 0x5e, 0x29, 0xd4, 0xd6, 0xea, 0x8f, 0x76, 0x1a, + 0x59, 0x72, 0x63, 0x35, 0xa9, 0x90, 0x38, 0xd4, 0x7a, 0x39, 0x56, 0x3e, 0xa7, 0xae, 0x4a, 0x21, + 0x57, 0xd7, 0x44, 0xbf, 0x18, 0xe0, 0xf5, 0x0c, 0x2b, 0xb4, 0xe5, 0x1c, 0x6c, 0x29, 0x66, 0x2c, + 0x12, 0x5d, 0x2c, 0xa3, 0xda, 0x95, 0x4e, 0x5c, 0xfe, 0xf7, 0x89, 0xf5, 0xcc, 0xf3, 0xc5, 0x97, + 0x51, 0xcf, 0xee, 0xb3, 0x40, 0x77, 0x5c, 0xff, 0x34, 0xf8, 0xe0, 0xc4, 0x11, 0xe3, 0x90, 0x70, + 0xbb, 0x43, 0xc5, 0x6c, 0x62, 0xbd, 0xba, 0xa8, 0x74, 0x5e, 0x0f, 0xb9, 0x9b, 0xf2, 0xe8, 0x30, + 0xd2, 0xd7, 0xa3, 0xef, 0xf3, 0x4b, 0xa9, 0x1d, 0x46, 0xe2, 0xff, 0x6e, 0xd3, 0xe7, 0xa9, 0xed, + 0x6b, 0xd2, 0x76, 0x7b, 0x35, 0xdb, 0x63, 0x66, 0x2b, 0xf8, 0x0e, 0x9b, 0x60, 0x3d, 0x75, 0xa0, + 0x52, 0x90, 0xcc, 0x9f, 0xcc, 0x26, 0xd6, 0xd6, 0x2d, 0x73, 0x90, 0x5b, 0x4a, 0x5c, 0x41, 0x3f, + 0x1b, 0x00, 0x65, 0xf9, 0xa1, 0x7b, 0x15, 0x82, 0x72, 0x32, 0x45, 0x37, 0x5b, 0xf5, 0xd1, 0xbf, + 0x6e, 0xd5, 0x2b, 0x37, 0x87, 0x32, 0xed, 0xd4, 0x86, 0x9e, 0x4d, 0xdd, 0xa8, 0xc7, 0xa0, 0xfc, + 0x71, 0x14, 0x1c, 0x31, 0x36, 0x4c, 0xb7, 0xb6, 0x0d, 0xb6, 0xe6, 0x47, 0x9a, 0x58, 0x13, 0xac, + 0xd3, 0x28, 0xe8, 0xc6, 0xfe, 0xaa, 0xd5, 0x2d, 0x2c, 0x4a, 0x4e, 0x43, 0xc8, 0x2d, 0x51, 0x9d, + 0xba, 0xf3, 0xf7, 0x03, 0xf0, 0xe0, 0x93, 0xf8, 0x2d, 0x05, 0xbf, 0x33, 0x40, 0x51, 0xed, 0x32, + 0x7c, 0x7e, 0xf7, 0xbe, 0x6b, 0x1a, 0xe6, 0xf6, 0x2a, 0x50, 0x45, 0x0f, 0x6d, 0x7f, 0xf3, 0xeb, + 0x5f, 0x3f, 0xe6, 0xdf, 0x84, 0xc8, 0xc9, 0x78, 0xd1, 0x6a, 0x0a, 0x7f, 0x18, 0xe0, 0xe9, 0xd2, + 0xad, 0x81, 0xef, 0x65, 0xdd, 0x7a, 0xd7, 0x7b, 0xc7, 0xdc, 0xbb, 0x67, 0xb6, 0x96, 0xd1, 0x96, + 0x32, 0xde, 0x87, 0x7b, 0xa9, 0x0c, 0x0f, 0x07, 0x41, 0x2a, 0xe0, 0x2b, 0x3d, 0xe8, 0x5f, 0x3b, + 0x44, 0x97, 0x92, 0x32, 0xbb, 0x24, 0x2e, 0xa6, 0x1b, 0xdc, 0xf5, 0x29, 0x9c, 0x1a, 0xc0, 0x5c, + 0x3e, 0x6c, 0xf0, 0x3e, 0x24, 0xe7, 0x4b, 0x6b, 0xee, 0xdf, 0x37, 0x5d, 0x8b, 0xfc, 0x50, 0x8a, + 0x3c, 0x80, 0xfb, 0xff, 0x41, 0x24, 0x8b, 0x04, 0xfc, 0xc9, 0x00, 0xa5, 0x64, 0x4e, 0xe1, 0x8b, + 0x2c, 0x52, 0xb7, 0x06, 0xdc, 0x7c, 0x67, 0x35, 0xb0, 0xe6, 0xdb, 0x90, 0x7c, 0xdf, 0x86, 0x6f, + 0x65, 0xcd, 0x56, 0xba, 0x01, 0xad, 0xe3, 0xcb, 0xeb, 0xaa, 0x71, 0x75, 0x5d, 0x35, 0xfe, 0xbc, + 0xae, 0x1a, 0x3f, 0x4c, 0xab, 0xb9, 0xab, 0x69, 0x35, 0xf7, 0xdb, 0xb4, 0x9a, 0xfb, 0xac, 0xb5, + 0xb0, 0xbb, 0xba, 0x54, 0x63, 0x88, 0x7b, 0x3c, 0xad, 0x7b, 0xd6, 0xdc, 0x75, 0x2e, 0x16, 0xab, + 0xf7, 0x87, 0x3e, 0xa1, 0x42, 0x7d, 0xeb, 0xd5, 0x57, 0xb7, 0x28, 0x7f, 0x76, 0xff, 0x09, 0x00, + 0x00, 0xff, 0xff, 0xc4, 0xb3, 0x33, 0xf6, 0xd5, 0x08, 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(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) + // Estimates swap amount out given in. + EstimateSwapExactAmountIn(ctx context.Context, in *EstimateSwapExactAmountInRequest, opts ...grpc.CallOption) (*EstimateSwapExactAmountInResponse, error) + // Estimates swap amount in given out. + EstimateSwapExactAmountOut(ctx context.Context, in *EstimateSwapExactAmountOutRequest, opts ...grpc.CallOption) (*EstimateSwapExactAmountOutResponse, error) + NumPools(ctx context.Context, in *NumPoolsRequest, opts ...grpc.CallOption) (*NumPoolsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { + out := new(ParamsResponse) + err := c.cc.Invoke(ctx, "/osmosis.swaprouter.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) EstimateSwapExactAmountIn(ctx context.Context, in *EstimateSwapExactAmountInRequest, opts ...grpc.CallOption) (*EstimateSwapExactAmountInResponse, error) { + out := new(EstimateSwapExactAmountInResponse) + err := c.cc.Invoke(ctx, "/osmosis.swaprouter.v1beta1.Query/EstimateSwapExactAmountIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) EstimateSwapExactAmountOut(ctx context.Context, in *EstimateSwapExactAmountOutRequest, opts ...grpc.CallOption) (*EstimateSwapExactAmountOutResponse, error) { + out := new(EstimateSwapExactAmountOutResponse) + err := c.cc.Invoke(ctx, "/osmosis.swaprouter.v1beta1.Query/EstimateSwapExactAmountOut", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) NumPools(ctx context.Context, in *NumPoolsRequest, opts ...grpc.CallOption) (*NumPoolsResponse, error) { + out := new(NumPoolsResponse) + err := c.cc.Invoke(ctx, "/osmosis.swaprouter.v1beta1.Query/NumPools", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + Params(context.Context, *ParamsRequest) (*ParamsResponse, error) + // Estimates swap amount out given in. + EstimateSwapExactAmountIn(context.Context, *EstimateSwapExactAmountInRequest) (*EstimateSwapExactAmountInResponse, error) + // Estimates swap amount in given out. + EstimateSwapExactAmountOut(context.Context, *EstimateSwapExactAmountOutRequest) (*EstimateSwapExactAmountOutResponse, error) + NumPools(context.Context, *NumPoolsRequest) (*NumPoolsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) EstimateSwapExactAmountIn(ctx context.Context, req *EstimateSwapExactAmountInRequest) (*EstimateSwapExactAmountInResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EstimateSwapExactAmountIn not implemented") +} +func (*UnimplementedQueryServer) EstimateSwapExactAmountOut(ctx context.Context, req *EstimateSwapExactAmountOutRequest) (*EstimateSwapExactAmountOutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EstimateSwapExactAmountOut not implemented") +} +func (*UnimplementedQueryServer) NumPools(ctx context.Context, req *NumPoolsRequest) (*NumPoolsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NumPools 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(ParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.swaprouter.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_EstimateSwapExactAmountIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EstimateSwapExactAmountInRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EstimateSwapExactAmountIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.swaprouter.v1beta1.Query/EstimateSwapExactAmountIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EstimateSwapExactAmountIn(ctx, req.(*EstimateSwapExactAmountInRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_EstimateSwapExactAmountOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EstimateSwapExactAmountOutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EstimateSwapExactAmountOut(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.swaprouter.v1beta1.Query/EstimateSwapExactAmountOut", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EstimateSwapExactAmountOut(ctx, req.(*EstimateSwapExactAmountOutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_NumPools_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NumPoolsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NumPools(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.swaprouter.v1beta1.Query/NumPools", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NumPools(ctx, req.(*NumPoolsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "osmosis.swaprouter.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "EstimateSwapExactAmountIn", + Handler: _Query_EstimateSwapExactAmountIn_Handler, + }, + { + MethodName: "EstimateSwapExactAmountOut", + Handler: _Query_EstimateSwapExactAmountOut_Handler, + }, + { + MethodName: "NumPools", + Handler: _Query_NumPools_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/swaprouter/v1beta1/query.proto", +} + +func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsResponse) 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 *EstimateSwapExactAmountInRequest) 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 *EstimateSwapExactAmountInRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EstimateSwapExactAmountInRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Routes) > 0 { + for iNdEx := len(m.Routes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Routes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.TokenIn) > 0 { + i -= len(m.TokenIn) + copy(dAtA[i:], m.TokenIn) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TokenIn))) + i-- + dAtA[i] = 0x1a + } + if m.PoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EstimateSwapExactAmountInResponse) 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 *EstimateSwapExactAmountInResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EstimateSwapExactAmountInResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TokenOutAmount.Size() + i -= size + if _, err := m.TokenOutAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EstimateSwapExactAmountOutRequest) 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 *EstimateSwapExactAmountOutRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EstimateSwapExactAmountOutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenOut) > 0 { + i -= len(m.TokenOut) + copy(dAtA[i:], m.TokenOut) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TokenOut))) + i-- + dAtA[i] = 0x22 + } + if len(m.Routes) > 0 { + for iNdEx := len(m.Routes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Routes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.PoolId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EstimateSwapExactAmountOutResponse) 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 *EstimateSwapExactAmountOutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EstimateSwapExactAmountOutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TokenInAmount.Size() + i -= size + if _, err := m.TokenInAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *NumPoolsRequest) 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 *NumPoolsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NumPoolsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *NumPoolsResponse) 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 *NumPoolsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NumPoolsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NumPools != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.NumPools)) + i-- + dAtA[i] = 0x8 + } + 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 *ParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ParamsResponse) 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 *EstimateSwapExactAmountInRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovQuery(uint64(m.PoolId)) + } + l = len(m.TokenIn) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Routes) > 0 { + for _, e := range m.Routes { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *EstimateSwapExactAmountInResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TokenOutAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *EstimateSwapExactAmountOutRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovQuery(uint64(m.PoolId)) + } + if len(m.Routes) > 0 { + for _, e := range m.Routes { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + l = len(m.TokenOut) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *EstimateSwapExactAmountOutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TokenInAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *NumPoolsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *NumPoolsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NumPools != 0 { + n += 1 + sovQuery(uint64(m.NumPools)) + } + 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 *ParamsRequest) 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: ParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsRequest: 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 *ParamsResponse) 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: ParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsResponse: 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 *EstimateSwapExactAmountInRequest) 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: EstimateSwapExactAmountInRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EstimateSwapExactAmountInRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenIn", 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.TokenIn = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Routes", 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 + } + m.Routes = append(m.Routes, types.SwapAmountInRoute{}) + if err := m.Routes[len(m.Routes)-1].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 *EstimateSwapExactAmountInResponse) 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: EstimateSwapExactAmountInResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EstimateSwapExactAmountInResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOutAmount", 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 + } + if err := m.TokenOutAmount.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 *EstimateSwapExactAmountOutRequest) 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: EstimateSwapExactAmountOutRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EstimateSwapExactAmountOutRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Routes", 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 + } + m.Routes = append(m.Routes, types.SwapAmountOutRoute{}) + if err := m.Routes[len(m.Routes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOut", 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.TokenOut = 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 *EstimateSwapExactAmountOutResponse) 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: EstimateSwapExactAmountOutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EstimateSwapExactAmountOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenInAmount", 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 + } + if err := m.TokenInAmount.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 *NumPoolsRequest) 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: NumPoolsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NumPoolsRequest: 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 *NumPoolsResponse) 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: NumPoolsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NumPoolsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumPools", wireType) + } + m.NumPools = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumPools |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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/swaprouter/client/queryproto/query.pb.gw.go b/x/swaprouter/client/queryproto/query.pb.gw.go new file mode 100644 index 00000000000..5ddc6f256aa --- /dev/null +++ b/x/swaprouter/client/queryproto/query.pb.gw.go @@ -0,0 +1,456 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: osmosis/swaprouter/v1beta1/query.proto + +/* +Package queryproto is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package queryproto + +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 ParamsRequest + 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 ParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EstimateSwapExactAmountIn_0 = &utilities.DoubleArray{Encoding: map[string]int{"pool_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_EstimateSwapExactAmountIn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EstimateSwapExactAmountInRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", 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_EstimateSwapExactAmountIn_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EstimateSwapExactAmountIn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EstimateSwapExactAmountIn_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EstimateSwapExactAmountInRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", 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_EstimateSwapExactAmountIn_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EstimateSwapExactAmountIn(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EstimateSwapExactAmountOut_0 = &utilities.DoubleArray{Encoding: map[string]int{"pool_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_EstimateSwapExactAmountOut_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EstimateSwapExactAmountOutRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", 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_EstimateSwapExactAmountOut_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EstimateSwapExactAmountOut(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EstimateSwapExactAmountOut_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EstimateSwapExactAmountOutRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["pool_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "pool_id") + } + + protoReq.PoolId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "pool_id", 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_EstimateSwapExactAmountOut_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EstimateSwapExactAmountOut(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_NumPools_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NumPoolsRequest + var metadata runtime.ServerMetadata + + msg, err := client.NumPools(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NumPools_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NumPoolsRequest + var metadata runtime.ServerMetadata + + msg, err := server.NumPools(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_EstimateSwapExactAmountIn_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_EstimateSwapExactAmountIn_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_EstimateSwapExactAmountIn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EstimateSwapExactAmountOut_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_EstimateSwapExactAmountOut_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_EstimateSwapExactAmountOut_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NumPools_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_NumPools_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_NumPools_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_EstimateSwapExactAmountIn_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_EstimateSwapExactAmountIn_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_EstimateSwapExactAmountIn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EstimateSwapExactAmountOut_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_EstimateSwapExactAmountOut_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_EstimateSwapExactAmountOut_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NumPools_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_NumPools_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_NumPools_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{"osmosis", "swaprouter", "v1beta1", "Params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EstimateSwapExactAmountIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 5}, []string{"osmosis", "gamm", "v1beta1", "pool_id", "estimate", "swap_exact_amount_in"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EstimateSwapExactAmountOut_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 2, 5}, []string{"osmosis", "gamm", "v1beta1", "pool_id", "estimate", "swap_exact_amount_out"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NumPools_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "swaprouter", "v1beta1", "num_pools"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_EstimateSwapExactAmountIn_0 = runtime.ForwardResponseMessage + + forward_Query_EstimateSwapExactAmountOut_0 = runtime.ForwardResponseMessage + + forward_Query_NumPools_0 = runtime.ForwardResponseMessage +) diff --git a/x/swaprouter/types/genesis.pb.go b/x/swaprouter/types/genesis.pb.go new file mode 100644 index 00000000000..5d397564251 --- /dev/null +++ b/x/swaprouter/types/genesis.pb.go @@ -0,0 +1,558 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/swaprouter/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + 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 holds parameters for the swaprouter module +type Params struct { + PoolCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=pool_creation_fee,json=poolCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"pool_creation_fee" yaml:"pool_creation_fee"` +} + +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_7ec914d8a231e19c, []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 (m *Params) GetPoolCreationFee() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.PoolCreationFee + } + return nil +} + +// GenesisState defines the swaprouter module's genesis state. +type GenesisState struct { + // the next_pool_id + NextPoolId uint64 `protobuf:"varint,1,opt,name=next_pool_id,json=nextPoolId,proto3" json:"next_pool_id,omitempty"` + // params is the container of swaprouter parameters. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +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_7ec914d8a231e19c, []int{1} +} +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) GetNextPoolId() uint64 { + if m != nil { + return m.NextPoolId + } + return 0 +} + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*Params)(nil), "osmosis.swaprouter.v1beta1.Params") + proto.RegisterType((*GenesisState)(nil), "osmosis.swaprouter.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("osmosis/swaprouter/v1beta1/genesis.proto", fileDescriptor_7ec914d8a231e19c) +} + +var fileDescriptor_7ec914d8a231e19c = []byte{ + // 377 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x3d, 0x6e, 0xe2, 0x40, + 0x14, 0xf6, 0xec, 0x22, 0x0a, 0x83, 0xb4, 0x5a, 0x6b, 0x0b, 0x43, 0x61, 0x2c, 0x57, 0x6e, 0x98, + 0x11, 0x20, 0x6d, 0xb1, 0xd5, 0x0a, 0xa4, 0x5d, 0x45, 0x4a, 0x81, 0x48, 0x97, 0xc6, 0x1a, 0xdb, + 0x83, 0x63, 0xc5, 0xf6, 0xb3, 0x3c, 0x63, 0x02, 0xb7, 0x88, 0x94, 0x3e, 0x07, 0xc8, 0x49, 0x28, + 0x29, 0x53, 0x91, 0x08, 0x6e, 0x90, 0x13, 0x44, 0x1e, 0x8f, 0x13, 0x94, 0x28, 0x95, 0xfd, 0xe6, + 0xfb, 0x79, 0xef, 0x7b, 0x33, 0xba, 0x0b, 0x3c, 0x05, 0x1e, 0x73, 0xc2, 0x6f, 0x68, 0x5e, 0x40, + 0x29, 0x58, 0x41, 0x56, 0x23, 0x9f, 0x09, 0x3a, 0x22, 0x11, 0xcb, 0x18, 0x8f, 0x39, 0xce, 0x0b, + 0x10, 0x60, 0xf4, 0x15, 0x13, 0xbf, 0x33, 0xb1, 0x62, 0xf6, 0x7f, 0x45, 0x10, 0x81, 0xa4, 0x91, + 0xea, 0xaf, 0x56, 0xf4, 0x7b, 0x11, 0x40, 0x94, 0x30, 0x22, 0x2b, 0xbf, 0x5c, 0x12, 0x9a, 0x6d, + 0x1a, 0x28, 0x90, 0x6e, 0x5e, 0xad, 0xa9, 0x0b, 0x05, 0x59, 0x1f, 0x55, 0x61, 0x59, 0x50, 0x11, + 0x43, 0xd6, 0xe0, 0x35, 0x9b, 0xf8, 0x94, 0xb3, 0xb7, 0x51, 0x03, 0x88, 0x15, 0xee, 0xdc, 0x23, + 0xbd, 0x3d, 0xa7, 0x05, 0x4d, 0xb9, 0x71, 0x87, 0xf4, 0x9f, 0x39, 0x40, 0xe2, 0x05, 0x05, 0x93, + 0x16, 0xde, 0x92, 0x31, 0x13, 0xd9, 0xdf, 0xdd, 0xce, 0xb8, 0x87, 0x55, 0xd7, 0xca, 0xa7, 0x09, + 0x82, 0x67, 0x10, 0x67, 0xd3, 0xf3, 0xed, 0x7e, 0xa0, 0xbd, 0xec, 0x07, 0xe6, 0x86, 0xa6, 0xc9, + 0x1f, 0xe7, 0x93, 0x83, 0xf3, 0xf0, 0x34, 0x70, 0xa3, 0x58, 0x5c, 0x95, 0x3e, 0x0e, 0x20, 0x55, + 0xe3, 0xab, 0xcf, 0x90, 0x87, 0xd7, 0x44, 0x6c, 0x72, 0xc6, 0xa5, 0x19, 0x5f, 0xfc, 0xa8, 0xf4, + 0x33, 0x25, 0xff, 0xc7, 0x98, 0x53, 0xe8, 0xdd, 0xff, 0xf5, 0x66, 0x2f, 0x04, 0x15, 0xcc, 0xb0, + 0xf5, 0x6e, 0xc6, 0xd6, 0xc2, 0x93, 0x7d, 0xe2, 0xd0, 0x44, 0x36, 0x72, 0x5b, 0x0b, 0xbd, 0x3a, + 0x9b, 0x03, 0x24, 0x67, 0xa1, 0xf1, 0x57, 0x6f, 0xe7, 0x32, 0x91, 0xf9, 0xcd, 0x46, 0x6e, 0x67, + 0xec, 0xe0, 0xaf, 0xef, 0x02, 0xd7, 0xd9, 0xa7, 0xad, 0x2a, 0xc4, 0x42, 0xe9, 0xa6, 0xf3, 0xed, + 0xc1, 0x42, 0xbb, 0x83, 0x85, 0x9e, 0x0f, 0x16, 0xba, 0x3d, 0x5a, 0xda, 0xee, 0x68, 0x69, 0x8f, + 0x47, 0x4b, 0xbb, 0xfc, 0x7d, 0x12, 0x44, 0xb9, 0x0e, 0x13, 0xea, 0xf3, 0xa6, 0x20, 0xab, 0xd1, + 0x84, 0xac, 0x4f, 0x9f, 0x87, 0x0c, 0xe7, 0xb7, 0xe5, 0xb6, 0x27, 0xaf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x7d, 0xee, 0x88, 0x63, 0x41, 0x02, 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 + if len(m.PoolCreationFee) > 0 { + for iNdEx := len(m.PoolCreationFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PoolCreationFee[iNdEx].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 (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 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.NextPoolId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.NextPoolId)) + i-- + dAtA[i] = 0x8 + } + 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 *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PoolCreationFee) > 0 { + for _, e := range m.PoolCreationFee { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NextPoolId != 0 { + n += 1 + sovGenesis(uint64(m.NextPoolId)) + } + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + 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 *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 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: 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 { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolCreationFee", 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 + } + m.PoolCreationFee = append(m.PoolCreationFee, types.Coin{}) + if err := m.PoolCreationFee[len(m.PoolCreationFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 (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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextPoolId", wireType) + } + m.NextPoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextPoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 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 + 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/swaprouter/types/module_route.pb.go b/x/swaprouter/types/module_route.pb.go new file mode 100644 index 00000000000..694c267d69d --- /dev/null +++ b/x/swaprouter/types/module_route.pb.go @@ -0,0 +1,348 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/swaprouter/v1beta1/module_route.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 + +// PoolType is an enumeration of all supported pool types. +type PoolType int32 + +const ( + // Balancer is the standard xy=k curve. Its pool model is defined in x/gamm. + Balancer PoolType = 0 + // Stableswap is the Solidly cfmm stable swap curve. Its pool model is defined + // in x/gamm. + StableSwap PoolType = 1 + // Concentrated is the pool model specific to concentrated liquidity. It is + // defined in x/concentrated-liquidity. + Concentrated PoolType = 2 +) + +var PoolType_name = map[int32]string{ + 0: "Balancer", + 1: "StableSwap", + 2: "Concentrated", +} + +var PoolType_value = map[string]int32{ + "Balancer": 0, + "StableSwap": 1, + "Concentrated": 2, +} + +func (x PoolType) String() string { + return proto.EnumName(PoolType_name, int32(x)) +} + +func (PoolType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c26575d86edff56b, []int{0} +} + +// ModuleRouter defines a route encapsulating pool type. +// It is used as the value of a mapping from pool id to the pool type, +// allowing the swap router to know which module to route swaps to given the +// pool id. +type ModuleRoute struct { + // pool_type specifies the type of the pool + PoolType PoolType `protobuf:"varint,1,opt,name=pool_type,json=poolType,proto3,enum=osmosis.swaprouter.v1beta1.PoolType" json:"pool_type,omitempty"` +} + +func (m *ModuleRoute) Reset() { *m = ModuleRoute{} } +func (m *ModuleRoute) String() string { return proto.CompactTextString(m) } +func (*ModuleRoute) ProtoMessage() {} +func (*ModuleRoute) Descriptor() ([]byte, []int) { + return fileDescriptor_c26575d86edff56b, []int{0} +} +func (m *ModuleRoute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ModuleRoute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ModuleRoute.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 *ModuleRoute) XXX_Merge(src proto.Message) { + xxx_messageInfo_ModuleRoute.Merge(m, src) +} +func (m *ModuleRoute) XXX_Size() int { + return m.Size() +} +func (m *ModuleRoute) XXX_DiscardUnknown() { + xxx_messageInfo_ModuleRoute.DiscardUnknown(m) +} + +var xxx_messageInfo_ModuleRoute proto.InternalMessageInfo + +func (m *ModuleRoute) GetPoolType() PoolType { + if m != nil { + return m.PoolType + } + return Balancer +} + +func init() { + proto.RegisterEnum("osmosis.swaprouter.v1beta1.PoolType", PoolType_name, PoolType_value) + proto.RegisterType((*ModuleRoute)(nil), "osmosis.swaprouter.v1beta1.ModuleRoute") +} + +func init() { + proto.RegisterFile("osmosis/swaprouter/v1beta1/module_route.proto", fileDescriptor_c26575d86edff56b) +} + +var fileDescriptor_c26575d86edff56b = []byte{ + // 265 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcd, 0x2f, 0xce, 0xcd, + 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0x2e, 0x4f, 0x2c, 0x28, 0xca, 0x2f, 0x2d, 0x49, 0x2d, 0xd2, 0x2f, + 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x8d, 0x07, 0x8b, + 0xea, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x49, 0x41, 0x95, 0xeb, 0x21, 0x94, 0xeb, 0x41, 0x95, + 0x4b, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x95, 0xe9, 0x83, 0x58, 0x10, 0x1d, 0x4a, 0x01, 0x5c, + 0xdc, 0xbe, 0x60, 0x73, 0x82, 0x40, 0xaa, 0x85, 0x1c, 0xb9, 0x38, 0x0b, 0xf2, 0xf3, 0x73, 0xe2, + 0x4b, 0x2a, 0x0b, 0x52, 0x25, 0x18, 0x15, 0x18, 0x35, 0xf8, 0x8c, 0x54, 0xf4, 0x70, 0x1b, 0xaa, + 0x17, 0x90, 0x9f, 0x9f, 0x13, 0x52, 0x59, 0x90, 0x1a, 0xc4, 0x51, 0x00, 0x65, 0x69, 0x39, 0x70, + 0x71, 0xc0, 0x44, 0x85, 0x78, 0xb8, 0x38, 0x9c, 0x12, 0x73, 0x12, 0xf3, 0x92, 0x53, 0x8b, 0x04, + 0x18, 0x84, 0xf8, 0xb8, 0xb8, 0x82, 0x4b, 0x12, 0x93, 0x72, 0x52, 0x83, 0xcb, 0x13, 0x0b, 0x04, + 0x18, 0x85, 0x04, 0xb8, 0x78, 0x9c, 0xf3, 0xf3, 0x92, 0x53, 0xf3, 0x4a, 0x8a, 0x12, 0x4b, 0x52, + 0x53, 0x04, 0x98, 0xa4, 0x58, 0x3a, 0x16, 0xcb, 0x31, 0x38, 0x05, 0x9c, 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, 0x59, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, + 0xae, 0x3e, 0xd4, 0x55, 0xba, 0x39, 0x89, 0x49, 0xc5, 0x30, 0x8e, 0x7e, 0x99, 0xa1, 0xb1, 0x7e, + 0x05, 0x72, 0x60, 0x81, 0x3c, 0x52, 0x9c, 0xc4, 0x06, 0xf6, 0xac, 0x31, 0x20, 0x00, 0x00, 0xff, + 0xff, 0x6e, 0x93, 0xbb, 0x4a, 0x4f, 0x01, 0x00, 0x00, +} + +func (m *ModuleRoute) 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 *ModuleRoute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ModuleRoute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PoolType != 0 { + i = encodeVarintModuleRoute(dAtA, i, uint64(m.PoolType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintModuleRoute(dAtA []byte, offset int, v uint64) int { + offset -= sovModuleRoute(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ModuleRoute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolType != 0 { + n += 1 + sovModuleRoute(uint64(m.PoolType)) + } + return n +} + +func sovModuleRoute(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModuleRoute(x uint64) (n int) { + return sovModuleRoute(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ModuleRoute) 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 ErrIntOverflowModuleRoute + } + 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: ModuleRoute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ModuleRoute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolType", wireType) + } + m.PoolType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowModuleRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolType |= PoolType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipModuleRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModuleRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModuleRoute(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, ErrIntOverflowModuleRoute + } + 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, ErrIntOverflowModuleRoute + } + 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, ErrIntOverflowModuleRoute + } + 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, ErrInvalidLengthModuleRoute + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModuleRoute + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModuleRoute + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModuleRoute = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModuleRoute = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModuleRoute = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/swaprouter/types/tx.pb.go b/x/swaprouter/types/tx.pb.go new file mode 100644 index 00000000000..dfcd4b78274 --- /dev/null +++ b/x/swaprouter/types/tx.pb.go @@ -0,0 +1,1710 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/swaprouter/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// ===================== MsgSwapExactAmountIn +type SwapAmountInRoute struct { + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"` + TokenOutDenom string `protobuf:"bytes,2,opt,name=token_out_denom,json=tokenOutDenom,proto3" json:"token_out_denom,omitempty" yaml:"token_out_denom"` +} + +func (m *SwapAmountInRoute) Reset() { *m = SwapAmountInRoute{} } +func (m *SwapAmountInRoute) String() string { return proto.CompactTextString(m) } +func (*SwapAmountInRoute) ProtoMessage() {} +func (*SwapAmountInRoute) Descriptor() ([]byte, []int) { + return fileDescriptor_05a4da63b1afc25d, []int{0} +} +func (m *SwapAmountInRoute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SwapAmountInRoute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SwapAmountInRoute.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 *SwapAmountInRoute) XXX_Merge(src proto.Message) { + xxx_messageInfo_SwapAmountInRoute.Merge(m, src) +} +func (m *SwapAmountInRoute) XXX_Size() int { + return m.Size() +} +func (m *SwapAmountInRoute) XXX_DiscardUnknown() { + xxx_messageInfo_SwapAmountInRoute.DiscardUnknown(m) +} + +var xxx_messageInfo_SwapAmountInRoute proto.InternalMessageInfo + +func (m *SwapAmountInRoute) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *SwapAmountInRoute) GetTokenOutDenom() string { + if m != nil { + return m.TokenOutDenom + } + return "" +} + +type MsgSwapExactAmountIn struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Routes []SwapAmountInRoute `protobuf:"bytes,2,rep,name=routes,proto3" json:"routes"` + TokenIn types.Coin `protobuf:"bytes,3,opt,name=token_in,json=tokenIn,proto3" json:"token_in" yaml:"token_in"` + TokenOutMinAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=token_out_min_amount,json=tokenOutMinAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_out_min_amount" yaml:"token_out_min_amount"` +} + +func (m *MsgSwapExactAmountIn) Reset() { *m = MsgSwapExactAmountIn{} } +func (m *MsgSwapExactAmountIn) String() string { return proto.CompactTextString(m) } +func (*MsgSwapExactAmountIn) ProtoMessage() {} +func (*MsgSwapExactAmountIn) Descriptor() ([]byte, []int) { + return fileDescriptor_05a4da63b1afc25d, []int{1} +} +func (m *MsgSwapExactAmountIn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapExactAmountIn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapExactAmountIn.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 *MsgSwapExactAmountIn) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapExactAmountIn.Merge(m, src) +} +func (m *MsgSwapExactAmountIn) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapExactAmountIn) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapExactAmountIn.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapExactAmountIn proto.InternalMessageInfo + +func (m *MsgSwapExactAmountIn) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgSwapExactAmountIn) GetRoutes() []SwapAmountInRoute { + if m != nil { + return m.Routes + } + return nil +} + +func (m *MsgSwapExactAmountIn) GetTokenIn() types.Coin { + if m != nil { + return m.TokenIn + } + return types.Coin{} +} + +type MsgSwapExactAmountInResponse struct { + TokenOutAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=token_out_amount,json=tokenOutAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_out_amount" yaml:"token_out_amount"` +} + +func (m *MsgSwapExactAmountInResponse) Reset() { *m = MsgSwapExactAmountInResponse{} } +func (m *MsgSwapExactAmountInResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSwapExactAmountInResponse) ProtoMessage() {} +func (*MsgSwapExactAmountInResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_05a4da63b1afc25d, []int{2} +} +func (m *MsgSwapExactAmountInResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapExactAmountInResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapExactAmountInResponse.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 *MsgSwapExactAmountInResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapExactAmountInResponse.Merge(m, src) +} +func (m *MsgSwapExactAmountInResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapExactAmountInResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapExactAmountInResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapExactAmountInResponse proto.InternalMessageInfo + +// ===================== MsgSwapExactAmountOut +type SwapAmountOutRoute struct { + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty" yaml:"pool_id"` + TokenInDenom string `protobuf:"bytes,2,opt,name=token_in_denom,json=tokenInDenom,proto3" json:"token_in_denom,omitempty" yaml:"token_out_denom"` +} + +func (m *SwapAmountOutRoute) Reset() { *m = SwapAmountOutRoute{} } +func (m *SwapAmountOutRoute) String() string { return proto.CompactTextString(m) } +func (*SwapAmountOutRoute) ProtoMessage() {} +func (*SwapAmountOutRoute) Descriptor() ([]byte, []int) { + return fileDescriptor_05a4da63b1afc25d, []int{3} +} +func (m *SwapAmountOutRoute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SwapAmountOutRoute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SwapAmountOutRoute.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 *SwapAmountOutRoute) XXX_Merge(src proto.Message) { + xxx_messageInfo_SwapAmountOutRoute.Merge(m, src) +} +func (m *SwapAmountOutRoute) XXX_Size() int { + return m.Size() +} +func (m *SwapAmountOutRoute) XXX_DiscardUnknown() { + xxx_messageInfo_SwapAmountOutRoute.DiscardUnknown(m) +} + +var xxx_messageInfo_SwapAmountOutRoute proto.InternalMessageInfo + +func (m *SwapAmountOutRoute) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *SwapAmountOutRoute) GetTokenInDenom() string { + if m != nil { + return m.TokenInDenom + } + return "" +} + +type MsgSwapExactAmountOut struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Routes []SwapAmountOutRoute `protobuf:"bytes,2,rep,name=routes,proto3" json:"routes"` + TokenInMaxAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=token_in_max_amount,json=tokenInMaxAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_in_max_amount" yaml:"token_in_max_amount"` + TokenOut types.Coin `protobuf:"bytes,4,opt,name=token_out,json=tokenOut,proto3" json:"token_out" yaml:"token_out"` +} + +func (m *MsgSwapExactAmountOut) Reset() { *m = MsgSwapExactAmountOut{} } +func (m *MsgSwapExactAmountOut) String() string { return proto.CompactTextString(m) } +func (*MsgSwapExactAmountOut) ProtoMessage() {} +func (*MsgSwapExactAmountOut) Descriptor() ([]byte, []int) { + return fileDescriptor_05a4da63b1afc25d, []int{4} +} +func (m *MsgSwapExactAmountOut) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapExactAmountOut) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapExactAmountOut.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 *MsgSwapExactAmountOut) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapExactAmountOut.Merge(m, src) +} +func (m *MsgSwapExactAmountOut) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapExactAmountOut) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapExactAmountOut.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapExactAmountOut proto.InternalMessageInfo + +func (m *MsgSwapExactAmountOut) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgSwapExactAmountOut) GetRoutes() []SwapAmountOutRoute { + if m != nil { + return m.Routes + } + return nil +} + +func (m *MsgSwapExactAmountOut) GetTokenOut() types.Coin { + if m != nil { + return m.TokenOut + } + return types.Coin{} +} + +type MsgSwapExactAmountOutResponse struct { + TokenInAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=token_in_amount,json=tokenInAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"token_in_amount" yaml:"token_in_amount"` +} + +func (m *MsgSwapExactAmountOutResponse) Reset() { *m = MsgSwapExactAmountOutResponse{} } +func (m *MsgSwapExactAmountOutResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSwapExactAmountOutResponse) ProtoMessage() {} +func (*MsgSwapExactAmountOutResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_05a4da63b1afc25d, []int{5} +} +func (m *MsgSwapExactAmountOutResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapExactAmountOutResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapExactAmountOutResponse.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 *MsgSwapExactAmountOutResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapExactAmountOutResponse.Merge(m, src) +} +func (m *MsgSwapExactAmountOutResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapExactAmountOutResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapExactAmountOutResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapExactAmountOutResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*SwapAmountInRoute)(nil), "osmosis.swaprouter.v1beta1.SwapAmountInRoute") + proto.RegisterType((*MsgSwapExactAmountIn)(nil), "osmosis.swaprouter.v1beta1.MsgSwapExactAmountIn") + proto.RegisterType((*MsgSwapExactAmountInResponse)(nil), "osmosis.swaprouter.v1beta1.MsgSwapExactAmountInResponse") + proto.RegisterType((*SwapAmountOutRoute)(nil), "osmosis.swaprouter.v1beta1.SwapAmountOutRoute") + proto.RegisterType((*MsgSwapExactAmountOut)(nil), "osmosis.swaprouter.v1beta1.MsgSwapExactAmountOut") + proto.RegisterType((*MsgSwapExactAmountOutResponse)(nil), "osmosis.swaprouter.v1beta1.MsgSwapExactAmountOutResponse") +} + +func init() { + proto.RegisterFile("osmosis/swaprouter/v1beta1/tx.proto", fileDescriptor_05a4da63b1afc25d) +} + +var fileDescriptor_05a4da63b1afc25d = []byte{ + // 664 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x5f, 0x6b, 0xd3, 0x50, + 0x1c, 0x6d, 0xda, 0xd1, 0x6d, 0x77, 0xee, 0xdf, 0x75, 0x6e, 0x35, 0x6a, 0x52, 0x22, 0x48, 0x45, + 0x96, 0xd8, 0x0d, 0x44, 0x7d, 0xd2, 0xa8, 0x60, 0x71, 0xa5, 0x23, 0xbe, 0xf9, 0x52, 0xd2, 0x36, + 0xd4, 0xb0, 0xe5, 0xde, 0xd0, 0x7b, 0xb3, 0x75, 0x08, 0x0a, 0xea, 0x9b, 0x2f, 0x8a, 0x5f, 0x6a, + 0x8f, 0x7b, 0x14, 0xc1, 0x28, 0xdb, 0x37, 0xe8, 0x27, 0x90, 0xdc, 0x3f, 0x4d, 0x97, 0xcd, 0xb1, + 0xf8, 0x94, 0x9b, 0xe4, 0xf7, 0x3b, 0x39, 0xe7, 0xfc, 0xce, 0xbd, 0x01, 0xb7, 0x31, 0x09, 0x30, + 0xf1, 0x89, 0x45, 0xf6, 0xdd, 0x70, 0x80, 0x23, 0xea, 0x0d, 0xac, 0xbd, 0x7a, 0xc7, 0xa3, 0x6e, + 0xdd, 0xa2, 0x43, 0x33, 0x1c, 0x60, 0x8a, 0xa1, 0x2a, 0x8a, 0xcc, 0xb4, 0xc8, 0x14, 0x45, 0xea, + 0x4a, 0x1f, 0xf7, 0x31, 0x2b, 0xb3, 0x92, 0x15, 0xef, 0x50, 0xb5, 0x2e, 0x6b, 0xb1, 0x3a, 0x2e, + 0xf1, 0xc6, 0x78, 0x5d, 0xec, 0x23, 0xfe, 0xde, 0xf8, 0xac, 0x80, 0xe5, 0xd7, 0xfb, 0x6e, 0xf8, + 0x34, 0xc0, 0x11, 0xa2, 0x0d, 0xe4, 0x24, 0xa0, 0xf0, 0x1e, 0x98, 0x0e, 0x31, 0xde, 0x6d, 0xfb, + 0xbd, 0x8a, 0x52, 0x55, 0x6a, 0x53, 0x36, 0x1c, 0xc5, 0xfa, 0xc2, 0x81, 0x1b, 0xec, 0x3e, 0x36, + 0xc4, 0x0b, 0xc3, 0x29, 0x27, 0xab, 0x46, 0x0f, 0xda, 0x60, 0x91, 0xe2, 0x1d, 0x0f, 0xb5, 0x71, + 0x44, 0xdb, 0x3d, 0x0f, 0xe1, 0xa0, 0x52, 0xac, 0x2a, 0xb5, 0x59, 0x5b, 0x1d, 0xc5, 0xfa, 0x2a, + 0x6f, 0xca, 0x14, 0x18, 0xce, 0x3c, 0x7b, 0xd2, 0x8a, 0xe8, 0x73, 0x76, 0xff, 0xab, 0x08, 0x56, + 0x9a, 0xa4, 0x9f, 0x30, 0x79, 0x31, 0x74, 0xbb, 0x54, 0xd2, 0x81, 0x77, 0x41, 0x99, 0x78, 0xa8, + 0xe7, 0x0d, 0x18, 0x91, 0x59, 0x7b, 0x79, 0x14, 0xeb, 0xf3, 0x1c, 0x93, 0x3f, 0x37, 0x1c, 0x51, + 0x00, 0x5f, 0x81, 0x32, 0xb3, 0x84, 0x54, 0x8a, 0xd5, 0x52, 0x6d, 0x6e, 0x63, 0xdd, 0xfc, 0xb7, + 0x5b, 0xe6, 0x19, 0xcd, 0xf6, 0xd4, 0x61, 0xac, 0x17, 0x1c, 0x01, 0x01, 0x9b, 0x60, 0x86, 0x73, + 0xf6, 0x51, 0xa5, 0x54, 0x55, 0x6a, 0x73, 0x1b, 0xd7, 0x4d, 0x6e, 0xa5, 0x99, 0x58, 0x39, 0xc6, + 0x79, 0x86, 0x7d, 0x64, 0xaf, 0x25, 0xad, 0xa3, 0x58, 0x5f, 0x9c, 0x14, 0xeb, 0x23, 0xc3, 0x99, + 0x66, 0xcb, 0x06, 0x82, 0xef, 0xc1, 0x4a, 0x6a, 0x41, 0xe0, 0xa3, 0xb6, 0xcb, 0xbe, 0x5d, 0x99, + 0x62, 0xa2, 0x9a, 0x49, 0xff, 0xcf, 0x58, 0xbf, 0xd3, 0xf7, 0xe9, 0xdb, 0xa8, 0x63, 0x76, 0x71, + 0x60, 0x89, 0xb9, 0xf1, 0xcb, 0x3a, 0xe9, 0xed, 0x58, 0xf4, 0x20, 0xf4, 0x88, 0xd9, 0x40, 0x74, + 0x14, 0xeb, 0x37, 0xb2, 0xb6, 0xa6, 0x98, 0x86, 0xb3, 0x2c, 0xbd, 0x6d, 0xfa, 0x88, 0x6b, 0x34, + 0xbe, 0x2b, 0xe0, 0xe6, 0x79, 0xfe, 0x3a, 0x1e, 0x09, 0x31, 0x22, 0x1e, 0x24, 0x60, 0x29, 0x05, + 0x13, 0xe4, 0xb8, 0xe3, 0x8d, 0xdc, 0xe4, 0xd6, 0xb2, 0xe4, 0x24, 0xb1, 0x05, 0x49, 0x4c, 0xb0, + 0xfa, 0xa4, 0x00, 0x98, 0x0e, 0xa2, 0x15, 0xd1, 0xff, 0x48, 0xdf, 0x13, 0xb0, 0x20, 0xfd, 0xbe, + 0x74, 0xf8, 0xae, 0x88, 0xb1, 0xf0, 0xec, 0xfd, 0x2e, 0x82, 0x6b, 0x67, 0xbd, 0x69, 0x45, 0x34, + 0x4f, 0xf8, 0xb6, 0x32, 0xe1, 0x33, 0x2f, 0x17, 0x3e, 0xa9, 0x39, 0x93, 0xbe, 0x77, 0xe0, 0xea, + 0x58, 0x54, 0xe0, 0x0e, 0xe5, 0x40, 0x4a, 0x8c, 0xc5, 0x56, 0xee, 0x81, 0xa8, 0xa7, 0x73, 0x39, + 0x01, 0x69, 0x38, 0x4b, 0xc2, 0x8b, 0xa6, 0x3b, 0xe4, 0x94, 0xe0, 0x36, 0x98, 0x1d, 0x3b, 0xc6, + 0x02, 0x7a, 0x61, 0xf6, 0x2b, 0x22, 0xfb, 0x4b, 0x19, 0xaf, 0x0d, 0x67, 0x46, 0x4e, 0xdb, 0xf8, + 0xa6, 0x80, 0x5b, 0xe7, 0x3a, 0x3c, 0x8e, 0x5f, 0x28, 0xcf, 0x90, 0x74, 0x6b, 0x70, 0xcb, 0x5f, + 0xe6, 0x16, 0xbb, 0x9a, 0x11, 0x2b, 0x85, 0xce, 0x0b, 0xa1, 0xfc, 0xe3, 0x1b, 0x5f, 0x8a, 0xa0, + 0xd4, 0x24, 0x7d, 0xf8, 0x81, 0x9f, 0x7f, 0xa7, 0x4f, 0x9d, 0xfb, 0x17, 0x4d, 0xef, 0xbc, 0x7d, + 0xa4, 0x3e, 0xcc, 0xdb, 0x31, 0x96, 0xfe, 0x51, 0x6c, 0x82, 0x4c, 0xf6, 0xea, 0xf9, 0x00, 0x5b, + 0x11, 0x55, 0x1f, 0xe5, 0x6e, 0x91, 0x24, 0xec, 0xed, 0xc3, 0x63, 0x4d, 0x39, 0x3a, 0xd6, 0x94, + 0x3f, 0xc7, 0x9a, 0xf2, 0xf5, 0x44, 0x2b, 0x1c, 0x9d, 0x68, 0x85, 0x1f, 0x27, 0x5a, 0xe1, 0xcd, + 0x83, 0x09, 0xe3, 0x05, 0xfc, 0xfa, 0xae, 0xdb, 0x21, 0xf2, 0xc6, 0xda, 0xab, 0x6f, 0x5a, 0xc3, + 0xc9, 0xbf, 0x16, 0x1b, 0x46, 0xa7, 0xcc, 0xfe, 0x2f, 0x9b, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0xb1, 0x9c, 0x2f, 0xd9, 0xd8, 0x06, 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 { + SwapExactAmountIn(ctx context.Context, in *MsgSwapExactAmountIn, opts ...grpc.CallOption) (*MsgSwapExactAmountInResponse, error) + SwapExactAmountOut(ctx context.Context, in *MsgSwapExactAmountOut, opts ...grpc.CallOption) (*MsgSwapExactAmountOutResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SwapExactAmountIn(ctx context.Context, in *MsgSwapExactAmountIn, opts ...grpc.CallOption) (*MsgSwapExactAmountInResponse, error) { + out := new(MsgSwapExactAmountInResponse) + err := c.cc.Invoke(ctx, "/osmosis.swaprouter.v1beta1.Msg/SwapExactAmountIn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SwapExactAmountOut(ctx context.Context, in *MsgSwapExactAmountOut, opts ...grpc.CallOption) (*MsgSwapExactAmountOutResponse, error) { + out := new(MsgSwapExactAmountOutResponse) + err := c.cc.Invoke(ctx, "/osmosis.swaprouter.v1beta1.Msg/SwapExactAmountOut", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + SwapExactAmountIn(context.Context, *MsgSwapExactAmountIn) (*MsgSwapExactAmountInResponse, error) + SwapExactAmountOut(context.Context, *MsgSwapExactAmountOut) (*MsgSwapExactAmountOutResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SwapExactAmountIn(ctx context.Context, req *MsgSwapExactAmountIn) (*MsgSwapExactAmountInResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapExactAmountIn not implemented") +} +func (*UnimplementedMsgServer) SwapExactAmountOut(ctx context.Context, req *MsgSwapExactAmountOut) (*MsgSwapExactAmountOutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapExactAmountOut not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SwapExactAmountIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapExactAmountIn) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapExactAmountIn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.swaprouter.v1beta1.Msg/SwapExactAmountIn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapExactAmountIn(ctx, req.(*MsgSwapExactAmountIn)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SwapExactAmountOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapExactAmountOut) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapExactAmountOut(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.swaprouter.v1beta1.Msg/SwapExactAmountOut", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapExactAmountOut(ctx, req.(*MsgSwapExactAmountOut)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "osmosis.swaprouter.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SwapExactAmountIn", + Handler: _Msg_SwapExactAmountIn_Handler, + }, + { + MethodName: "SwapExactAmountOut", + Handler: _Msg_SwapExactAmountOut_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/swaprouter/v1beta1/tx.proto", +} + +func (m *SwapAmountInRoute) 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 *SwapAmountInRoute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SwapAmountInRoute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenOutDenom) > 0 { + i -= len(m.TokenOutDenom) + copy(dAtA[i:], m.TokenOutDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenOutDenom))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapExactAmountIn) 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 *MsgSwapExactAmountIn) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapExactAmountIn) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TokenOutMinAmount.Size() + i -= size + if _, err := m.TokenOutMinAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.TokenIn.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Routes) > 0 { + for iNdEx := len(m.Routes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Routes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapExactAmountInResponse) 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 *MsgSwapExactAmountInResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapExactAmountInResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TokenOutAmount.Size() + i -= size + if _, err := m.TokenOutAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *SwapAmountOutRoute) 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 *SwapAmountOutRoute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SwapAmountOutRoute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenInDenom) > 0 { + i -= len(m.TokenInDenom) + copy(dAtA[i:], m.TokenInDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.TokenInDenom))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapExactAmountOut) 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 *MsgSwapExactAmountOut) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapExactAmountOut) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TokenOut.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.TokenInMaxAmount.Size() + i -= size + if _, err := m.TokenInMaxAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Routes) > 0 { + for iNdEx := len(m.Routes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Routes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapExactAmountOutResponse) 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 *MsgSwapExactAmountOutResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapExactAmountOutResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TokenInAmount.Size() + i -= size + if _, err := m.TokenInAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *SwapAmountInRoute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovTx(uint64(m.PoolId)) + } + l = len(m.TokenOutDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSwapExactAmountIn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Routes) > 0 { + for _, e := range m.Routes { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = m.TokenIn.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.TokenOutMinAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgSwapExactAmountInResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TokenOutAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *SwapAmountOutRoute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovTx(uint64(m.PoolId)) + } + l = len(m.TokenInDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSwapExactAmountOut) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Routes) > 0 { + for _, e := range m.Routes { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = m.TokenInMaxAmount.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.TokenOut.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgSwapExactAmountOutResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TokenInAmount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *SwapAmountInRoute) 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 ErrIntOverflowTx + } + 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: SwapAmountInRoute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SwapAmountInRoute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOutDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenOutDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSwapExactAmountIn) 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 ErrIntOverflowTx + } + 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: MsgSwapExactAmountIn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapExactAmountIn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Routes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Routes = append(m.Routes, SwapAmountInRoute{}) + if err := m.Routes[len(m.Routes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenIn", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenIn.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOutMinAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenOutMinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSwapExactAmountInResponse) 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 ErrIntOverflowTx + } + 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: MsgSwapExactAmountInResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapExactAmountInResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOutAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenOutAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SwapAmountOutRoute) 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 ErrIntOverflowTx + } + 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: SwapAmountOutRoute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SwapAmountOutRoute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenInDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenInDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSwapExactAmountOut) 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 ErrIntOverflowTx + } + 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: MsgSwapExactAmountOut: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapExactAmountOut: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Routes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Routes = append(m.Routes, SwapAmountOutRoute{}) + if err := m.Routes[len(m.Routes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenInMaxAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenInMaxAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOut", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenOut.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSwapExactAmountOutResponse) 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 ErrIntOverflowTx + } + 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: MsgSwapExactAmountOutResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapExactAmountOutResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenInAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenInAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From aa50cf234e4cf323180935088395823cff9f883a Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 22 Nov 2022 15:12:02 -0500 Subject: [PATCH 2/2] nolint --- x/swaprouter/client/query_proto_wrap.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/swaprouter/client/query_proto_wrap.go b/x/swaprouter/client/query_proto_wrap.go index b75f289a815..d153bd3ee74 100644 --- a/x/swaprouter/client/query_proto_wrap.go +++ b/x/swaprouter/client/query_proto_wrap.go @@ -13,6 +13,7 @@ import ( type Querier struct { } +// nolint: unused var sdkIntMaxValue = sdk.NewInt(0) func init() {