round leverage max to fix slider
This commit is contained in:
parent
2b7da4b6a9
commit
1d334a571b
|
@ -1,5 +1,6 @@
|
|||
import { useMemo } from 'react'
|
||||
import useMangoGroup from './useMangoGroup'
|
||||
import { floorToDecimal } from 'utils/numbers'
|
||||
|
||||
export default function useLeverageMax(selectedToken: string) {
|
||||
const { group } = useMangoGroup()
|
||||
|
@ -25,7 +26,7 @@ export default function useLeverageMax(selectedToken: string) {
|
|||
const x = stakeInitAssetWeight.div(borrowInitLiabWeight).toNumber()
|
||||
const conversionRate = borrowBank.uiPrice / stakeBank.uiPrice
|
||||
const y = 1 - conversionRate * stakeInitAssetWeight.toNumber()
|
||||
return 1 + x / y
|
||||
return floorToDecimal(1 + x / y, 1).toNumber()
|
||||
}, [stakeBank, borrowBank])
|
||||
|
||||
return leverageMax
|
||||
|
|
Loading…
Reference in New Issue