fix compile error

This commit is contained in:
Maximilian Schneider 2022-08-18 08:25:53 +02:00
parent ed30884830
commit acd47fe435
1 changed files with 6 additions and 9 deletions

View File

@ -205,7 +205,7 @@ export default function AdvancedTradeForm({
const { max, deposits, borrows, spotMax, reduceMax } = useMemo(() => { const { max, deposits, borrows, spotMax, reduceMax } = useMemo(() => {
const defaultValues = { const defaultValues = {
max: ZERO_I80F48, max: 0,
deposits: ZERO_I80F48, deposits: ZERO_I80F48,
borrows: ZERO_I80F48, borrows: ZERO_I80F48,
spotMax: 0, spotMax: 0,
@ -218,7 +218,7 @@ export default function AdvancedTradeForm({
? I80F48.fromNumber(price) ? I80F48.fromNumber(price)
: mangoGroup.getPrice(marketIndex, mangoCache) : mangoGroup.getPrice(marketIndex, mangoCache)
let spotMax let spotMax = 0
if (marketConfig.kind === 'spot') { if (marketConfig.kind === 'spot') {
const token = const token =
side === 'buy' side === 'buy'
@ -233,7 +233,7 @@ export default function AdvancedTradeForm({
).toNumber(), ).toNumber(),
token.decimals token.decimals
) )
const depositBalance = mangoAccount const depositBalance = mangoAccount
.getUiDeposit( .getUiDeposit(
mangoCache.rootBankCache[tokenIndex], mangoCache.rootBankCache[tokenIndex],
@ -246,9 +246,8 @@ export default function AdvancedTradeForm({
side === 'buy' side === 'buy'
? availableBalance / priceOrDefault.toNumber() ? availableBalance / priceOrDefault.toNumber()
: spotMargin : spotMargin
? availableBalance ? availableBalance
: depositBalance : depositBalance
}
} }
const { const {
@ -264,12 +263,10 @@ export default function AdvancedTradeForm({
priceOrDefault priceOrDefault
) )
let reduceMax let reduceMax = 0
if (market && market instanceof PerpMarket) { if (market && market instanceof PerpMarket) {
reduceMax = reduceMax =
Math.abs(market?.baseLotsToNumber(perpAccount?.basePosition)) || 0 Math.abs(market?.baseLotsToNumber(perpAccount?.basePosition)) || 0
} else {
reduceMax = 0
} }
if (maxQuote.toNumber() <= 0) return defaultValues if (maxQuote.toNumber() <= 0) return defaultValues