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

Fix poolmanager query (backport #4403) #4409

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions x/poolmanager/client/cli/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ func (s *QueryTestSuite) TestQueriesNeverAlterState() {
&poolmanagerqueryproto.NumPoolsRequest{},
&poolmanagerqueryproto.NumPoolsResponse{},
},
{
"Query estimate swap in",
"/osmosis.poolmanager.v1beta1.Query/EstimateSwapExactAmountIn",
&poolmanagerqueryproto.EstimateSwapExactAmountInRequest{},
&poolmanagerqueryproto.EstimateSwapExactAmountInResponse{},
},
{
"Query estimate swap out",
"/osmosis.poolmanager.v1beta1.Query/EstimateSwapExactAmountOut",
&poolmanagerqueryproto.EstimateSwapExactAmountOutRequest{},
&poolmanagerqueryproto.EstimateSwapExactAmountOutResponse{},
},
}

for _, tc := range testCases {
Expand Down
4 changes: 4 additions & 0 deletions x/poolmanager/client/query_proto_wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ type Querier struct {
K poolmanager.Keeper
}

func NewQuerier(k poolmanager.Keeper) Querier {
return Querier{k}
}

func (q Querier) Params(ctx sdk.Context,
req queryproto.ParamsRequest,
) (*queryproto.ParamsResponse, error) {
Expand Down
3 changes: 3 additions & 0 deletions x/poolmanager/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import (
"github.com/osmosis-labs/osmosis/v14/simulation/simtypes"
gammsimulation "github.com/osmosis-labs/osmosis/v14/x/gamm/simulation"
"github.com/osmosis-labs/osmosis/v14/x/poolmanager"
pmclient "github.com/osmosis-labs/osmosis/v14/x/poolmanager/client"
"github.com/osmosis-labs/osmosis/v14/x/poolmanager/client/cli"
"github.com/osmosis-labs/osmosis/v14/x/poolmanager/client/grpc"
"github.com/osmosis-labs/osmosis/v14/x/poolmanager/client/queryproto"
"github.com/osmosis-labs/osmosis/v14/x/poolmanager/types"
)
Expand Down Expand Up @@ -82,6 +84,7 @@ type AppModule struct {

func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), poolmanager.NewMsgServerImpl(&am.k))
queryproto.RegisterQueryServer(cfg.QueryServer(), grpc.Querier{Q: pmclient.NewQuerier(am.k)})
}

func NewAppModule(poolmanagerKeeper poolmanager.Keeper, gammKeeper types.SwapI) AppModule {
Expand Down