diff --git a/types/math/math.go b/types/math/math.go index b5240c64ba..c32aacc996 100644 --- a/types/math/math.go +++ b/types/math/math.go @@ -5,7 +5,6 @@ import ( "cosmossdk.io/errors" "fmt" "github.com/cockroachdb/apd/v2" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var exactContext = apd.Context{ @@ -49,7 +48,7 @@ func SafeSubBalance(x Dec, y Dec) (Dec, error) { } if z.IsNegative() { - return z, sdkerrors.ErrInsufficientFunds + return z, errNegativeSub } return z, nil @@ -61,8 +60,7 @@ func SafeAddBalance(x Dec, y Dec) (Dec, error) { var z Dec if x.IsNegative() || y.IsNegative() { - return z, sdkerrors.ErrInvalidRequest.Wrap(fmt.Sprintf("AddBalance() requires two non-negative Dec parameters, but received %s and %s", x, y)) - + return z, fmt.Errorf("SafeAddBalance() requires two non-negative Dec parameters, but received %s and %s", x, y) } if _, err := exactContext.Add(&z.dec, &x.dec, &y.dec); err != nil {