Merge branch 'main' into emoji-rates
This commit is contained in:
commit
be8179bfc1
|
@ -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)
|
||||
|
@ -186,8 +191,7 @@ function StakeForm({ token: selectedToken, clientContext }: StakeFormProps) {
|
|||
} else {
|
||||
const priceDifference = (stakePrice - borrowPrice) / borrowPrice
|
||||
const borrowAmount =
|
||||
(1 + priceDifference) * Number(inputAmount) * Math.min(leverage - 1, 1)
|
||||
|
||||
(1 + priceDifference) * Number(inputAmount) * (leverage - 1)
|
||||
return borrowAmount
|
||||
}
|
||||
}, [leverage, borrowBank, stakeBank, inputAmount])
|
||||
|
@ -515,7 +519,7 @@ function StakeForm({ token: selectedToken, clientContext }: StakeFormProps) {
|
|||
}
|
||||
decimals={3}
|
||||
/>{' '}
|
||||
{borrowBank.name}
|
||||
{'USDC'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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`}
|
||||
/>
|
||||
)
|
||||
|
|
|
@ -11,7 +11,7 @@ const fetchRates = async () => {
|
|||
const outputMint = isUsdcBorrow ? USDC_MINT : SOL_MINT
|
||||
return fetchSwapChartPrices(t.mint_address, outputMint, '90')
|
||||
})
|
||||
const [jlpPrices, msolPrices, jitoPrices, bsolPrices] =
|
||||
const [jlpPrices, msolPrices, jitoPrices, bsolPrices, jsolPrices] =
|
||||
await Promise.all(promises)
|
||||
|
||||
// may be null if the price range cannot be calculated
|
||||
|
@ -46,6 +46,11 @@ const fetchRates = async () => {
|
|||
bsolPrices[0].price
|
||||
}
|
||||
|
||||
if (jsolPrices && jsolPrices?.length > 1) {
|
||||
rateData.jsol =
|
||||
(4 * (jsolPrices[jsolPrices.length - 2].price - jsolPrices[0].price)) /
|
||||
jsolPrices[0].price
|
||||
}
|
||||
/*
|
||||
|
||||
if (msolRange) {
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<svg width="300" height="300" viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="150" cy="150" r="150" fill="url(#paint0_linear_664:247)"/>
|
||||
<circle cx="150" cy="150" r="150" fill="#ffd140"/>
|
||||
<circle cx="150" cy="150" r="112.5" fill="white"/>
|
||||
<path d="M147.75 216C138.875 216 130.687 214.375 123.187 211.125C115.813 207.75 109.75 203 105 196.875L121.875 176.625C129 186.25 137.125 191.062 146.25 191.062C158.625 191.062 164.812 183.812 164.812 169.312V106.875H118.688V82.5H195V167.625C195 183.75 191 195.875 183 204C175 212 163.25 216 147.75 216Z" fill="#100808"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_664:247" x1="45" y1="18.75" x2="228.75" y2="281.25" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1BE4AF"/>
|
||||
<stop offset="1" stop-color="#619CCC"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 824 B |
|
@ -52,6 +52,14 @@ export const STAKEABLE_TOKENS_DATA: {
|
|||
clientContext: 'lst',
|
||||
borrowToken: 'SOL',
|
||||
},
|
||||
{
|
||||
name: 'JSOL',
|
||||
id: 1063,
|
||||
active: true,
|
||||
mint_address: '7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn',
|
||||
clientContext: 'lst',
|
||||
borrowToken: 'SOL',
|
||||
},
|
||||
]
|
||||
|
||||
export type ClientContextKeys = 'lst' | 'jlp'
|
||||
|
|
|
@ -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