From 01e138d9ce49925d327218d27cdb0c06d74f2bf4 Mon Sep 17 00:00:00 2001 From: Jacob Bryant Date: Fri, 10 Mar 2023 14:59:48 -0500 Subject: [PATCH] fixing lend input validation --- src/hooks/useInputValidation.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hooks/useInputValidation.ts b/src/hooks/useInputValidation.ts index cb2d06466..2f974e410 100644 --- a/src/hooks/useInputValidation.ts +++ b/src/hooks/useInputValidation.ts @@ -33,7 +33,8 @@ export const useInputValidation = ( const _inputAsFloat = parseFloat(input); const aboveMax: boolean = !!limits[1] && _inputAsFloat > parseFloat(limits[1].toString()); const belowMin: boolean = !!limits[0] && _inputAsFloat < parseFloat(limits[0].toString()); - const aboveUserBalance: boolean = aboveMax && !protocolLimited + const aboveUserBalance: boolean = aboveMax && !protocolLimited; + const aboveProtocolLendLimit: boolean = aboveMax && protocolLimited; // General input validation here: if (parseFloat(input) < 0 && actionCode !== ActionCodes.TRANSFER_VAULT) { @@ -90,7 +91,7 @@ export const useInputValidation = ( case ActionCodes.LEND: aboveUserBalance && setInputError('Amount exceeds available balance'); - protocolLimited && setInputError('Amount exceeds the maximum you can lend'); + aboveProtocolLendLimit && setInputError('Amount exceeds the maximum you can lend'); belowMin && setInputError('Amount should be expressed as a positive value'); break;