* fix

* fix to store
This commit is contained in:
Finn Casey Fierro 2024-04-16 11:11:04 +01:00 committed by GitHub
parent 3c783eba34
commit e1b599ea0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 10 deletions

View File

@ -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)

View File

@ -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 ? (

View File

@ -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>

View File

@ -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`}
/>
)

View File

@ -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