osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

[x/gamm]: Add RPC query endpoints for joining and exiting pools

Open georgemc98 opened this issue 2 years ago • 2 comments

Background

It would be helpful to have a RPC query that returns the lp shares when providing liquidity to a pool. It would also be helpful to have a query that returns the assets returned withdrawing liquidity from a liquidity pool. These queries will be useful when using a StargateQuery in cosmwasm smart contracts.

Suggested Design

Here is the commit for the PoolType query that was added recently: https://github.com/osmosis-labs/osmosis/commit/e55e13d709628cff2075ae1576f993ed2a8c310e. The design should follow the steps taken in this commit to add RPC end points for the four following queries:

  • QueryJoinPool
    • Parameters: QueryJoinPoolSharesRequest{ PoolId, TokenInMaxs}
    • Returns: QueryJoinPoolSharesResponse { ShareOutAmount, TokenIn }
  • QueryJoinSwapExactAmountIn
    • Parameters: QueryJoinSwapExactAmountInRequest{ PoolId, TokenIn}
    • Returns: QueryJoinSwapExactAmountInResponse { ShareOutAmount }
  • QueryExitPool
    • Parameters: QueryExitPoolSharesRequest{ PoolId, ShareInAmount }
    • Returns: QueryExitPoolSharesResponse { TokenOut }
  • QueryExitSwapShareAmountIn
    • Parameters: QueryExitSwapShareAmountInRequest{ PoolId, TokenOutDenom, ShareInAmount }
    • Returns: QueryExitSwapShareAmountInResponse { TokenOutAmount }

georgemc98 avatar Oct 06 '22 01:10 georgemc98

I would like to work on this issue!

pysel avatar Oct 06 '22 12:10 pysel

I would like to work on this issue!

Excellent. I am going to start on QueryJoinPool and QueryExitPool today.

georgemc98 avatar Oct 06 '22 13:10 georgemc98