From 41da4bdc767068c783e9ef5200f49c8b72eea4b8 Mon Sep 17 00:00:00 2001 From: max <39312833+fritzschoff@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:50:03 +0100 Subject: [PATCH] fix(depositform): max input value (#246) * fix(depositform): max input value * chore(linting): added deps to use memo hook --- .../src/components/Accounts/Deposit/DepositForm.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/liquidity/ui/src/components/Accounts/Deposit/DepositForm.tsx b/liquidity/ui/src/components/Accounts/Deposit/DepositForm.tsx index 22c65fb02..5ccb86823 100644 --- a/liquidity/ui/src/components/Accounts/Deposit/DepositForm.tsx +++ b/liquidity/ui/src/components/Accounts/Deposit/DepositForm.tsx @@ -72,6 +72,9 @@ export function DepositFormUi({ if (collateralType?.symbol === 'SNX') { return snxBalance?.transferable; } + if (collateralType?.symbol === 'USDC') { + return tokenBalance?.add(accountCollateral?.availableCollateral); + } if (collateralType?.symbol !== 'WETH') { return tokenBalance; } @@ -79,7 +82,13 @@ export function DepositFormUi({ return undefined; } return tokenBalance.add(ethBalance); - }, [collateralType?.symbol, tokenBalance, ethBalance, snxBalance?.transferable]); + }, [ + collateralType?.symbol, + tokenBalance, + ethBalance, + snxBalance?.transferable, + accountCollateral?.availableCollateral, + ]); const [isOpenDeposit, setIsOpenDeposit] = useState(false);