Skip to content

Commit

Permalink
chore: update text for price deviate KEP-1693 (#2293)
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv authored Oct 12, 2023
1 parent 9241e09 commit 1e9f291
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/pages/AddLiquidityV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,14 @@ export default function AddLiquidity() {
const upToMedium = useMedia(`(max-width: ${MEDIA_WIDTHS.upToMedium}px)`)
const upToXXSmall = useMedia(`(max-width: ${MEDIA_WIDTHS.upToXXSmall}px)`)

const priceDiff =
baseCurrency && quoteCurrency && tokenA && tokenB && price
? Math.abs(
Number((isSorted ? price : price?.invert())?.toSignificant(18)) /
(usdPrices[tokenA.wrapped.address] / usdPrices[tokenB.wrapped.address]) -
1,
)
: 0
const isPriceDeviated =
baseCurrency &&
quoteCurrency &&
Expand All @@ -715,6 +723,7 @@ export default function AddLiquidity() {
(usdPrices[tokenA.wrapped.address] / usdPrices[tokenB.wrapped.address]) -
1,
) >= 0.02

const isFullRange = activeRange === RANGE.FULL_RANGE
const isValid = !errorMessage && !invalidRange
const isWarningButton = isPriceDeviated || isFullRange || outOfRange
Expand Down Expand Up @@ -857,7 +866,10 @@ export default function AddLiquidity() {
{formatDisplayNumber(usdPrices[tokenA.wrapped.address] / usdPrices[tokenB.wrapped.address], {
significantDigits: 4,
})}{' '}
{quoteCurrency.symbol}). You might have high impermanent loss after you add liquidity to this pool
{quoteCurrency.symbol}) by {(priceDiff * 100).toFixed(2)}%. Please consider the{' '}
<ExternalLink href="https://docs.kyberswap.com/getting-started/foundational-topics/decentralized-finance/impermanent-loss">
impermanent loss
</ExternalLink>
</Trans>
)}
</TYPE.black>
Expand Down

0 comments on commit 1e9f291

Please sign in to comment.