fix
This commit is contained in:
parent
3c783eba34
commit
b271f5ca12
|
@ -126,7 +126,12 @@ function EditLeverageForm({
|
|||
)
|
||||
|
||||
const liquidationPrice = useMemo(() => {
|
||||
const price = Number(stakeBank?.uiPrice)
|
||||
let price
|
||||
if (borrowBank?.name == 'SOL') {
|
||||
price = Number(stakeBank?.uiPrice) / Number(borrowBank?.uiPrice)
|
||||
} else {
|
||||
price = Number(stakeBank?.uiPrice)
|
||||
}
|
||||
const borrowMaintLiabWeight = Number(borrowBank?.maintLiabWeight)
|
||||
const stakeMaintAssetWeight = Number(stakeBank?.maintAssetWeight)
|
||||
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
||||
|
|
|
@ -122,8 +122,13 @@ const PositionItem = ({
|
|||
}
|
||||
}, [acct, bank, jlpGroup, lstGroup])
|
||||
|
||||
const liqRatio = useMemo(() => {
|
||||
const price = Number(bank?.uiPrice)
|
||||
const liquidationPrice = useMemo(() => {
|
||||
let price
|
||||
if (borrowBank?.name == 'SOL') {
|
||||
price = Number(bank?.uiPrice) / Number(borrowBank?.uiPrice)
|
||||
} else {
|
||||
price = Number(bank?.uiPrice)
|
||||
}
|
||||
const borrowMaintLiabWeight = Number(borrowBank?.maintLiabWeight)
|
||||
const stakeMaintAssetWeight = Number(bank?.maintAssetWeight)
|
||||
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
||||
|
@ -132,7 +137,7 @@ const PositionItem = ({
|
|||
((borrowMaintLiabWeight * (1 + loanOriginationFee)) /
|
||||
stakeMaintAssetWeight) *
|
||||
(1 - 1 / leverage)
|
||||
return liqPrice.toFixed(3)
|
||||
return liqPrice.toFixed(2)
|
||||
}, [bank, borrowBank, leverage])
|
||||
|
||||
const { financialMetrics, stakeBankDepositRate, borrowBankBorrowRate } =
|
||||
|
@ -312,7 +317,10 @@ const PositionItem = ({
|
|||
<p className="mb-1 text-th-fgd-4">Est. Liquidation Price</p>
|
||||
<div className="flex flex-wrap items-end">
|
||||
<span className="mr-2 whitespace-nowrap text-xl font-bold text-th-fgd-1">
|
||||
${liqRatio}
|
||||
{liquidationPrice}
|
||||
{borrowBank?.name == ' USDC'
|
||||
? ' USDC'
|
||||
: ` ${bank?.name}/${borrowBank?.name}`}
|
||||
</span>
|
||||
</div>
|
||||
{/* {liqPriceChangePercentage ? (
|
||||
|
|
|
@ -43,7 +43,7 @@ import useLeverageMax from 'hooks/useLeverageMax'
|
|||
import { sleep } from 'utils'
|
||||
import ButtonGroup from './forms/ButtonGroup'
|
||||
import Decimal from 'decimal.js'
|
||||
import { toUiDecimals } from '@blockworks-foundation/mango-v4'
|
||||
import { Bank, toUiDecimals } from '@blockworks-foundation/mango-v4'
|
||||
import useIpAddress from 'hooks/useIpAddress'
|
||||
import {
|
||||
ClientContextKeys,
|
||||
|
@ -129,7 +129,12 @@ function StakeForm({ token: selectedToken, clientContext }: StakeFormProps) {
|
|||
}, [selectedToken, jlpGroup, lstGroup, clientContext])
|
||||
|
||||
const liquidationPrice = useMemo(() => {
|
||||
const price = Number(stakeBank?.uiPrice)
|
||||
let price
|
||||
if (borrowBank?.name == 'SOL') {
|
||||
price = Number(stakeBank?.uiPrice) / Number(borrowBank?.uiPrice)
|
||||
} else {
|
||||
price = Number(stakeBank?.uiPrice)
|
||||
}
|
||||
const borrowMaintLiabWeight = Number(borrowBank?.maintLiabWeight)
|
||||
const stakeMaintAssetWeight = Number(stakeBank?.maintAssetWeight)
|
||||
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
||||
|
@ -189,7 +194,6 @@ function StakeForm({ token: selectedToken, clientContext }: StakeFormProps) {
|
|||
(1 + priceDifference) * Number(inputAmount) * (leverage - 1)
|
||||
return borrowAmount
|
||||
}
|
||||
|
||||
}, [leverage, borrowBank, stakeBank, inputAmount])
|
||||
|
||||
const availableVaultBalance = useMemo(() => {
|
||||
|
@ -543,11 +547,13 @@ function StakeForm({ token: selectedToken, clientContext }: StakeFormProps) {
|
|||
: 'text-th-bkg-4'
|
||||
}`}
|
||||
>
|
||||
$
|
||||
<FormatNumericValue
|
||||
value={liquidationPrice}
|
||||
decimals={3}
|
||||
/>
|
||||
{borrowBank?.name == ' USDC'
|
||||
? ' USDC'
|
||||
: ` ${stakeBank?.name}/${borrowBank?.name}`}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,6 +14,6 @@ export const DownTriangle = ({ size }: { size?: 'small' | 'large' }) => (
|
|||
size === 'small'
|
||||
? 'border-l-[4px] border-r-[4px] border-t-[6.92px]'
|
||||
: 'border-l-[5px] border-r-[5px] border-t-[8.65px]'
|
||||
} border-l-transparent border-r-transparent border-t-th-down`}
|
||||
} border-t-th-down border-l-transparent border-r-transparent`}
|
||||
/>
|
||||
)
|
||||
|
|
|
@ -8,7 +8,12 @@ const nextConfig = {
|
|||
appDir: false,
|
||||
},
|
||||
images: {
|
||||
domains: ['raw.githubusercontent.com', 'arweave.net', 'www.dual.finance', 'static.jup.ag'],
|
||||
domains: [
|
||||
'raw.githubusercontent.com',
|
||||
'arweave.net',
|
||||
'www.dual.finance',
|
||||
'static.jup.ag',
|
||||
],
|
||||
},
|
||||
reactStrictMode: true,
|
||||
//proxy for openserum api cors
|
||||
|
|
Loading…
Reference in New Issue