parent
3c783eba34
commit
e1b599ea0d
|
@ -126,7 +126,12 @@ function EditLeverageForm({
|
||||||
)
|
)
|
||||||
|
|
||||||
const liquidationPrice = useMemo(() => {
|
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 borrowMaintLiabWeight = Number(borrowBank?.maintLiabWeight)
|
||||||
const stakeMaintAssetWeight = Number(stakeBank?.maintAssetWeight)
|
const stakeMaintAssetWeight = Number(stakeBank?.maintAssetWeight)
|
||||||
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
||||||
|
|
|
@ -122,8 +122,13 @@ const PositionItem = ({
|
||||||
}
|
}
|
||||||
}, [acct, bank, jlpGroup, lstGroup])
|
}, [acct, bank, jlpGroup, lstGroup])
|
||||||
|
|
||||||
const liqRatio = useMemo(() => {
|
const liquidationPrice = useMemo(() => {
|
||||||
const price = Number(bank?.uiPrice)
|
let price
|
||||||
|
if (borrowBank?.name == 'SOL') {
|
||||||
|
price = Number(bank?.uiPrice) / Number(borrowBank?.uiPrice)
|
||||||
|
} else {
|
||||||
|
price = Number(bank?.uiPrice)
|
||||||
|
}
|
||||||
const borrowMaintLiabWeight = Number(borrowBank?.maintLiabWeight)
|
const borrowMaintLiabWeight = Number(borrowBank?.maintLiabWeight)
|
||||||
const stakeMaintAssetWeight = Number(bank?.maintAssetWeight)
|
const stakeMaintAssetWeight = Number(bank?.maintAssetWeight)
|
||||||
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
||||||
|
@ -132,7 +137,7 @@ const PositionItem = ({
|
||||||
((borrowMaintLiabWeight * (1 + loanOriginationFee)) /
|
((borrowMaintLiabWeight * (1 + loanOriginationFee)) /
|
||||||
stakeMaintAssetWeight) *
|
stakeMaintAssetWeight) *
|
||||||
(1 - 1 / leverage)
|
(1 - 1 / leverage)
|
||||||
return liqPrice.toFixed(3)
|
return liqPrice.toFixed(2)
|
||||||
}, [bank, borrowBank, leverage])
|
}, [bank, borrowBank, leverage])
|
||||||
|
|
||||||
const { financialMetrics, stakeBankDepositRate, borrowBankBorrowRate } =
|
const { financialMetrics, stakeBankDepositRate, borrowBankBorrowRate } =
|
||||||
|
@ -312,7 +317,10 @@ const PositionItem = ({
|
||||||
<p className="mb-1 text-th-fgd-4">Est. Liquidation Price</p>
|
<p className="mb-1 text-th-fgd-4">Est. Liquidation Price</p>
|
||||||
<div className="flex flex-wrap items-end">
|
<div className="flex flex-wrap items-end">
|
||||||
<span className="mr-2 whitespace-nowrap text-xl font-bold text-th-fgd-1">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{/* {liqPriceChangePercentage ? (
|
{/* {liqPriceChangePercentage ? (
|
||||||
|
|
|
@ -129,7 +129,12 @@ function StakeForm({ token: selectedToken, clientContext }: StakeFormProps) {
|
||||||
}, [selectedToken, jlpGroup, lstGroup, clientContext])
|
}, [selectedToken, jlpGroup, lstGroup, clientContext])
|
||||||
|
|
||||||
const liquidationPrice = useMemo(() => {
|
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 borrowMaintLiabWeight = Number(borrowBank?.maintLiabWeight)
|
||||||
const stakeMaintAssetWeight = Number(stakeBank?.maintAssetWeight)
|
const stakeMaintAssetWeight = Number(stakeBank?.maintAssetWeight)
|
||||||
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
const loanOriginationFee = Number(borrowBank?.loanOriginationFeeRate)
|
||||||
|
@ -189,7 +194,6 @@ function StakeForm({ token: selectedToken, clientContext }: StakeFormProps) {
|
||||||
(1 + priceDifference) * Number(inputAmount) * (leverage - 1)
|
(1 + priceDifference) * Number(inputAmount) * (leverage - 1)
|
||||||
return borrowAmount
|
return borrowAmount
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [leverage, borrowBank, stakeBank, inputAmount])
|
}, [leverage, borrowBank, stakeBank, inputAmount])
|
||||||
|
|
||||||
const availableVaultBalance = useMemo(() => {
|
const availableVaultBalance = useMemo(() => {
|
||||||
|
@ -543,11 +547,13 @@ function StakeForm({ token: selectedToken, clientContext }: StakeFormProps) {
|
||||||
: 'text-th-bkg-4'
|
: 'text-th-bkg-4'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
$
|
|
||||||
<FormatNumericValue
|
<FormatNumericValue
|
||||||
value={liquidationPrice}
|
value={liquidationPrice}
|
||||||
decimals={3}
|
decimals={3}
|
||||||
/>
|
/>
|
||||||
|
{borrowBank?.name == ' USDC'
|
||||||
|
? ' USDC'
|
||||||
|
: ` ${stakeBank?.name}/${borrowBank?.name}`}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,6 +14,6 @@ export const DownTriangle = ({ size }: { size?: 'small' | 'large' }) => (
|
||||||
size === 'small'
|
size === 'small'
|
||||||
? 'border-l-[4px] border-r-[4px] border-t-[6.92px]'
|
? 'border-l-[4px] border-r-[4px] border-t-[6.92px]'
|
||||||
: 'border-l-[5px] border-r-[5px] border-t-[8.65px]'
|
: '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,
|
appDir: false,
|
||||||
},
|
},
|
||||||
images: {
|
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,
|
reactStrictMode: true,
|
||||||
//proxy for openserum api cors
|
//proxy for openserum api cors
|
||||||
|
|
Loading…
Reference in New Issue