diff --git a/x/dex/keeper/grpc_query_estimate_multi_hop_swap_test.go b/x/dex/keeper/grpc_query_estimate_multi_hop_swap_test.go index 32338de0b..aa3e18cfb 100644 --- a/x/dex/keeper/grpc_query_estimate_multi_hop_swap_test.go +++ b/x/dex/keeper/grpc_query_estimate_multi_hop_swap_test.go @@ -46,7 +46,7 @@ func (s *DexTestSuite) TestEstimateMultiHopSwapInsufficientLiquiditySingleRoute( // THEN estimate multihopswap fails route := [][]string{{"TokenA", "TokenB", "TokenC", "TokenD"}} s.aliceEstimatesMultiHopSwapFails( - types.ErrLimitPriceNotSatisfied, + types.ErrNoLiquidity, route, 100, math_utils.MustNewPrecDecFromStr("0.9"), diff --git a/x/dex/keeper/integration_multihopswap_test.go b/x/dex/keeper/integration_multihopswap_test.go index bb16f2dca..0ca12fa6c 100644 --- a/x/dex/keeper/integration_multihopswap_test.go +++ b/x/dex/keeper/integration_multihopswap_test.go @@ -195,7 +195,7 @@ func (s *DexTestSuite) TestMultiHopSwapInsufficientLiquiditySingleRoute() { // THEN alice multihopswap fails route := [][]string{{"TokenA", "TokenB", "TokenC", "TokenD"}} s.aliceMultiHopSwapFails( - types.ErrLimitPriceNotSatisfied, + types.ErrNoLiquidity, route, 100, math_utils.MustNewPrecDecFromStr("0.9"), diff --git a/x/dex/keeper/integration_placelimitorder_test.go b/x/dex/keeper/integration_placelimitorder_test.go index 18f659287..27afad48a 100644 --- a/x/dex/keeper/integration_placelimitorder_test.go +++ b/x/dex/keeper/integration_placelimitorder_test.go @@ -528,7 +528,7 @@ func (s *DexTestSuite) TestPlaceLimitOrderIoCNoLiq() { s.fundAliceBalances(10, 0) // GIVEN no liquidity // Thenalice IoC limitOrder fails - s.assertAliceLimitSellFails(types.ErrLimitPriceNotSatisfied, "TokenA", 0, 10, types.LimitOrderType_IMMEDIATE_OR_CANCEL) + s.assertAliceLimitSellFails(types.ErrNoLiquidity, "TokenA", 0, 10, types.LimitOrderType_IMMEDIATE_OR_CANCEL) } func (s *DexTestSuite) TestPlaceLimitOrderIoCWithLPFills() { @@ -571,7 +571,7 @@ func (s *DexTestSuite) TestPlaceLimitOrderIoCWithLPNoFill() { // GIVEN LP of 5 tokenB at tick -1 s.bobDeposits(NewDeposit(0, 5, -1, 1)) // THEN alice IoC limitOrder for 10 tokenA below current 0To1 price fails - s.assertAliceLimitSellFails(types.ErrLimitPriceNotSatisfied, "TokenA", -1, 10, types.LimitOrderType_IMMEDIATE_OR_CANCEL) + s.assertAliceLimitSellFails(types.ErrNoLiquidity, "TokenA", -1, 10, types.LimitOrderType_IMMEDIATE_OR_CANCEL) } func (s *DexTestSuite) TestPlaceLimitOrderIoCTooSmallFails() { diff --git a/x/dex/keeper/liquidity.go b/x/dex/keeper/liquidity.go index c3f8f61eb..80385bce0 100644 --- a/x/dex/keeper/liquidity.go +++ b/x/dex/keeper/liquidity.go @@ -145,7 +145,7 @@ func (k Keeper) TakerLimitOrderSwap( } if totalInCoin.Amount.IsZero() { - return sdk.Coin{}, sdk.Coin{}, types.ErrLimitPriceNotSatisfied + return sdk.Coin{}, sdk.Coin{}, types.ErrNoLiquidity } truePrice := math_utils.NewPrecDecFromInt(totalOutCoin.Amount).QuoInt(totalInCoin.Amount) diff --git a/x/dex/keeper/multihop_swap.go b/x/dex/keeper/multihop_swap.go index 32d688857..81e912306 100644 --- a/x/dex/keeper/multihop_swap.go +++ b/x/dex/keeper/multihop_swap.go @@ -284,7 +284,7 @@ func (k Keeper) SwapFullAmountIn( return sdk.Coin{}, sdk.Coin{}, err } if !orderFilled { - return sdk.Coin{}, sdk.Coin{}, types.ErrLimitPriceNotSatisfied + return sdk.Coin{}, sdk.Coin{}, types.ErrNoLiquidity } dust = sdk.Coin.Sub(sdk.NewCoin(swapAmountTakerDenom.Denom, amountIn), swapAmountTakerDenom) diff --git a/x/dex/types/errors.go b/x/dex/types/errors.go index 69211ca8f..2c639904b 100644 --- a/x/dex/types/errors.go +++ b/x/dex/types/errors.go @@ -224,4 +224,9 @@ var ( 1163, "Cannot convert price to int64 tick value", ) + ErrNoLiquidity = sdkerrors.Register( + ModuleName, + 1164, + "No tradable liquidity below LimitSellPrice", + ) )