Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CL): swap router module #3060

Merged
merged 6 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions proto/osmosis/swaprouter/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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";

option go_package = "github.com/osmosis-labs/osmosis/v12/x/swaprouter/types";

// Params holds parameters for the swaprouter module
message Params {}

// GenesisState defines the swaprouter module's genesis state.
message GenesisState {
// params is the container of swaprouter parameters.
Params params = 2 [ (gogoproto.nullable) = false ];
p0mvn marked this conversation as resolved.
Show resolved Hide resolved
}
23 changes: 23 additions & 0 deletions proto/osmosis/swaprouter/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";
package osmosis.swaprouter.v1beta1;

import "gogoproto/gogo.proto";
import "osmosis/swaprouter/v1beta1/genesis.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/v12/x/swaprouter/client/queryproto";

service Query {
rpc Params(ParamsRequest) returns (ParamsResponse) {
option (google.api.http).get = "/osmosis/swaprouter/v1beta1/Params";
}
}

message ParamsRequest {}
message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }
10 changes: 10 additions & 0 deletions proto/osmosis/swaprouter/v1beta1/query.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
keeper:
path: "github.com/osmosis-labs/osmosis/v12/x/swaprouter"
struct: "Keeper"
client_path: "github.com/osmosis-labs/osmosis/v12/x/swaprouter/client"
queries:
Params:
proto_wrapper:
query_func: "k.GetParams"
cli:
cmd: "GetParams"
32 changes: 32 additions & 0 deletions x/swaprouter/client/grpc/grpc_query.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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/v12/x/swaprouter/client"
"github.com/osmosis-labs/osmosis/v12/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)
}

21 changes: 21 additions & 0 deletions x/swaprouter/client/query_proto_wrap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package client

import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/osmosis-labs/osmosis/v12/x/swaprouter"
"github.com/osmosis-labs/osmosis/v12/x/swaprouter/client/queryproto"
)

// This file should evolve to being code gen'd, off of `proto/swaprouter/v1beta/query.yml`

type Querier struct {
K swaprouter.Keeper
}

func (q Querier) Params(ctx sdk.Context,
req queryproto.ParamsRequest,
) (*queryproto.ParamsResponse, error) {
params := q.K.GetParams(ctx)
return &queryproto.ParamsResponse{Params: params}, nil
}
Loading