Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update text for price deviate KEP-1693 #2293

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading