On succesful response, we receive the amounts of each token withdrawn
for the provided share liquidity amount.
```go
type MsgWithdrawPositionResponse struct {
Amount0 github_com_cosmos_cosmos_sdk_types.Int
Amount1 github_com_cosmos_cosmos_sdk_types.Int
}
```
This message should call the `withdrawPosition` keeper method that is introduced in the `"Liquidity Provision"` section of this document.
##### `SwapExactAmountIn` Keeper Method
This method has the same interface as the pre-existing `SwapExactAmountIn` in the `x/gamm` module.
It takes an exact amount of coins of one denom in to return a minimum amount of tokenOutDenom.
```go
func (k Keeper) SwapExactAmountIn(
ctx sdk.Context,
sender sdk.AccAddress,
pool gammtypes.PoolI,
tokenIn sdk.Coin,
tokenOutDenom string,
tokenOutMinAmount sdk.Int,
swapFee sdk.Dec,
) (tokenOutAmount sdk.Int, err error) {
...
}
```
This method should be called from the new `swap-router` module's `RouteExactAmountIn` initiated by the `MsgSwapExactAmountIn`.
See the next `"Swap Router Module"` section of this document for more details.
##### `SwapExactAmountOut` Keeper Method
This method is comparable to `SwapExactAmountIn`. It has the same interface as the pre-existing `SwapExactAmountOut` in the `x/gamm` module.
It takes an exact amount of coins of one denom out to return a maximum amount of tokenInDenom.
```go
func (k Keeper) SwapExactAmountOut(
ctx sdk.Context,
sender sdk.AccAddress,
poolI gammtypes.PoolI,
tokenInDenom string,
tokenInMaxAmount sdk.Int,
tokenOut sdk.Coin,
swapFee sdk.Dec,
) (tokenInAmount sdk.Int, err error) {
...
}
```
This method should be called from the new `swap-router` module's `RouteExactAmountOut` initiated by the `MsgSwapExactAmountOut`.
See the next `"Swap Router Module"` section of this document for more details.
#### Swap Router Module
...
...
@@ -127,7 +242,7 @@ To avoid fragmenting swap entrypoints and duplicating boilerplate logic, we woul
a new `swap-router` module. For now, its only purpose is to receive swap messages and propagate them
either to the `gamm` or `concentrated-liquidity` modules.
Therefore, we should move the existing `gamm` swap messages and tests to the new `swap-router` module, connecting to the `swap-router` keeper that simply propagates swaps to `gamm` or `concentrated-liquidity` modules.
Therefore, we move the existing `gamm` swap messages and tests to the new `swap-router` module, connecting to the `swap-router` keeper that simply propagates swaps to `gamm` or `concentrated-liquidity` modules.
The messages to move are:
- `MsgSwapExactAmountIn`
...
...
@@ -170,7 +285,7 @@ The deltaX and the deltaY would be the actual amount of tokens joined for the re
Given the parameters needed for calculating the tokens needed for creating a position for a given tick, the API in the msg server layer would look like the following: