diff --git a/src/components/views/Borrow.tsx b/src/components/views/Borrow.tsx index 8da84f2f4..a59b82a44 100644 --- a/src/components/views/Borrow.tsx +++ b/src/components/views/Borrow.tsx @@ -60,7 +60,8 @@ const Borrow = () => { /* STATE FROM CONTEXT */ const { userState, userActions } = useContext(UserContext); - const { assetMap, vaultMap, seriesMap, selectedSeries, selectedIlk, selectedBase, selectedVault } = userState; + const { assetMap, vaultMap, vaultsLoading, seriesMap, selectedSeries, selectedIlk, selectedBase, selectedVault } = + userState; const { setSelectedIlk } = userActions; const { address: activeAccount } = useAccountPlus(); @@ -549,7 +550,9 @@ const Borrow = () => { borrowProcess?.tx.status === TxState.SUCCESSFUL && ( View Vault: - {vaultToUse && } + {vaultToUse && !vaultsLoading && ( + + )} {!vaultToUse && newVaultId && ( )} 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;