MP-3482: replaced Max LTV with Max. Leverage (#550)

This commit is contained in:
Linkie Link 2023-10-17 09:09:48 +02:00 committed by GitHub
parent 759f2931d8
commit daa88ee548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,13 +20,14 @@ import { ChevronDown, SortAsc, SortDesc, SortNone } from 'components/Icons'
import Loading from 'components/Loading' import Loading from 'components/Loading'
import Text from 'components/Text' import Text from 'components/Text'
import TitleAndSubCell from 'components/TitleAndSubCell' import TitleAndSubCell from 'components/TitleAndSubCell'
import { BN_ONE } from 'constants/math'
import { ORACLE_DENOM } from 'constants/oracle' import { ORACLE_DENOM } from 'constants/oracle'
import { VAULT_DEPOSIT_BUFFER } from 'constants/vaults' import { VAULT_DEPOSIT_BUFFER } from 'constants/vaults'
import useStore from 'store' import useStore from 'store'
import { BNCoin } from 'types/classes/BNCoin' import { BNCoin } from 'types/classes/BNCoin'
import { VaultStatus } from 'types/enums/vault' import { VaultStatus } from 'types/enums/vault'
import { getAssetByDenom } from 'utils/assets' import { getAssetByDenom } from 'utils/assets'
import { formatPercent, produceCountdown } from 'utils/formatters' import { produceCountdown } from 'utils/formatters'
type Props = { type Props = {
data: Vault[] | DepositedVault[] data: Vault[] | DepositedVault[]
@ -180,11 +181,18 @@ export const VaultTable = (props: Props) => {
}, },
}, },
{ {
accessorKey: 'ltv.max', accessorKey: 'leverage.max',
header: 'Max LTV', header: 'Max. Leverage',
cell: ({ row }) => { cell: ({ row }) => {
if (props.isLoading) return <Loading /> if (props.isLoading) return <Loading />
return <Text className='text-xs'>{formatPercent(row.original.ltv.max)}</Text> const maxLeverage = BN_ONE.dividedBy(1 - row.original.ltv.max).toNumber()
return (
<FormattedNumber
amount={maxLeverage}
options={{ minDecimals: 2, suffix: 'x' }}
className='text-xs'
/>
)
}, },
}, },
{ {