From 84ef9a01c9e1785b15e3efe97ce1fb982948687a Mon Sep 17 00:00:00 2001 From: Uniswap Labs Service Account Date: Wed, 28 Feb 2024 19:08:40 +0000 Subject: [PATCH] ci(release): publish latest release --- RELEASE | 14 +++++++------- VERSION | 2 +- .../useCurrentPriceAdjustment.ts | 13 +++++++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/RELEASE b/RELEASE index b4366fc661b..fc4ee4e41ff 100644 --- a/RELEASE +++ b/RELEASE @@ -1,6 +1,6 @@ IPFS hash of the deployment: -- CIDv0: `QmcQjAHrLBLgoJjyijTRWvPf8aYqyi4ShqfCgPJUt5KE7Q` -- CIDv1: `bafybeigrb34tm6vzgzksmurnybn2upad75vcuw4lxxcqplzlofjlxbzjo4` +- CIDv0: `QmZ8D4oPRH7CbNZ1ULVQedBkTLJhqv539kRTmifrva49GM` +- CIDv1: `bafybeifaiclxh6pc3bdtrrkpbvvqqxq6hz5r6htdzxaga4fikfpu2u56qi` The latest release is always mirrored at [app.uniswap.org](https://app.uniswap.org). @@ -10,15 +10,15 @@ You can also access the Uniswap Interface from an IPFS gateway. Your Uniswap settings are never remembered across different URLs. IPFS gateways: -- https://bafybeigrb34tm6vzgzksmurnybn2upad75vcuw4lxxcqplzlofjlxbzjo4.ipfs.dweb.link/ -- https://bafybeigrb34tm6vzgzksmurnybn2upad75vcuw4lxxcqplzlofjlxbzjo4.ipfs.cf-ipfs.com/ -- [ipfs://QmcQjAHrLBLgoJjyijTRWvPf8aYqyi4ShqfCgPJUt5KE7Q/](ipfs://QmcQjAHrLBLgoJjyijTRWvPf8aYqyi4ShqfCgPJUt5KE7Q/) +- https://bafybeifaiclxh6pc3bdtrrkpbvvqqxq6hz5r6htdzxaga4fikfpu2u56qi.ipfs.dweb.link/ +- https://bafybeifaiclxh6pc3bdtrrkpbvvqqxq6hz5r6htdzxaga4fikfpu2u56qi.ipfs.cf-ipfs.com/ +- [ipfs://QmZ8D4oPRH7CbNZ1ULVQedBkTLJhqv539kRTmifrva49GM/](ipfs://QmZ8D4oPRH7CbNZ1ULVQedBkTLJhqv539kRTmifrva49GM/) -### 5.16.1 (2024-02-28) +### 5.16.2 (2024-02-28) ### Bug Fixes -* **web:** use correct all-time swappers (#6637) 672ef4e +* **web:** [hotfix] [limits] presets (#6638) 4f8964b diff --git a/VERSION b/VERSION index a384ba57b00..611583bb308 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -web/5.16.1 \ No newline at end of file +web/5.16.2 \ No newline at end of file diff --git a/apps/web/src/components/CurrencyInputPanel/LimitPriceInputPanel/useCurrentPriceAdjustment.ts b/apps/web/src/components/CurrencyInputPanel/LimitPriceInputPanel/useCurrentPriceAdjustment.ts index 453871f6b26..3c8a5bdcc3e 100644 --- a/apps/web/src/components/CurrencyInputPanel/LimitPriceInputPanel/useCurrentPriceAdjustment.ts +++ b/apps/web/src/components/CurrencyInputPanel/LimitPriceInputPanel/useCurrentPriceAdjustment.ts @@ -1,4 +1,4 @@ -import { Currency, CurrencyAmount, Price } from '@uniswap/sdk-core' +import { Currency, CurrencyAmount, Fraction, Price } from '@uniswap/sdk-core' import { parseUnits } from 'ethers/lib/utils' import JSBI from 'jsbi' import { useMemo } from 'react' @@ -37,10 +37,15 @@ export function useCurrentPriceAdjustment({ const marketQuote = marketPrice.quote(oneUnitOfBaseCurrency) const parsedPriceQuote = parsedLimitPrice.quote(oneUnitOfBaseCurrency) - const difference = parsedPriceQuote.subtract(marketQuote) - const percentageChange = difference.divide(marketQuote) + const decimalsScalar = JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(18)) - const currentPriceAdjustment = Math.floor(Number(percentageChange.multiply(100).toFixed(2))) + const scaledMarketQuote = JSBI.BigInt(marketQuote.multiply(decimalsScalar).toFixed(0)) + const scaledPriceQuote = JSBI.BigInt(parsedPriceQuote.multiply(decimalsScalar).toFixed(0)) + + const difference = JSBI.subtract(scaledPriceQuote, scaledMarketQuote) + const percentageChange = new Fraction(difference, scaledMarketQuote) + + const currentPriceAdjustment = Math.round(Number(percentageChange.multiply(100).toFixed(2))) return { currentPriceAdjustment, priceError: limitPriceInverted ? (currentPriceAdjustment ?? 0) > 0 : (currentPriceAdjustment ?? 0) < 0,