diff --git a/components/EditLeverageForm.tsx b/components/EditLeverageForm.tsx index 88fa9dd..c070f15 100644 --- a/components/EditLeverageForm.tsx +++ b/components/EditLeverageForm.tsx @@ -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) diff --git a/components/Positions.tsx b/components/Positions.tsx index 568ed7e..9f78d3b 100644 --- a/components/Positions.tsx +++ b/components/Positions.tsx @@ -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 = ({

Est. Liquidation Price

- ${liqRatio} + {liquidationPrice} + {borrowBank?.name == ' USDC' + ? ' USDC' + : ` ${bank?.name}/${borrowBank?.name}`}
{/* {liqPriceChangePercentage ? ( diff --git a/components/StakeForm.tsx b/components/StakeForm.tsx index bb48375..708005b 100644 --- a/components/StakeForm.tsx +++ b/components/StakeForm.tsx @@ -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' }`} > - $ + {borrowBank?.name == ' USDC' + ? ' USDC' + : ` ${stakeBank?.name}/${borrowBank?.name}`} diff --git a/components/shared/DirectionTriangles.tsx b/components/shared/DirectionTriangles.tsx index 1d79cfd..444411b 100644 --- a/components/shared/DirectionTriangles.tsx +++ b/components/shared/DirectionTriangles.tsx @@ -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`} /> ) diff --git a/next.config.js b/next.config.js index 458d05b..395d7a3 100644 --- a/next.config.js +++ b/next.config.js @@ -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