From acd47fe435bf467f3c1ce23f445dbda8267744ef Mon Sep 17 00:00:00 2001 From: Maximilian Schneider Date: Thu, 18 Aug 2022 08:25:53 +0200 Subject: [PATCH] fix compile error --- components/trade_form/AdvancedTradeForm.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/components/trade_form/AdvancedTradeForm.tsx b/components/trade_form/AdvancedTradeForm.tsx index 9f1f733e..fc7c06e5 100644 --- a/components/trade_form/AdvancedTradeForm.tsx +++ b/components/trade_form/AdvancedTradeForm.tsx @@ -205,7 +205,7 @@ export default function AdvancedTradeForm({ const { max, deposits, borrows, spotMax, reduceMax } = useMemo(() => { const defaultValues = { - max: ZERO_I80F48, + max: 0, deposits: ZERO_I80F48, borrows: ZERO_I80F48, spotMax: 0, @@ -218,7 +218,7 @@ export default function AdvancedTradeForm({ ? I80F48.fromNumber(price) : mangoGroup.getPrice(marketIndex, mangoCache) - let spotMax + let spotMax = 0 if (marketConfig.kind === 'spot') { const token = side === 'buy' @@ -233,7 +233,7 @@ export default function AdvancedTradeForm({ ).toNumber(), token.decimals ) - + const depositBalance = mangoAccount .getUiDeposit( mangoCache.rootBankCache[tokenIndex], @@ -246,9 +246,8 @@ export default function AdvancedTradeForm({ side === 'buy' ? availableBalance / priceOrDefault.toNumber() : spotMargin - ? availableBalance - : depositBalance - } + ? availableBalance + : depositBalance } const { @@ -264,12 +263,10 @@ export default function AdvancedTradeForm({ priceOrDefault ) - let reduceMax + let reduceMax = 0 if (market && market instanceof PerpMarket) { reduceMax = Math.abs(market?.baseLotsToNumber(perpAccount?.basePosition)) || 0 - } else { - reduceMax = 0 } if (maxQuote.toNumber() <= 0) return defaultValues