Handle margined deposit balances in SpotMax (#396)
- Adjust 100% of spotMax to equal deposit amount, not available balance
This commit is contained in:
parent
8fcdbf991b
commit
44aadc2463
|
@ -233,11 +233,22 @@ export default function AdvancedTradeForm({
|
|||
).toNumber(),
|
||||
token.decimals
|
||||
)
|
||||
|
||||
const depositBalance = mangoAccount
|
||||
.getUiDeposit(
|
||||
mangoCache.rootBankCache[tokenIndex],
|
||||
mangoGroup,
|
||||
tokenIndex
|
||||
)
|
||||
.toNumber()
|
||||
|
||||
spotMax =
|
||||
side === 'buy'
|
||||
? availableBalance / priceOrDefault.toNumber()
|
||||
: availableBalance
|
||||
: spotMargin
|
||||
? availableBalance
|
||||
: depositBalance
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
|
|
Loading…
Reference in New Issue