From c6c24494b4f768cad6070045f45c082bc2f806c3 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Thu, 7 Mar 2024 23:07:43 +0100 Subject: [PATCH] Make a protorev error a constant (#7687) --- x/protorev/keeper/routes.go | 2 +- x/protorev/types/errors.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/x/protorev/keeper/routes.go b/x/protorev/keeper/routes.go index fd2f5598c56..483baa21616 100644 --- a/x/protorev/keeper/routes.go +++ b/x/protorev/keeper/routes.go @@ -191,7 +191,7 @@ func (k Keeper) BuildTwoPoolRoute( } if pool1 == pool2 { - return RouteMetaData{}, fmt.Errorf("cannot be trading on the same pool twice") + return RouteMetaData{}, types.ErrRouteDoubleContainsPool } newRoute := poolmanagertypes.SwapAmountInRoutes{ diff --git a/x/protorev/types/errors.go b/x/protorev/types/errors.go index ae8ddfe0f49..b23443c354a 100644 --- a/x/protorev/types/errors.go +++ b/x/protorev/types/errors.go @@ -10,3 +10,5 @@ type NoPoolForDenomPairError struct { func (e NoPoolForDenomPairError) Error() string { return fmt.Sprintf("highest liquidity pool between base %s and match denom %s not found", e.BaseDenom, e.MatchDenom) } + +var ErrRouteDoubleContainsPool = fmt.Errorf("cannot be trading on the same pool twice")