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

refactor(CL): move multihop to swap router, wire to concentrated liquidity module #3128

Merged
merged 10 commits into from
Oct 24, 2022
2 changes: 1 addition & 1 deletion app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func (s *KeeperTestHelper) SwapAndSetSpotPrice(poolId uint64, fromAsset sdk.Coin
coins := sdk.Coins{sdk.NewInt64Coin(fromAsset.Denom, 100000000000000)}
s.FundAcc(acc1, coins)

_, err := s.App.GAMMKeeper.SwapExactAmountOut(
_, err := s.App.GAMMKeeper.SwapExactAmountOutDefaultSwapFee(
s.Ctx,
acc1,
poolId,
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.keys[txfeestypes.StoreKey],
appKeepers.GAMMKeeper,
appKeepers.SwapRouterKeeper,
appKeepers.GAMMKeeper,
txfeestypes.FeeCollectorName,
txfeestypes.NonNativeFeeCollectorName,
Expand Down
6 changes: 6 additions & 0 deletions x/concentrated-liquidity/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).ApproxLog2()
logInt := osmomath.NewDecWithPrec(10001, 4)
Expand Down
22 changes: 13 additions & 9 deletions x/concentrated-liquidity/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")
}
142 changes: 0 additions & 142 deletions x/gamm/keeper/multihop.go

This file was deleted.

Loading