Skip to content

Commit

Permalink
refactor(CL): move multihop to swap router, wire to concentrated liqu…
Browse files Browse the repository at this point in the history
…idity module (#3128)

* feat/refactor(CL): move multihop to swaprouter, connect to concentrated liquidity

* comments

* godoc for RouteExactAmountOut

* link issues

* delete multihop_test.go

* Update x/swaprouter/router_test.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Update x/swaprouter/router_test.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Update x/concentrated-liquidity/pool.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

* Update x/gamm/keeper/swap.go

Co-authored-by: Adam Tucker <adam@osmosis.team>

Co-authored-by: Adam Tucker <adam@osmosis.team>
  • Loading branch information
p0mvn and czarcas7ic authored Oct 24, 2022
1 parent d01291d commit b50a7b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions pool.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package concentrated_liquidity

import (
"errors"
fmt "fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -30,6 +31,11 @@ func (k Keeper) CreateNewConcentratedLiquidityPool(ctx sdk.Context, poolId uint6
return pool, nil
}

// GetPool returns a pool with a given id.
func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (types.PoolI, error) {
return nil, errors.New("not implemented")
}

func priceToTick(price sdk.Dec) sdk.Int {
logOfPrice := osmomath.BigDecFromSDKDec(price).LogBase2()
logInt := osmomath.NewDecWithPrec(10001, 4)
Expand Down
22 changes: 13 additions & 9 deletions swaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,31 @@ package concentrated_liquidity
import (
sdk "github.com/cosmos/cosmos-sdk/types"

swaproutertypes "github.com/osmosis-labs/osmosis/v12/x/swaprouter/types"
gammtypes "github.com/osmosis-labs/osmosis/v12/x/gamm/types"
)

// TODO: godoc
func (k Keeper) MultihopSwapExactAmountIn(
// TODO: spec here and in gamm
func (k Keeper) SwapExactAmountIn(
ctx sdk.Context,
sender sdk.AccAddress,
routes []swaproutertypes.SwapAmountInRoute,
pool gammtypes.PoolI,
tokenIn sdk.Coin,
tokenOutDenom string,
tokenOutMinAmount sdk.Int,
swapFee sdk.Dec,
) (tokenOutAmount sdk.Int, err error) {
return sdk.Int{}, nil
panic("not implemented")
}

// TODO: godoc
func (k Keeper) MultihopSwapExactAmountOut(
// TODO: spec here and in gamm
func (k Keeper) SwapExactAmountOut(
ctx sdk.Context,
sender sdk.AccAddress,
routes []swaproutertypes.SwapAmountOutRoute,
poolI gammtypes.PoolI,
tokenInDenom string,
tokenInMaxAmount sdk.Int,
tokenOut sdk.Coin,
swapFee sdk.Dec,
) (tokenInAmount sdk.Int, err error) {
return sdk.Int{}, nil
panic("not implemented")
}

0 comments on commit b50a7b4

Please sign in to comment.