Compare commits
2 Commits
3c783eba34
...
afa08b17e7
Author | SHA1 | Date |
---|---|---|
Adrian Brzeziński | afa08b17e7 | |
Finn Casey Fierro | e1b599ea0d |
|
@ -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 ? (
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -109,7 +109,8 @@
|
|||
"resolutions": {
|
||||
"@coral-xyz/anchor": "^0.27.0",
|
||||
"eslint-config-next/eslint-import-resolver-typescript/tsconfig-paths/json5": "1.0.2",
|
||||
"crypto-js": ">=4.1.1"
|
||||
"crypto-js": ">=4.1.1",
|
||||
"protobufjs": ">=7.2.5"
|
||||
},
|
||||
"lavamoat": {
|
||||
"allowScripts": {
|
||||
|
|
|
@ -6223,10 +6223,10 @@ prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1:
|
|||
object-assign "^4.1.1"
|
||||
react-is "^16.13.1"
|
||||
|
||||
protobufjs@^7.2.4:
|
||||
version "7.2.4"
|
||||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.4.tgz#3fc1ec0cdc89dd91aef9ba6037ba07408485c3ae"
|
||||
integrity sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==
|
||||
protobufjs@>=7.2.5, protobufjs@^7.2.4:
|
||||
version "7.2.6"
|
||||
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.6.tgz#4a0ccd79eb292717aacf07530a07e0ed20278215"
|
||||
integrity sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw==
|
||||
dependencies:
|
||||
"@protobufjs/aspromise" "^1.1.2"
|
||||
"@protobufjs/base64" "^1.1.2"
|
||||
|
|
Loading…
Reference in New Issue