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 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