diff --git a/x/concentrated-liquidity/swaps.go b/x/concentrated-liquidity/swaps.go index 9d811f8366d..d5650e53adf 100644 --- a/x/concentrated-liquidity/swaps.go +++ b/x/concentrated-liquidity/swaps.go @@ -467,8 +467,6 @@ func (k Keeper) calcInAmtGivenOut( return writeCtx, sdk.Coin{}, sdk.Coin{}, sdk.Int{}, sdk.Dec{}, sdk.Dec{}, err } - fmt.Println("Desired: ", desiredTokenOut.Denom, tokenInDenom, asset0, asset1) - // check that the specified tokenOut matches one of the assets in the specified pool if desiredTokenOut.Denom != asset0 && desiredTokenOut.Denom != asset1 { return writeCtx, sdk.Coin{}, sdk.Coin{}, sdk.Int{}, sdk.Dec{}, sdk.Dec{}, types.TokenOutDenomNotInPoolError{TokenOutDenom: desiredTokenOut.Denom} @@ -505,13 +503,13 @@ func (k Keeper) calcInAmtGivenOut( // if no ticks are initialized (no users have created liquidity positions) then we return an error nextTick, ok := swapStrategy.NextInitializedTick(ctx, poolId, swapState.tick.Int64()) if !ok { - return writeCtx, sdk.Coin{}, sdk.Coin{}, sdk.Int{}, sdk.Dec{}, sdk.Dec{}, types.UninitilizedTickError{NextTick: nextTick} + return writeCtx, sdk.Coin{}, sdk.Coin{}, sdk.Int{}, sdk.Dec{}, sdk.Dec{}, types.InvalidTickError{} } // utilizing the next initialized tick, we find the corresponding nextPrice (the target price) sqrtPriceNextTick, err := math.TickToSqrtPrice(nextTick) if err != nil { - return writeCtx, sdk.Coin{}, sdk.Coin{}, sdk.Int{}, sdk.Dec{}, sdk.Dec{}, types.TickToSqrtPriceConversionError{SqrtPriceNextTick: sqrtPriceNextTick} + return writeCtx, sdk.Coin{}, sdk.Coin{}, sdk.Int{}, sdk.Dec{}, sdk.Dec{}, types.TickToSqrtPriceConversionError{NextTick: nextTick} } sqrtPriceTarget := swapStrategy.GetSqrtTargetPrice(sqrtPriceNextTick) diff --git a/x/concentrated-liquidity/types/errors.go b/x/concentrated-liquidity/types/errors.go index 8dcdc04df45..9d206d3f2f5 100644 --- a/x/concentrated-liquidity/types/errors.go +++ b/x/concentrated-liquidity/types/errors.go @@ -816,18 +816,10 @@ func (e SqrtRootCalculationError) Error() string { return fmt.Sprintf("issue calculating square root of price limit %s", e.SqrtPriceLimit) } -type UninitilizedTickError struct { - NextTick sdk.Int -} - -func (e UninitilizedTickError) Error() string { - return fmt.Sprintf("there are no more ticks initialized to fill the swap %s", e.NextTick) -} - type TickToSqrtPriceConversionError struct { - SqrtPriceNextTick sdk.Dec + NextTick sdk.Int } func (e TickToSqrtPriceConversionError) Error() string { - return fmt.Sprintf("could not convert next tick (%v) to nextSqrtPrice", e.SqrtPriceNextTick) + return fmt.Sprintf("could not convert next tick to nextSqrtPrice (%v)", e.NextTick) }