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

Deprecate unused pool id field in swap estimate #6530

Merged
merged 9 commits into from
Nov 5, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### API Breaks

* [#6805](https://github.com/osmosis-labs/osmosis/pull/6805) return bucket index of the current tick from LiquidityPerTickRange query
* [#6530](https://github.com/osmosis-labs/osmosis/pull/6530) Improve error message when CL LP fails due to slippage bound hit.

## v20.0.0

Expand Down
12 changes: 8 additions & 4 deletions proto/osmosis/poolmanager/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,17 @@ message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }
message EstimateSwapExactAmountInRequest {
reserved 1;
reserved "sender";
uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
uint64 pool_id = 2
[ (gogoproto.moretags) = "yaml:\"pool_id\"", deprecated = true ];
string token_in = 3 [ (gogoproto.moretags) = "yaml:\"token_in\"" ];
repeated SwapAmountInRoute routes = 4 [
(gogoproto.moretags) = "yaml:\"routes\"",
(gogoproto.nullable) = false
];
}
message EstimateSwapExactAmountInWithPrimitiveTypesRequest {
uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
uint64 pool_id = 1
[ (gogoproto.moretags) = "yaml:\"pool_id\"", deprecated = true ];
string token_in = 2 [ (gogoproto.moretags) = "yaml:\"token_in\"" ];
repeated uint64 routes_pool_id = 3
[ (gogoproto.moretags) = "yaml:\"routes_pool_id\"" ];
Expand Down Expand Up @@ -180,7 +182,8 @@ message EstimateSwapExactAmountInResponse {
message EstimateSwapExactAmountOutRequest {
reserved 1;
reserved "sender";
uint64 pool_id = 2 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
uint64 pool_id = 2
[ (gogoproto.moretags) = "yaml:\"pool_id\"", deprecated = true ];
repeated SwapAmountOutRoute routes = 3 [
(gogoproto.moretags) = "yaml:\"routes\"",
(gogoproto.nullable) = false
Expand All @@ -189,7 +192,8 @@ message EstimateSwapExactAmountOutRequest {
}

message EstimateSwapExactAmountOutWithPrimitiveTypesRequest {
uint64 pool_id = 1 [ (gogoproto.moretags) = "yaml:\"pool_id\"" ];
uint64 pool_id = 1
[ (gogoproto.moretags) = "yaml:\"pool_id\"", deprecated = true ];
repeated uint64 routes_pool_id = 2
[ (gogoproto.moretags) = "yaml:\"routes_pool_id\"" ];
repeated string routes_token_in_denom = 3
Expand Down
4 changes: 2 additions & 2 deletions x/poolmanager/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func GetCmdEstimateSwapExactAmountIn() (*osmocli.QueryDescriptor, *queryproto.Es
Use: "estimate-swap-exact-amount-in",
Short: "Query estimate-swap-exact-amount-in",
Long: `Query estimate-swap-exact-amount-in.{{.ExampleHeader}}
{{.CommandPrefix}} estimate-swap-exact-amount-in 1 1000stake --swap-route-pool-ids=2 --swap-route-pool-ids=3`,
{{.CommandPrefix}} estimate-swap-exact-amount-in 1000stake --swap-route-pool-ids=2 --swap-route-pool-ids=3`,
ParseQuery: EstimateSwapExactAmountInParseArgs,
Flags: osmocli.FlagDesc{RequiredFlags: []*flag.FlagSet{FlagSetMultihopSwapRoutes()}},
QueryFnName: "EstimateSwapExactAmountIn",
Expand All @@ -60,7 +60,7 @@ func GetCmdEstimateSwapExactAmountOut() (*osmocli.QueryDescriptor, *queryproto.E
Use: "estimate-swap-exact-amount-out",
Short: "Query estimate-swap-exact-amount-out",
Long: `Query estimate-swap-exact-amount-out.{{.ExampleHeader}}
{{.CommandPrefix}} estimate-swap-exact-amount-out 1 1000stake --swap-route-pool-ids=2 --swap-route-pool-ids=3`,
{{.CommandPrefix}} estimate-swap-exact-amount-out 1000stake --swap-route-pool-ids=2 --swap-route-pool-ids=3`,
ParseQuery: EstimateSwapExactAmountOutParseArgs,
Flags: osmocli.FlagDesc{RequiredFlags: []*flag.FlagSet{FlagSetMultihopSwapRoutes()}},
QueryFnName: "EstimateSwapExactAmountOut",
Expand Down
6 changes: 2 additions & 4 deletions x/poolmanager/client/query_proto_wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,16 @@ func (q Querier) EstimateSwapExactAmountOutWithPrimitiveTypes(ctx sdk.Context, r

func (q Querier) EstimateSinglePoolSwapExactAmountOut(ctx sdk.Context, req queryproto.EstimateSinglePoolSwapExactAmountOutRequest) (*queryproto.EstimateSwapExactAmountOutResponse, error) {
routeReq := &queryproto.EstimateSwapExactAmountOutRequest{
PoolId: req.PoolId,
TokenOut: req.TokenOut,
Routes: types.SwapAmountOutRoutes{{PoolId: req.PoolId, TokenInDenom: req.TokenInDenom}},
Routes: types.SwapAmountOutRoutes{{TokenInDenom: req.TokenInDenom, PoolId: req.PoolId}},
}
return q.EstimateSwapExactAmountOut(ctx, *routeReq)
}

func (q Querier) EstimateSinglePoolSwapExactAmountIn(ctx sdk.Context, req queryproto.EstimateSinglePoolSwapExactAmountInRequest) (*queryproto.EstimateSwapExactAmountInResponse, error) {
routeReq := &queryproto.EstimateSwapExactAmountInRequest{
PoolId: req.PoolId,
TokenIn: req.TokenIn,
Routes: types.SwapAmountInRoutes{{PoolId: req.PoolId, TokenOutDenom: req.TokenOutDenom}},
Routes: types.SwapAmountInRoutes{{TokenOutDenom: req.TokenOutDenom, PoolId: req.PoolId}},
}
return q.EstimateSwapExactAmountIn(ctx, *routeReq)
}
Expand Down
Loading