osmosis
osmosis copied to clipboard
[x/gamm]: Add RPC query endpoints for joining and exiting pools
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 }
I would like to work on this issue!
I would like to work on this issue!
Excellent. I am going to start on QueryJoinPool
and QueryExitPool
today.