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yB,QAArB8N,EACKV,EAAAA,EAGFU","sources":["webpack://_N_E/./packages/uikit/src/components/Card/StyledCard.tsx","webpack://_N_E/./packages/uikit/src/components/Card/Card.tsx","webpack://_N_E/./packages/uikit/src/components/Link/LinkExternal.tsx","webpack://_N_E/./packages/uikit/src/components/Svg/Icons/Binance.tsx","webpack://_N_E/./packages/uikit/src/components/Svg/Icons/Checkmark.tsx","webpack://_N_E/./packages/uikit/src/components/Svg/Icons/History.tsx","webpack://_N_E/./src/components/App/Transactions/Transaction.tsx","webpack://_N_E/./src/components/App/Transactions/TransactionsModal.tsx","webpack://_N_E/./src/components/App/Transactions/index.tsx","webpack://_N_E/./src/components/App/AppHeader.tsx","webpack://_N_E/./src/components/App/AppBody.tsx","webpack://_N_E/./src/components/Card/index.tsx","webpack://_N_E/./src/components/Layout/Column.tsx","webpack://_N_E/./src/components/Layout/Row.tsx","webpack://_N_E/./src/components/Loader/CircleLoader.tsx","webpack://_N_E/./src/utils/getTokenLogoURL.ts","webpack://_N_E/./src/components/Logo/CurrencyLogo.tsx","webpack://_N_E/./src/components/Logo/DoubleLogo.tsx","webpack://_N_E/./src/components/Logo/ListLogo.tsx","webpack://_N_E/./src/config/constants/info.ts","webpack://_N_E/./src/utils/trades.ts","webpack://_N_E/./src/hooks/Trades.ts","webpack://_N_E/./src/hooks/useHttpLocations.ts","webpack://_N_E/./src/utils/graphql.ts","webpack://_N_E/./src/utils/requestWithTimeout.ts","webpack://_N_E/./src/views/Info/utils/infoQueryHelpers.ts","webpack://_N_E/./src/utils/getBlocksFromTimestamps.ts","webpack://_N_E/./src/views/Info/utils/infoDataHelpers.ts","webpack://_N_E/./src/utils/getChangeForPeriod.ts","webpack://_N_E/./src/utils/getLpAddress.ts","webpack://_N_E/./src/state/swap/queries/lastPairDayId.ts","webpack://_N_E/./src/state/swap/queries/pairHourDatas.ts","webpack://_N_E/./src/state/swap/queries/pairDayDatasByIdsQuery.ts","webpack://_N_E/./src/state/swap/fetch/constants.ts","webpack://_N_E/./src/state/swap/fetch/utils.ts","webpack://_N_E/./src/state/swap/queries/pairDayDatas.ts","webpack://_N_E/./src/state/swap/queries/pairHourDatasByIds.ts","webpack://_N_E/./src/state/swap/queries/lastPairHourId.ts","webpack://_N_E/./src/state/swap/fetch/fetchPairPriceData.ts","webpack://_N_E/./src/state/swap/queries/getDerivedPrices.ts","webpack://_N_E/./src/state/swap/fetch/fetchDerivedPriceData.ts","webpack://_N_E/./src/state/info/queries/pools/poolData.ts","webpack://_N_E/./src/state/swap/hooks.ts","webpack://_N_E/./src/state/swap/selectors.ts","webpack://_N_E/./src/state/swap/normalizers.ts","webpack://_N_E/./src/utils/getDeltaTimestamps.ts","webpack://_N_E/./src/utils/getLpFeesAndApr.ts","webpack://_N_E/./src/state/swap/types.ts","webpack://_N_E/./src/state/transactions/hooks.tsx","webpack://_N_E/./src/state/wallet/hooks.ts","webpack://_N_E/./src/utils/exchange.ts","webpack://_N_E/./src/utils/formatInfoNumbers.ts","webpack://_N_E/./src/utils/tryParseAmount.ts","webpack://_N_E/./src/utils/uriToHttp.ts","webpack://_N_E/./src/views/Page.tsx","webpack://_N_E/./src/views/Swap/components/Chart/constants.ts","webpack://_N_E/./src/views/Swap/components/Chart/utils.ts"],"sourcesContent":["import _tagged_template_literal from \"@swc/helpers/src/_tagged_template_literal.mjs\";\nfunction _templateObject() {\n var data = _tagged_template_literal([\n \"\\n 0% {\\n background-position: 50% 0%;\\n }\\n 50% {\\n background-position: 50% 100%;\\n }\\n 100% {\\n background-position: 50% 0%;\\n }\\n\"\n ]);\n _templateObject = function _templateObject() {\n return data;\n };\n return data;\n}\nfunction _templateObject1() {\n var data = _tagged_template_literal([\n \"\\n animation: \",\n \" 3s ease infinite;\\n background-size: 400% 400%;\\n \"\n ]);\n _templateObject1 = function _templateObject1() {\n return data;\n };\n return data;\n}\nfunction _templateObject2() {\n var data = _tagged_template_literal([\n \"\\n border-radius: \",\n \";\\n color: \",\n \";\\n overflow: hidden;\\n position: relative;\\n\\n \",\n \"\\n\\n padding: 1px 1px 3px 1px;\\n\\n \",\n \"\\n\"\n ]);\n _templateObject2 = function _templateObject2() {\n return data;\n };\n return data;\n}\nfunction _templateObject3() {\n var data = _tagged_template_literal([\n \"\\n width: 100%;\\n height: 100%;\\n overflow: \",\n \";\\n background: \",\n \";\\n border-radius: \",\n \";\\n\"\n ]);\n _templateObject3 = function _templateObject3() {\n return data;\n };\n return data;\n}\nimport styled, { keyframes, css } from \"styled-components\";\nimport { space } from \"styled-system\";\nimport { Box } from \"../Box\";\nvar PromotedGradient = keyframes(_templateObject());\n/**\n * Priority: Warning --> Success --> Active\n */ var getBorderColor = function(param) {\n var isActive = param.isActive, isSuccess = param.isSuccess, isWarning = param.isWarning, borderBackground = param.borderBackground, theme = param.theme;\n if (borderBackground) {\n return borderBackground;\n }\n if (isWarning) {\n return theme.colors.warning;\n }\n if (isSuccess) {\n return theme.colors.success;\n }\n if (isActive) {\n return \"linear-gradient(180deg, \".concat(theme.colors.primaryBright, \", \").concat(theme.colors.secondary, \")\");\n }\n return theme.colors.cardBorder;\n};\nexport var StyledCard = styled.div.withConfig({\n componentId: \"sc-772158ab-0\"\n})(_templateObject2(), function(param) {\n var theme = param.theme;\n return theme.radii.card;\n}, function(param) {\n var theme = param.theme, isDisabled = param.isDisabled;\n return theme.colors[isDisabled ? \"textDisabled\" : \"text\"];\n}, function(param) {\n var isActive = param.isActive;\n return isActive && css(_templateObject1(), PromotedGradient);\n}, space);\nexport var StyledCardInner = styled(Box).withConfig({\n componentId: \"sc-772158ab-1\"\n})(_templateObject3(), function(param) {\n var hasCustomBorder = param.hasCustomBorder;\n return hasCustomBorder ? \"initial\" : \"inherit\";\n}, function(param) {\n var theme = param.theme, background = param.background;\n return background !== null && background !== void 0 ? background : theme.card.background;\n}, function(param) {\n var theme = param.theme;\n return theme.radii.card;\n});\nStyledCard.defaultProps = {\n isActive: false,\n isSuccess: false,\n isWarning: false,\n isDisabled: false\n};\n","import _object_spread from \"@swc/helpers/src/_object_spread.mjs\";\nimport _object_spread_props from \"@swc/helpers/src/_object_spread_props.mjs\";\nimport _object_without_properties from \"@swc/helpers/src/_object_without_properties.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport { StyledCard, StyledCardInner } from \"./StyledCard\";\nvar Card = function(_param) {\n var ribbon = _param.ribbon, children = _param.children, background = _param.background, props = _object_without_properties(_param, [\n \"ribbon\",\n \"children\",\n \"background\"\n ]);\n return /*#__PURE__*/ _jsx(StyledCard, _object_spread_props(_object_spread({}, props), {\n children: /*#__PURE__*/ _jsxs(StyledCardInner, {\n background: background,\n hasCustomBorder: !!props.borderBackground,\n children: [\n ribbon,\n children\n ]\n })\n }));\n};\nexport default Card;\n","import _object_spread from \"@swc/helpers/src/_object_spread.mjs\";\nimport _object_spread_props from \"@swc/helpers/src/_object_spread_props.mjs\";\nimport _object_without_properties from \"@swc/helpers/src/_object_without_properties.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport Link from \"./Link\";\nimport OpenNewIcon from \"../Svg/Icons/OpenNew\";\nvar LinkExternal = function(_param) {\n var children = _param.children, props = _object_without_properties(_param, [\n \"children\"\n ]);\n return /*#__PURE__*/ _jsxs(Link, _object_spread_props(_object_spread({\n external: true\n }, props), {\n children: [\n children,\n /*#__PURE__*/ _jsx(OpenNewIcon, {\n color: props.color ? props.color : \"primary\",\n ml: \"4px\"\n })\n ]\n }));\n};\nexport default LinkExternal;\n","import _object_spread from \"@swc/helpers/src/_object_spread.mjs\";\nimport _object_spread_props from \"@swc/helpers/src/_object_spread_props.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport Svg from \"../Svg\";\nvar Icon = function(props) {\n return /*#__PURE__*/ _jsx(Svg, _object_spread_props(_object_spread({\n viewBox: \"0 0 32 32\"\n }, props), {\n children: /*#__PURE__*/ _jsx(\"image\", {\n href: \"/images/tokens/eth-logo.png\",\n width: 32\n })\n }));\n};\nexport default Icon;\n","import _object_spread from \"@swc/helpers/src/_object_spread.mjs\";\nimport _object_spread_props from \"@swc/helpers/src/_object_spread_props.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport Svg from \"../Svg\";\nvar Icon = function(props) {\n return /*#__PURE__*/ _jsx(Svg, _object_spread_props(_object_spread({\n viewBox: \"0 0 24 24\"\n }, props), {\n children: /*#__PURE__*/ _jsx(\"path\", {\n d: \"M9.00012 16.2L5.50012 12.7C5.11012 12.31 4.49012 12.31 4.10012 12.7C3.71012 13.09 3.71012 13.71 4.10012 14.1L8.29012 18.29C8.68012 18.68 9.31012 18.68 9.70012 18.29L20.3001 7.70001C20.6901 7.31001 20.6901 6.69001 20.3001 6.30001C19.9101 5.91001 19.2901 5.91001 18.9001 6.30001L9.00012 16.2Z\"\n })\n }));\n};\nexport default Icon;\n","import _object_spread from \"@swc/helpers/src/_object_spread.mjs\";\nimport _object_spread_props from \"@swc/helpers/src/_object_spread_props.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport Svg from \"../Svg\";\nvar Icon = function(props) {\n return /*#__PURE__*/ _jsx(Svg, _object_spread_props(_object_spread({\n viewBox: \"0 0 24 24\"\n }, props), {\n children: /*#__PURE__*/ _jsx(\"path\", {\n d: \"M13 3C8.03 3 4 7.03 4 12H2.20711C1.76165 12 1.53857 12.5386 1.85355 12.8536L4.54604 15.546C4.73751 15.7375 5.04662 15.7418 5.24329 15.5556L8.08805 12.8631C8.4164 12.5524 8.19646 12 7.74435 12H6C6 8.13 9.13 5 13 5C16.87 5 20 8.13 20 12C20 15.87 16.87 19 13 19C11.4314 19 9.98175 18.4782 8.81739 17.601C8.37411 17.267 7.74104 17.259 7.3486 17.6514C6.95725 18.0428 6.95413 18.6823 7.38598 19.0284C8.92448 20.2615 10.8708 21 13 21C17.97 21 22 16.97 22 12C22 7.03 17.97 3 13 3ZM12 8V13L16.28 15.54L17 14.33L13.5 12.25V8H12Z\"\n })\n }));\n};\nexport default Icon;\n","import styled from 'styled-components'\nimport { CheckmarkIcon, CloseIcon, LinkExternal } from '@pancakeswap/uikit'\nimport { useNetwork } from 'wagmi'\nimport { getChainId } from 'config/constants/exchange'\nimport { getBscScanLink } from 'utils'\nimport { TransactionDetails } from 'state/transactions/reducer'\nimport CircleLoader from '../../Loader/CircleLoader'\n\n\nconst TransactionState = styled.div<{ pending: boolean; success?: boolean }>`\n display: flex;\n justify-content: space-between;\n align-items: center;\n text-decoration: none !important;\n border-radius: 0.5rem;\n padding: 0.25rem 0rem;\n font-weight: 500;\n font-size: 0.825rem;\n color: ${({ theme }) => theme.colors.primary};\n`\n\nconst IconWrapper = styled.div<{ pending: boolean; success?: boolean }>`\n color: ${({ pending, success, theme }) =>\n pending ? theme.colors.primary : success ? theme.colors.success : theme.colors.failure};\n`\n\nexport default function Transaction({ tx }: { tx: TransactionDetails }) {\n\n const { chain } = useNetwork()\nconst chainId = getChainId(chain)\n\n const summary = tx?.summary\n const pending = !tx?.receipt\n const success = !pending && tx && (tx.receipt?.status === 1 || typeof tx.receipt?.status === 'undefined')\n\n if (!chainId) return null\n\n return (\n \n {summary ?? tx.hash}\n \n {pending ? : success ? : }\n \n \n )\n}\n","import { useCallback } from 'react'\nimport { useAccount, useNetwork } from 'wagmi'\nimport { getChainId } from 'config/constants/exchange'\nimport { Modal, ModalBody, Text, Button, Flex, InjectedModalProps } from '@pancakeswap/uikit'\nimport { useTranslation } from 'contexts/Localization'\nimport orderBy from 'lodash/orderBy'\nimport { isTransactionRecent, useAllTransactions } from 'state/transactions/hooks'\nimport { TransactionDetails } from 'state/transactions/reducer'\nimport { useAppDispatch } from 'state'\nimport { clearAllTransactions } from 'state/transactions/actions'\nimport { AutoRow } from '../../Layout/Row'\nimport Transaction from './Transaction'\nimport ConnectWalletButton from '../../ConnectWalletButton'\n\nfunction renderTransactions(transactions: TransactionDetails[]) {\n return (\n \n {transactions.map((tx) => {\n return \n })}\n \n )\n}\n\nconst TransactionsModal: React.FC = ({ onDismiss }) => {\n const { address: account } = useAccount()\n const { chain } = useNetwork()\n const chainId = getChainId(chain);\n const dispatch = useAppDispatch()\n const allTransactions = useAllTransactions()\n\n const { t } = useTranslation()\n\n const sortedRecentTransactions = orderBy(\n Object.values(allTransactions).filter(isTransactionRecent),\n 'addedTime',\n 'desc',\n )\n\n const pending = sortedRecentTransactions.filter((tx) => !tx.receipt)\n const confirmed = sortedRecentTransactions.filter((tx) => tx.receipt)\n\n const clearAllTransactionsCallback = useCallback(() => {\n if (chainId) dispatch(clearAllTransactions({ chainId }))\n }, [dispatch, chainId])\n\n return (\n \n {account ? (\n \n {!!pending.length || !!confirmed.length ? (\n <>\n \n {t('Recent Transactions')}\n \n \n {renderTransactions(pending)}\n {renderTransactions(confirmed)}\n \n ) : (\n {t('No recent transactions')}\n )}\n \n ) : (\n \n )}\n \n )\n}\n\nexport default TransactionsModal\n","import { HistoryIcon, useModal, IconButton } from '@pancakeswap/uikit'\nimport TransactionsModal from './TransactionsModal'\n\nconst Transactions = () => {\n const [onPresentTransactionsModal] = useModal()\n return (\n <>\n \n \n \n \n )\n}\n\nexport default Transactions\n","import styled from 'styled-components'\nimport { Text, Flex, Heading, IconButton, ArrowBackIcon, NotificationDot } from '@pancakeswap/uikit'\nimport { useExpertModeManager } from 'state/user/hooks'\nimport GlobalSettings from 'components/Menu/GlobalSettings'\nimport Link from 'next/link'\nimport Transactions from './Transactions'\nimport QuestionHelper from '../QuestionHelper'\nimport { SettingsMode } from '../Menu/GlobalSettings/types'\n\ninterface Props {\n title: string\n subtitle: string\n helper?: string\n backTo?: string | (() => void)\n noConfig?: boolean\n}\n\nconst AppHeaderContainer = styled(Flex)`\n align-items: center;\n justify-content: space-between;\n padding: 24px;\n width: 100%;\n border-bottom: 1px solid ${({ theme }) => theme.colors.cardBorder};\n`\n\nconst AppHeader: React.FC = ({ title, subtitle, helper, backTo, noConfig = false }) => {\n const [expertMode] = useExpertModeManager()\n\n return (\n \n \n {backTo &&\n (typeof backTo === 'string' ? (\n \n \n \n \n \n ) : (\n \n \n \n ))}\n \n \n {title}\n {!noConfig && (\n \n \n \n \n \n \n )}\n \n \n {helper && }\n \n {subtitle}\n \n \n \n \n \n )\n}\n\nexport default AppHeader\n","import styled from 'styled-components'\nimport { Card } from '@pancakeswap/uikit'\n\nexport const BodyWrapper = styled(Card)`\n max-width: 436px;\n width: 100%;\n z-index: 1;\n border-radius: 4px;\n`\n\n/**\n * The styled container element that wraps the content of most pages and the tabs.\n */\nexport default function AppBody({ children }: { children: React.ReactNode }) {\n return {children}\n}\n","import styled from 'styled-components'\nimport { Box } from '@pancakeswap/uikit'\n\nconst Card = styled(Box)<{\n width?: string\n padding?: string\n border?: string\n borderRadius?: string\n}>`\n width: ${({ width }) => width ?? '100%'};\n padding: ${({ padding }) => padding ?? '1.25rem'};\n border: ${({ border }) => border};\n border-radius: ${({ borderRadius }) => borderRadius ?? '4px'};\n background-color: ${({ theme }) => theme.colors.background};\n`\nexport default Card\n\nexport const LightCard = styled(Card)`\n border: 1px solid ${({ theme }) => theme.colors.cardBorder};\n background-color: ${({ theme }) => theme.colors.backgroundAlt};\n`\n\nexport const LightCardA = styled(Card)`\n border: 1px solid ${({ theme }) => theme.colors.cardBorder};\n background-color: \"#171717\";\n`\n\nexport const LightGreyCard = styled(Card)`\n border: 1px solid ${({ theme }) => theme.colors.cardBorder};\n background-color: ${({ theme }) => theme.colors.background};\n`\n\nexport const GreyCard = styled(Card)`\n background-color: ${({ theme }) => theme.colors.inputSecondary};\n color: ${({ theme }) => theme.colors.textDisabled};\n`\n","import styled from 'styled-components'\n\nconst Column = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n`\nexport const ColumnCenter = styled(Column)`\n width: 100%;\n align-items: center;\n`\n\nexport const AutoColumn = styled.div<{\n gap?: 'sm' | 'md' | 'lg' | string\n justify?: 'stretch' | 'center' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'space-between'\n}>`\n display: grid;\n grid-auto-rows: auto;\n grid-row-gap: ${({ gap }) => (gap === 'sm' && '8px') || (gap === 'md' && '12px') || (gap === 'lg' && '24px') || gap};\n justify-items: ${({ justify }) => justify};\n`\n\nexport default Column\n","import styled from 'styled-components'\nimport { Box } from '@pancakeswap/uikit'\n\nconst Row = styled(Box)<{\n width?: string\n align?: string\n justify?: string\n padding?: string\n border?: string\n borderRadius?: string\n}>`\n width: ${({ width }) => width ?? '100%'};\n display: flex;\n align-items: ${({ align }) => align ?? 'center'};\n justify-content: ${({ justify }) => justify ?? 'flex-start'};\n padding: ${({ padding }) => padding ?? '0'};\n border: ${({ border }) => border};\n border-radius: ${({ borderRadius }) => borderRadius};\n`\n\nexport const RowBetween = styled(Row)`\n justify-content: space-between;\n`\n\nexport const RowFlat = styled.div`\n display: flex;\n align-items: flex-end;\n`\n\nexport const AutoRow = styled(Row)<{ gap?: string; justify?: string }>`\n flex-wrap: wrap;\n margin: ${({ gap }) => gap && `-${gap}`};\n justify-content: ${({ justify }) => justify};\n\n & > * {\n margin: ${({ gap }) => gap} !important;\n }\n`\n\nexport const RowFixed = styled(Row)<{ gap?: string; justify?: string }>`\n width: fit-content;\n margin: ${({ gap }) => gap && `-${gap}`};\n\n & > * {\n margin: ${({ gap }) => gap} !important;\n }\n`\n\nexport default Row\n","import styled, { keyframes } from 'styled-components'\n\nconst rotate = keyframes`\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n`\n\nconst StyledSVG = styled.svg<{ size: string; stroke?: string }>`\n animation: 2s ${rotate} linear infinite;\n height: ${({ size }) => size};\n width: ${({ size }) => size};\n path {\n stroke: ${({ stroke, theme }) => stroke ?? theme.colors.primary};\n }\n`\n\n/**\n * Takes in custom size and stroke for circle color, default to primary color as fill,\n * need ...rest for layered styles on top\n */\nexport default function CircleLoader({\n size = '16px',\n stroke,\n ...rest\n}: {\n size?: string\n stroke?: string\n [k: string]: any\n}) {\n return (\n \n \n \n )\n}\n","const getTokenLogoURL = (address: string) =>\n `/images/tokens/${address}.png`\n\nexport default getTokenLogoURL\n","import { Currency, ETHER, Token } from '@pancakeswap/sdk'\nimport { BinanceIcon } from '@pancakeswap/uikit'\nimport { useMemo } from 'react'\nimport styled from 'styled-components'\nimport { WrappedTokenInfo } from 'state/types'\nimport useHttpLocations from '../../hooks/useHttpLocations'\nimport getTokenLogoURL from '../../utils/getTokenLogoURL'\nimport Logo from './Logo'\n\nconst StyledLogo = styled(Logo)<{ size: string }>`\n width: ${({ size }) => size};\n height: ${({ size }) => size};\n border-radius: 50%;\n`\n\nexport default function CurrencyLogo({\n currency,\n size = '24px',\n style,\n}: {\n currency?: Currency\n size?: string\n style?: React.CSSProperties\n}) {\n const uriLocations = useHttpLocations(currency instanceof WrappedTokenInfo ? currency.logoURI : undefined)\n \n const srcs: string[] = useMemo(() => {\n if (currency === ETHER) return []\n \n if (currency instanceof Token) {\n if (currency instanceof WrappedTokenInfo) {\n return [...uriLocations, getTokenLogoURL(currency.address)]\n }\n return [getTokenLogoURL(currency.address)]\n }\n return []\n }, [currency, uriLocations])\n \n if (currency === ETHER) {\n return \n }\n\n return \n}\n","import { Currency } from '@pancakeswap/sdk'\nimport styled from 'styled-components'\nimport CurrencyLogo from './CurrencyLogo'\n\nconst Wrapper = styled.div<{ margin: boolean }>`\n display: flex;\n flex-direction: row;\n margin-right: ${({ margin }) => margin && '4px'};\n`\n\ninterface DoubleCurrencyLogoProps {\n margin?: boolean\n size?: number\n currency0?: Currency\n currency1?: Currency\n}\n\nexport default function DoubleCurrencyLogo({\n currency0,\n currency1,\n size = 20,\n margin = false,\n}: DoubleCurrencyLogoProps) {\n return (\n \n {currency0 && }\n {currency1 && }\n \n )\n}\n","import styled from 'styled-components'\nimport useHttpLocations from '../../hooks/useHttpLocations'\nimport Logo from './Logo'\n\nconst StyledListLogo = styled(Logo)<{ size: string }>`\n width: ${({ size }) => size};\n height: ${({ size }) => size};\n`\n\nexport default function ListLogo({\n logoURI,\n style,\n size = '24px',\n alt,\n}: {\n logoURI: string\n size?: string\n style?: React.CSSProperties\n alt?: string\n}) {\n const srcs: string[] = useHttpLocations(logoURI)\n\n return \n}\n","export const MINIMUM_SEARCH_CHARACTERS = 2\n\nexport const WEEKS_IN_YEAR = 52.1429\n\nexport const TOTAL_FEE = 0.0025\nexport const LP_HOLDERS_FEE = 0.0017\nexport const TREASURY_FEE = 0.000225\nexport const BUYBACK_FEE = 0.000575\n\nexport const PCS_V2_START = 1619136000 // April 23, 2021, 12:00:00 AM\nexport const ONE_DAY_UNIX = 86400 // 24h * 60m * 60s\nexport const ONE_HOUR_SECONDS = 3600\n\nexport const ITEMS_PER_INFO_TABLE_PAGE = 10\n\n// These tokens are either incorrectly priced or have some other issues that spoil the query data\n// None of them present any interest as they have almost 0 daily trade volume\nexport const TOKEN_BLACKLIST = [\n // These ones are copied from v1 info\n '0x495c7f3a713870f68f8b418b355c085dfdc412c3',\n '0xc3761eb917cd790b30dad99f6cc5b4ff93c4f9ea',\n '0xe31debd7abff90b06bca21010dd860d8701fd901',\n '0xfc989fbb6b3024de5ca0144dc23c18a063942ac1',\n '0xe40fc6ff5f2895b44268fd2e1a421e07f567e007',\n '0xfd158609228b43aa380140b46fff3cdf9ad315de',\n '0xc00af6212fcf0e6fd3143e692ccd4191dc308bea',\n '0x205969b3ad459f7eba0dee07231a6357183d3fb6',\n '0x0bd67d358636fd7b0597724aa4f20beedbf3073a',\n '0xedf5d2a561e8a3cb5a846fbce24d2ccd88f50075',\n '0x702b0789a3d4dade1688a0c8b7d944e5ba80fc30',\n '0x041929a760d7049edaef0db246fa76ec975e90cc',\n '0xba098df8c6409669f5e6ec971ac02cd5982ac108',\n '0x1bbed115afe9e8d6e9255f18ef10d43ce6608d94',\n '0xe99512305bf42745fae78003428dcaf662afb35d',\n '0xbE609EAcbFca10F6E5504D39E3B113F808389056',\n '0x847daf9dfdc22d5c61c4a857ec8733ef5950e82e',\n '0xdbf8913dfe14536c0dae5dd06805afb2731f7e7b',\n // These ones are newly found\n '0xF1D50dB2C40b63D2c598e2A808d1871a40b1E653',\n '0x4269e4090ff9dfc99d8846eb0d42e67f01c3ac8b',\n]\n","import { Trade, Percent, currencyEquals } from '@pancakeswap/sdk'\nimport { ZERO_PERCENT, ONE_HUNDRED_PERCENT } from 'config/constants/exchange'\n\n// returns whether tradeB is better than tradeA by at least a threshold percentage amount\nexport function isTradeBetter(\n tradeA: Trade | undefined | null,\n tradeB: Trade | undefined | null,\n minimumDelta: Percent = ZERO_PERCENT,\n): boolean | undefined {\n if (tradeA && !tradeB) return false\n if (tradeB && !tradeA) return true\n if (!tradeA || !tradeB) return undefined\n\n if (\n tradeA.tradeType !== tradeB.tradeType ||\n !currencyEquals(tradeA.inputAmount.currency, tradeB.inputAmount.currency) ||\n !currencyEquals(tradeA.outputAmount.currency, tradeB.outputAmount.currency)\n ) {\n throw new Error('Trades are not comparable')\n }\n\n if (minimumDelta.equalTo(ZERO_PERCENT)) {\n return tradeA.executionPrice.lessThan(tradeB.executionPrice)\n }\n return tradeA.executionPrice.raw.multiply(minimumDelta.add(ONE_HUNDRED_PERCENT)).lessThan(tradeB.executionPrice)\n}\n\nexport default isTradeBetter\n","/* eslint-disable no-param-reassign */\nimport { isTradeBetter } from 'utils/trades'\nimport { Currency, CurrencyAmount, Pair, Token, Trade } from '@pancakeswap/sdk'\nimport flatMap from 'lodash/flatMap'\nimport { useMemo } from 'react'\nimport { useNetwork } from 'wagmi'\nimport { useUserSingleHopOnly } from 'state/user/hooks'\nimport {\n BASES_TO_CHECK_TRADES_AGAINST,\n CUSTOM_BASES,\n BETTER_TRADE_LESS_HOPS_THRESHOLD,\n ADDITIONAL_BASES,\n getChainId\n} from 'config/constants/exchange'\nimport { PairState, usePairs } from './usePairs'\nimport { wrappedCurrency } from '../utils/wrappedCurrency'\n\nimport { useUnsupportedTokens, useWarningTokens } from './Tokens'\n\nexport function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): Pair[] {\n const { chain } = useNetwork()\n const chainId = getChainId(chain);\n\n const [tokenA, tokenB] = chainId\n ? [wrappedCurrency(currencyA, chainId), wrappedCurrency(currencyB, chainId)]\n : [undefined, undefined]\n\n const bases: Token[] = useMemo(() => {\n if (!chainId) return []\n\n const common = BASES_TO_CHECK_TRADES_AGAINST[chainId] ?? []\n const additionalA = tokenA ? ADDITIONAL_BASES[chainId]?.[tokenA.address] ?? [] : []\n const additionalB = tokenB ? ADDITIONAL_BASES[chainId]?.[tokenB.address] ?? [] : []\n\n return [...common, ...additionalA, ...additionalB]\n }, [chainId, tokenA, tokenB])\n\n const basePairs: [Token, Token][] = useMemo(\n () => flatMap(bases, (base): [Token, Token][] => bases.map((otherBase) => [base, otherBase])),\n [bases],\n )\n\n const allPairCombinations: [Token, Token][] = useMemo(\n () =>\n tokenA && tokenB\n ? [\n // the direct pair\n [tokenA, tokenB],\n // token A against all bases\n ...bases.map((base): [Token, Token] => [tokenA, base]),\n // token B against all bases\n ...bases.map((base): [Token, Token] => [tokenB, base]),\n // each base against all bases\n ...basePairs,\n ]\n .filter((tokens): tokens is [Token, Token] => Boolean(tokens[0] && tokens[1]))\n .filter(([t0, t1]) => t0.address !== t1.address)\n .filter(([tokenA_, tokenB_]) => {\n if (!chainId) return true\n const customBases = CUSTOM_BASES[chainId]\n\n const customBasesA: Token[] | undefined = customBases?.[tokenA_.address]\n const customBasesB: Token[] | undefined = customBases?.[tokenB_.address]\n\n if (!customBasesA && !customBasesB) return true\n\n if (customBasesA && !customBasesA.find((base) => tokenB_.equals(base))) return false\n if (customBasesB && !customBasesB.find((base) => tokenA_.equals(base))) return false\n\n return true\n })\n : [],\n [tokenA, tokenB, bases, basePairs, chainId],\n )\n\n const allPairs = usePairs(allPairCombinations)\n\n // only pass along valid pairs, non-duplicated pairs\n return useMemo(\n () =>\n Object.values(\n allPairs\n // filter out invalid pairs\n .filter((result): result is [PairState.EXISTS, Pair] => Boolean(result[0] === PairState.EXISTS && result[1]))\n // filter out duplicated pairs\n .reduce<{ [pairAddress: string]: Pair }>((memo, [, curr]) => {\n memo[curr.liquidityToken.address] = memo[curr.liquidityToken.address] ?? curr\n return memo\n }, {}),\n ),\n [allPairs],\n )\n}\n\nconst MAX_HOPS = 3\n\n/**\n * Returns the best trade for the exact amount of tokens in to the given token out\n */\nexport function useTradeExactIn(currencyAmountIn?: CurrencyAmount, currencyOut?: Currency): Trade | null {\n const allowedPairs = useAllCommonPairs(currencyAmountIn?.currency, currencyOut)\n\n const [singleHopOnly] = useUserSingleHopOnly()\n\n return useMemo(() => {\n if (currencyAmountIn && currencyOut && allowedPairs.length > 0) {\n if (singleHopOnly) {\n return (\n Trade.bestTradeExactIn(allowedPairs, currencyAmountIn, currencyOut, { maxHops: 1, maxNumResults: 1 })[0] ??\n null\n )\n }\n // search through trades with varying hops, find best trade out of them\n let bestTradeSoFar: Trade | null = null\n for (let i = 1; i <= MAX_HOPS; i++) {\n const currentTrade: Trade | null =\n Trade.bestTradeExactIn(allowedPairs, currencyAmountIn, currencyOut, { maxHops: i, maxNumResults: 1 })[0] ??\n null\n // if current trade is best yet, save it\n if (isTradeBetter(bestTradeSoFar, currentTrade, BETTER_TRADE_LESS_HOPS_THRESHOLD)) {\n bestTradeSoFar = currentTrade\n }\n }\n return bestTradeSoFar\n }\n\n return null\n }, [allowedPairs, currencyAmountIn, currencyOut, singleHopOnly])\n}\n\n/**\n * Returns the best trade for the token in to the exact amount of token out\n */\nexport function useTradeExactOut(currencyIn?: Currency, currencyAmountOut?: CurrencyAmount): Trade | null {\n const allowedPairs = useAllCommonPairs(currencyIn, currencyAmountOut?.currency)\n\n const [singleHopOnly] = useUserSingleHopOnly()\n\n return useMemo(() => {\n if (currencyIn && currencyAmountOut && allowedPairs.length > 0) {\n if (singleHopOnly) {\n return (\n Trade.bestTradeExactOut(allowedPairs, currencyIn, currencyAmountOut, { maxHops: 1, maxNumResults: 1 })[0] ??\n null\n )\n }\n // search through trades with varying hops, find best trade out of them\n let bestTradeSoFar: Trade | null = null\n for (let i = 1; i <= MAX_HOPS; i++) {\n const currentTrade =\n Trade.bestTradeExactOut(allowedPairs, currencyIn, currencyAmountOut, { maxHops: i, maxNumResults: 1 })[0] ??\n null\n if (isTradeBetter(bestTradeSoFar, currentTrade, BETTER_TRADE_LESS_HOPS_THRESHOLD)) {\n bestTradeSoFar = currentTrade\n }\n }\n return bestTradeSoFar\n }\n return null\n }, [currencyIn, currencyAmountOut, allowedPairs, singleHopOnly])\n}\n\nexport function useIsTransactionUnsupported(currencyIn?: Currency, currencyOut?: Currency): boolean {\n const unsupportedTokens: { [address: string]: Token } = useUnsupportedTokens()\n const { chain } = useNetwork()\n const chainId = getChainId(chain);\n\n const tokenIn = wrappedCurrency(currencyIn, chainId)\n const tokenOut = wrappedCurrency(currencyOut, chainId)\n\n // if unsupported list loaded & either token on list, mark as unsupported\n if (unsupportedTokens) {\n if (tokenIn && Object.keys(unsupportedTokens).includes(tokenIn.address)) {\n return true\n }\n if (tokenOut && Object.keys(unsupportedTokens).includes(tokenOut.address)) {\n return true\n }\n }\n\n return false\n}\n\nexport function useIsTransactionWarning(currencyIn?: Currency, currencyOut?: Currency): boolean {\n const unsupportedTokens: { [address: string]: Token } = useWarningTokens()\n const { chain } = useNetwork()\n const chainId = getChainId(chain);\n\n const tokenIn = wrappedCurrency(currencyIn, chainId)\n const tokenOut = wrappedCurrency(currencyOut, chainId)\n\n // if unsupported list loaded & either token on list, mark as unsupported\n if (unsupportedTokens) {\n if (tokenIn && Object.keys(unsupportedTokens).includes(tokenIn.address)) {\n return true\n }\n if (tokenOut && Object.keys(unsupportedTokens).includes(tokenOut.address)) {\n return true\n }\n }\n\n return false\n}\n","import { useMemo } from 'react'\nimport uriToHttp from 'utils/uriToHttp'\n\nexport default function useHttpLocations(uri: string | undefined): string[] {\n return useMemo(() => {\n return uri ? uriToHttp(uri) : []\n }, [uri])\n}\n","import { INFO_CLIENT } from 'config/constants/endpoints'\nimport { GraphQLClient } from 'graphql-request'\n\n// Extra headers\n// Mostly for dev environment\n// No production env check since production preview might also need them\nexport const getGQLHeaders = (endpoint: string) => {\n if (endpoint === INFO_CLIENT) {\n return {\n 'X-Sf':\n process.env.NEXT_PUBLIC_SF_HEADER ||\n // hack for inject CI secret on window\n (typeof window !== 'undefined' &&\n // @ts-ignore\n window.sfHeader),\n }\n }\n return undefined\n}\n\nexport const infoClient = new GraphQLClient(INFO_CLIENT, { headers: getGQLHeaders(INFO_CLIENT) })\n\nexport const infoServerClient = new GraphQLClient(INFO_CLIENT, {\n headers: {\n 'X-Sf': process.env.SF_HEADER,\n },\n timeout: 5000,\n})\n\nexport const bitQueryServerClient = new GraphQLClient(process.env.NEXT_PUBLIC_BIT_QUERY_ENDPOINT, {\n headers: {\n // only server, no `NEXT_PUBLIC` not going to expose in client\n 'X-API-KEY': process.env.BIT_QUERY_HEADER,\n },\n timeout: 5000,\n})\n","import { GraphQLClient } from 'graphql-request'\n\nconst requestWithTimeout = (\n graphQLClient: GraphQLClient,\n request: string,\n variables?: any,\n timeout = 30000,\n): Promise => {\n return Promise.race([\n variables ? graphQLClient.request(request, variables) : graphQLClient.request(request),\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new Error(`Request timed out after ${timeout} milliseconds`))\n }, timeout)\n }),\n ]) as Promise\n}\n\nexport default requestWithTimeout\n","import { GraphQLClient } from 'graphql-request'\nimport { getGQLHeaders } from 'utils/graphql'\nimport requestWithTimeout from 'utils/requestWithTimeout'\n\n/**\n * Helper function to get large amount GraphQL subqueries\n * @param queryConstructor constructor function that combines subqueries\n * @param subqueries individual queries\n * @param endpoint GraphQL endpoint\n * @param skipCount how many subqueries to fire at a time\n * @returns\n */\nexport const multiQuery = async (\n queryConstructor: (subqueries: string[]) => string,\n subqueries: string[],\n endpoint: string,\n skipCount = 1000,\n) => {\n let fetchedData = {}\n let allFound = false\n let skip = 0\n const client = new GraphQLClient(endpoint, { headers: getGQLHeaders(endpoint) })\n try {\n while (!allFound) {\n let end = subqueries.length\n if (skip + skipCount < subqueries.length) {\n end = skip + skipCount\n }\n const subqueriesSlice = subqueries.slice(skip, end)\n // eslint-disable-next-line no-await-in-loop\n const result: any = await requestWithTimeout(client, queryConstructor(subqueriesSlice))\n fetchedData = {\n ...fetchedData,\n ...result,\n }\n allFound = Object.keys(result).length < skipCount || skip + skipCount > subqueries.length\n skip += skipCount\n }\n return fetchedData\n } catch (error) {\n console.error('Failed to fetch info data', error)\n return null\n }\n}\n","import orderBy from 'lodash/orderBy'\nimport { gql } from 'graphql-request'\nimport { Block } from '../state/info/types'\nimport { multiQuery } from '../views/Info/utils/infoQueryHelpers'\nimport { BLOCKS_CLIENT } from '../config/constants/endpoints'\n\nconst getBlockSubqueries = (timestamps: number[]) =>\n timestamps.map((timestamp) => {\n return `t${timestamp}:blocks(first: 1, orderBy: timestamp, orderDirection: desc, where: { timestamp_gt: ${timestamp}, timestamp_lt: ${\n timestamp + 600\n } }) {\n number\n }`\n })\n\nconst blocksQueryConstructor = (subqueries: string[]) => {\n return gql`query blocks {\n ${subqueries}\n }`\n}\n\n/**\n * @notice Fetches block objects for an array of timestamps.\n * @param {Array} timestamps\n */\nexport const getBlocksFromTimestamps = async (\n timestamps: number[],\n sortDirection: 'asc' | 'desc' = 'desc',\n skipCount = 500,\n): Promise => {\n if (timestamps?.length === 0) {\n return []\n }\n\n const fetchedData: any = await multiQuery(\n blocksQueryConstructor,\n getBlockSubqueries(timestamps),\n BLOCKS_CLIENT,\n skipCount,\n )\n\n const blocks: Block[] = []\n if (fetchedData) {\n // eslint-disable-next-line no-restricted-syntax\n for (const key of Object.keys(fetchedData)) {\n if (fetchedData[key].length > 0) {\n blocks.push({\n timestamp: key.split('t')[1],\n number: parseInt(fetchedData[key][0].number, 10),\n })\n }\n }\n // graphql-request does not guarantee same ordering of batched requests subqueries, hence manual sorting\n return orderBy(blocks, (block) => block.number, sortDirection)\n }\n return blocks\n}\n","/**\n * Get increase/decrease of value compared to the previous value (e.g. 24h volume compared to 24h volume the day before )\n * @param valueNow - more recent value\n * @param valueBefore - value to compare with\n */\nexport const getAmountChange = (valueNow?: number, valueBefore?: number) => {\n if (valueNow && valueBefore) {\n return valueNow - valueBefore\n }\n if (valueNow) {\n return valueNow\n }\n return 0\n}\n\n/**\n * Get increase/decrease of value compared to the previous value as a percentage\n * @param valueNow - more recent value\n * @param valueBefore - value to compare with\n */\nexport const getPercentChange = (valueNow?: number, valueBefore?: number): number => {\n if (valueNow && valueBefore) {\n return ((valueNow - valueBefore) / valueBefore) * 100\n }\n return 0\n}\n","import { getAmountChange, getPercentChange } from '../views/Info/utils/infoDataHelpers'\n\n/**\n * Given current value and value 1 and 2 periods (e.g. 1day + 2days, 1week - 2weeks) returns the amount change for latest period\n * and percentage change compared to the previous period.\n * @param valueNow - current value\n * @param valueOnePeriodAgo - value 1 period ago (e.g. 1 day or 1 week ago), period unit must be same as valueTwoPeriodsAgo\n * @param valueTwoPeriodsAgo - value 2 periods ago (e.g. 2 days or 2 weeks ago), period unit must be same as valueOnePeriodAgo\n * @returns amount change for the latest period and percentage change compared to previous period\n */\nexport const getChangeForPeriod = (\n valueNow?: number,\n valueOnePeriodAgo?: number,\n valueTwoPeriodsAgo?: number,\n): [number, number] => {\n const currentPeriodAmount = getAmountChange(valueNow, valueOnePeriodAgo)\n const previousPeriodAmount = getAmountChange(valueOnePeriodAgo, valueTwoPeriodsAgo)\n const percentageChange = getPercentChange(currentPeriodAmount, previousPeriodAmount)\n return [currentPeriodAmount, percentageChange]\n}\n","import { Token, Pair, ChainId } from '@pancakeswap/sdk'\nimport { isAddress } from 'utils'\n\nconst getLpAddress = (token1: string | Token, token2: string | Token, chainId: number = ChainId.BSC) => {\n let token1AsTokenInstance = token1\n let token2AsTokenInstance = token2\n if (!token1 || !token2) {\n return null\n }\n if (typeof token1 === 'string' || token1 instanceof String) {\n const checksummedToken1Address = isAddress(token1)\n if (!checksummedToken1Address) {\n return null\n }\n token1AsTokenInstance = new Token(chainId, checksummedToken1Address, 18)\n }\n if (typeof token2 === 'string' || token2 instanceof String) {\n const checksummedToken2Address = isAddress(token2)\n if (!checksummedToken2Address) {\n return null\n }\n token2AsTokenInstance = new Token(chainId, checksummedToken2Address, 18)\n }\n return Pair.getAddress(token1AsTokenInstance as Token, token2AsTokenInstance as Token)\n}\n\nexport default getLpAddress\n","import { gql } from 'graphql-request'\n\nconst lastPairDayId = gql`\n query lastPairDayId($pairId: String) {\n pairDayDatas(first: 1, where: { pairAddress: $pairId }, orderBy: date, orderDirection: desc) {\n id\n }\n }\n`\nexport default lastPairDayId\n","import { gql } from 'graphql-request'\n\nconst pairHourDatas = gql`\n query pairHourDatas($pairId: String, $first: Int) {\n pairHourDatas(first: $first, where: { pair: $pairId }, orderBy: hourStartUnix, orderDirection: desc) {\n id\n hourStartUnix\n reserve0\n reserve1\n reserveUSD\n pair {\n token0 {\n id\n }\n token1 {\n id\n }\n }\n }\n }\n`\nexport default pairHourDatas\n","import { gql } from 'graphql-request'\n\nconst pairDayDatasByIdsQuery = gql`\n query pairDayDatasByIdsQuery($pairIds: [String]) {\n pairDayDatas(where: { id_in: $pairIds }, orderBy: date, orderDirection: desc) {\n id\n date\n reserve0\n reserve1\n reserveUSD\n pairAddress {\n token0 {\n id\n }\n token1 {\n id\n }\n }\n }\n }\n`\nexport default pairDayDatasByIdsQuery\n","import { PairDataTimeWindowEnum } from '../types'\n\n// Specifies the amount of data points to query for specific time window\nexport const timeWindowIdsCountMapping: Record = {\n [PairDataTimeWindowEnum.DAY]: 24,\n [PairDataTimeWindowEnum.WEEK]: 28,\n [PairDataTimeWindowEnum.MONTH]: 30,\n [PairDataTimeWindowEnum.YEAR]: 24,\n}\n\n// How many StreamingFast ids to skip when querying the data\nexport const timeWindowGapMapping: Record = {\n [PairDataTimeWindowEnum.DAY]: null,\n [PairDataTimeWindowEnum.WEEK]: 6, // Each datapoint 6 hours apart\n [PairDataTimeWindowEnum.MONTH]: 1, // Each datapoint 1 day apart\n [PairDataTimeWindowEnum.YEAR]: 15, // Each datapoint 15 days apart\n}\n","import times from 'lodash/times'\nimport { PairDataTimeWindowEnum } from '../types'\nimport { timeWindowGapMapping } from './constants'\nimport { PairDayDatasResponse, PairHoursDatasResponse } from './types'\n\ntype getPairSequentialIdParams = {\n id: string\n pairId: string\n}\nexport const getPairSequentialId = ({ id, pairId }: getPairSequentialIdParams) => id.replace(`${pairId}-`, '')\n\ntype getPairHoursIdsByTimeWindowParams = {\n pairAddress: string\n pairLastId: string\n timeWindow: PairDataTimeWindowEnum\n idsCount: number\n}\n\nexport const getIdsByTimeWindow = ({\n pairAddress,\n pairLastId,\n timeWindow,\n idsCount,\n}: getPairHoursIdsByTimeWindowParams) => {\n const pairLastIdAsNumber = Number(pairLastId)\n if (timeWindow === PairDataTimeWindowEnum.DAY) {\n return []\n }\n return times(idsCount, (value) => `${pairAddress}-${pairLastIdAsNumber - value * timeWindowGapMapping[timeWindow]}`)\n}\n\nexport const pairHasEnoughLiquidity = (\n data: PairHoursDatasResponse | PairDayDatasResponse | null,\n timeWindow: PairDataTimeWindowEnum,\n) => {\n const liquidityThreshold = 10000\n switch (timeWindow) {\n case PairDataTimeWindowEnum.DAY:\n case PairDataTimeWindowEnum.WEEK: {\n const amountOfDataPoints = (data as PairHoursDatasResponse)?.pairHourDatas?.length ?? 1\n const totalUSD = (data as PairHoursDatasResponse)?.pairHourDatas?.reduce((totalLiquidity, fetchPairEntry) => {\n return totalLiquidity + parseFloat(fetchPairEntry.reserveUSD)\n }, 0)\n return totalUSD / amountOfDataPoints > liquidityThreshold\n }\n case PairDataTimeWindowEnum.MONTH:\n case PairDataTimeWindowEnum.YEAR: {\n const amountOfDataPoints = (data as PairDayDatasResponse)?.pairDayDatas?.length ?? 1\n const totalUSD = (data as PairDayDatasResponse)?.pairDayDatas?.reduce((totalLiquidity, fetchPairEntry) => {\n return totalLiquidity + parseFloat(fetchPairEntry.reserveUSD)\n }, 0)\n return totalUSD / amountOfDataPoints > liquidityThreshold\n }\n default:\n return null\n }\n}\n","import { gql } from 'graphql-request'\n\nconst pairDayDatas = gql`\n query pairDayDatas($pairId: String, $first: Int) {\n pairDayDatas(first: $first, where: { pairAddress: $pairId }, orderBy: date, orderDirection: desc) {\n id\n date\n reserve0\n reserve1\n reserveUSD\n pairAddress {\n token0 {\n id\n }\n token1 {\n id\n }\n }\n }\n }\n`\nexport default pairDayDatas\n","import { gql } from 'graphql-request'\n\nconst pairHourDatasByIds = gql`\n query pairHourDatasByIds($pairIds: [String]) {\n pairHourDatas(where: { id_in: $pairIds }, orderBy: hourStartUnix, orderDirection: desc) {\n id\n hourStartUnix\n reserve0\n reserve1\n reserveUSD\n pair {\n token0 {\n id\n }\n token1 {\n id\n }\n }\n }\n }\n`\nexport default pairHourDatasByIds\n","import { gql } from 'graphql-request'\n\nconst lastPairHourId = gql`\n query lastPairHourId($pairId: String) {\n pairHourDatas(first: 1, where: { pair: $pairId }, orderBy: hourStartUnix, orderDirection: desc) {\n id\n }\n }\n`\nexport default lastPairHourId\n","import requestWithTimeout from 'utils/requestWithTimeout'\nimport { infoClient } from 'utils/graphql'\nimport lastPairDayId from '../queries/lastPairDayId'\nimport pairHourDatas from '../queries/pairHourDatas'\nimport pairDayDatasByIdsQuery from '../queries/pairDayDatasByIdsQuery'\nimport { PairDataTimeWindowEnum } from '../types'\nimport { timeWindowIdsCountMapping } from './constants'\nimport {\n fetchPairDataParams,\n LastPairDayIdResponse,\n LastPairHourIdResponse,\n PairDayDatasResponse,\n PairHoursDatasResponse,\n} from './types'\nimport { getIdsByTimeWindow, getPairSequentialId } from './utils'\nimport pairDayDatas from '../queries/pairDayDatas'\nimport pairHourDatasByIds from '../queries/pairHourDatasByIds'\nimport lastPairHourId from '../queries/lastPairHourId'\n\nconst fetchPairPriceData = async ({ pairId, timeWindow }: fetchPairDataParams) => {\n const client = infoClient\n\n try {\n switch (timeWindow) {\n case PairDataTimeWindowEnum.DAY: {\n const data = await requestWithTimeout(client, pairHourDatas, {\n pairId,\n first: timeWindowIdsCountMapping[timeWindow],\n })\n return { data, error: false }\n }\n case PairDataTimeWindowEnum.WEEK: {\n const lastPairHourIdData = await requestWithTimeout(client, lastPairHourId, { pairId })\n const lastId = lastPairHourIdData?.pairHourDatas ? lastPairHourIdData.pairHourDatas[0]?.id : null\n if (!lastId) {\n return { data: { pairHourDatas: [] }, error: false }\n }\n const pairHourId = getPairSequentialId({ id: lastId, pairId })\n const pairHourIds = getIdsByTimeWindow({\n pairAddress: pairId,\n pairLastId: pairHourId,\n timeWindow,\n idsCount: timeWindowIdsCountMapping[timeWindow],\n })\n\n const pairHoursData = await requestWithTimeout(client, pairHourDatasByIds, {\n pairIds: pairHourIds,\n })\n return { data: pairHoursData, error: false }\n }\n case PairDataTimeWindowEnum.MONTH: {\n const data = await requestWithTimeout(client, pairDayDatas, {\n pairId,\n first: timeWindowIdsCountMapping[timeWindow],\n })\n return { data, error: false }\n }\n case PairDataTimeWindowEnum.YEAR: {\n const lastPairDayIdData = await requestWithTimeout(client, lastPairDayId, { pairId })\n const lastId = lastPairDayIdData?.pairDayDatas ? lastPairDayIdData.pairDayDatas[0]?.id : null\n if (!lastId) {\n return { data: { pairDayDatas: [] }, error: false }\n }\n const pairLastId = getPairSequentialId({ id: lastId, pairId })\n const pairDayIds = getIdsByTimeWindow({\n pairAddress: pairId,\n pairLastId,\n timeWindow,\n idsCount: timeWindowIdsCountMapping[timeWindow],\n })\n const pairDayData = await requestWithTimeout(client, pairDayDatasByIdsQuery, {\n pairIds: pairDayIds,\n })\n return { data: pairDayData, error: false }\n }\n default:\n return { data: null, error: false }\n }\n } catch (error) {\n console.error('Failed to fetch price chart data', error)\n return { error: true }\n }\n}\n\nexport default fetchPairPriceData\n","import { gql } from 'graphql-request'\nimport { Block } from 'state/info/types'\n\nexport const getDerivedPrices = (tokenAddress: string, blocks: Block[]) =>\n blocks.map(\n (block) => `\n t${block.timestamp}:token(id:\"${tokenAddress}\", block: { number: ${block.number} }) { \n derivedBNB\n }\n `,\n )\n\nexport const getDerivedPricesQueryConstructor = (subqueries: string[]) => {\n return gql`\n query derivedTokenPriceData {\n ${subqueries}\n }\n `\n}\n","import orderBy from 'lodash/orderBy'\nimport { INFO_CLIENT } from 'config/constants/endpoints'\nimport { ONE_DAY_UNIX, ONE_HOUR_SECONDS } from 'config/constants/info'\nimport { getBlocksFromTimestamps } from 'utils/getBlocksFromTimestamps'\nimport { getUnixTime, startOfHour, sub } from 'date-fns'\nimport { Block } from 'state/info/types'\nimport { multiQuery } from 'views/Info/utils/infoQueryHelpers'\nimport { getDerivedPrices, getDerivedPricesQueryConstructor } from '../queries/getDerivedPrices'\nimport { PairDataTimeWindowEnum } from '../types'\n\nconst getTokenDerivedBnbPrices = async (tokenAddress: string, blocks: Block[]) => {\n const prices: any | undefined = await multiQuery(\n getDerivedPricesQueryConstructor,\n getDerivedPrices(tokenAddress, blocks),\n INFO_CLIENT,\n 200,\n )\n\n if (!prices) {\n console.error('Price data failed to load')\n return null\n }\n\n // format token ETH price results\n const tokenPrices: {\n tokenAddress: string\n timestamp: string\n derivedBNB: number\n }[] = []\n\n // Get Token prices in ETH\n Object.keys(prices).forEach((priceKey) => {\n const timestamp = priceKey.split('t')[1]\n if (timestamp) {\n tokenPrices.push({\n tokenAddress,\n timestamp,\n derivedBNB: prices[priceKey]?.derivedBNB ? parseFloat(prices[priceKey].derivedBNB) : 0,\n })\n }\n })\n\n return orderBy(tokenPrices, (tokenPrice) => parseInt(tokenPrice.timestamp, 10))\n}\n\nconst getInterval = (timeWindow: PairDataTimeWindowEnum) => {\n switch (timeWindow) {\n case PairDataTimeWindowEnum.DAY:\n return ONE_HOUR_SECONDS\n case PairDataTimeWindowEnum.WEEK:\n return ONE_HOUR_SECONDS * 4\n case PairDataTimeWindowEnum.MONTH:\n return ONE_DAY_UNIX\n case PairDataTimeWindowEnum.YEAR:\n return ONE_DAY_UNIX * 15\n default:\n return ONE_HOUR_SECONDS * 4\n }\n}\n\nconst getSkipDaysToStart = (timeWindow: PairDataTimeWindowEnum) => {\n switch (timeWindow) {\n case PairDataTimeWindowEnum.DAY:\n return 1\n case PairDataTimeWindowEnum.WEEK:\n return 7\n case PairDataTimeWindowEnum.MONTH:\n return 30\n case PairDataTimeWindowEnum.YEAR:\n return 365\n default:\n return 7\n }\n}\n\n// Fetches derivedBnb values for tokens to calculate derived price\n// Used when no direct pool is available\nconst fetchDerivedPriceData = async (\n token0Address: string,\n token1Address: string,\n timeWindow: PairDataTimeWindowEnum,\n) => {\n const interval = getInterval(timeWindow)\n const endTimestamp = getUnixTime(new Date())\n const startTimestamp = getUnixTime(startOfHour(sub(endTimestamp * 1000, { days: getSkipDaysToStart(timeWindow) })))\n const timestamps = []\n let time = startTimestamp\n while (time <= endTimestamp) {\n timestamps.push(time)\n time += interval\n }\n\n try {\n const blocks = await getBlocksFromTimestamps(timestamps, 'asc', 500)\n if (!blocks || blocks.length === 0) {\n console.error('Error fetching blocks for timestamps', timestamps)\n return null\n }\n\n const [token0DerivedBnb, token1DerivedBnb] = await Promise.all([\n getTokenDerivedBnbPrices(token0Address, blocks),\n getTokenDerivedBnbPrices(token1Address, blocks),\n ])\n return { token0DerivedBnb, token1DerivedBnb }\n } catch (error) {\n console.error('Failed to fetched derived price data for chart', error)\n return null\n }\n}\n\nexport default fetchDerivedPriceData\n","/* eslint-disable no-param-reassign */\nimport { gql } from 'graphql-request'\nimport { useEffect, useState } from 'react'\nimport { PoolData } from 'state/info/types'\nimport { infoClient } from 'utils/graphql'\nimport { getChangeForPeriod } from 'utils/getChangeForPeriod'\nimport { getLpFeesAndApr } from 'utils/getLpFeesAndApr'\nimport { getDeltaTimestamps } from 'utils/getDeltaTimestamps'\nimport { useBlocksFromTimestamps } from 'views/Info/hooks/useBlocksFromTimestamps'\nimport { getPercentChange } from 'views/Info/utils/infoDataHelpers'\n\ninterface PoolFields {\n id: string\n reserve0: string\n reserve1: string\n reserveUSD: string\n volumeUSD: string\n token0Price: string\n token1Price: string\n token0: {\n id: string\n symbol: string\n name: string\n }\n token1: {\n id: string\n symbol: string\n name: string\n }\n}\n\nexport interface FormattedPoolFields\n extends Omit {\n volumeUSD: number\n reserveUSD: number\n reserve0: number\n reserve1: number\n token0Price: number\n token1Price: number\n}\n\ninterface PoolsQueryResponse {\n now: PoolFields[]\n oneDayAgo: PoolFields[]\n twoDaysAgo: PoolFields[]\n oneWeekAgo: PoolFields[]\n twoWeeksAgo: PoolFields[]\n}\n\n/**\n * Data for displaying pool tables (on multiple pages, used throughout the site)\n * Note: Don't try to refactor it to use variables, server throws error if blocks passed as undefined variable\n * only works if its hard-coded into query string\n */\nconst POOL_AT_BLOCK = (block: number | null, pools: string[]) => {\n const blockString = block ? `block: {number: ${block}}` : ``\n const addressesString = `[\"${pools.join('\",\"')}\"]`\n return `pairs(\n where: { id_in: ${addressesString} }\n ${blockString}\n orderBy: trackedReserveBNB\n orderDirection: desc\n ) {\n id\n reserve0\n reserve1\n reserveUSD\n volumeUSD\n token0Price\n token1Price\n token0 {\n id\n symbol\n name\n }\n token1 {\n id\n symbol\n name\n }\n }`\n}\n\nexport const fetchPoolData = async (\n block24h: number,\n block48h: number,\n block7d: number,\n block14d: number,\n poolAddresses: string[],\n) => {\n try {\n const query = gql`\n query pools {\n now: ${POOL_AT_BLOCK(null, poolAddresses)}\n oneDayAgo: ${POOL_AT_BLOCK(block24h, poolAddresses)}\n twoDaysAgo: ${POOL_AT_BLOCK(block48h, poolAddresses)}\n oneWeekAgo: ${POOL_AT_BLOCK(block7d, poolAddresses)}\n twoWeeksAgo: ${POOL_AT_BLOCK(block14d, poolAddresses)}\n }\n `\n const data = await infoClient.request(query)\n return { data, error: false }\n } catch (error) {\n console.error('Failed to fetch pool data', error)\n return { error: true }\n }\n}\n\n// Transforms pools into \"0xADDRESS: { ...PoolFields }\" format and cast strings to numbers\nexport const parsePoolData = (pairs?: PoolFields[]) => {\n if (!pairs) {\n return {}\n }\n return pairs.reduce((accum: { [address: string]: FormattedPoolFields }, poolData) => {\n const { volumeUSD, reserveUSD, reserve0, reserve1, token0Price, token1Price } = poolData\n accum[poolData.id] = {\n ...poolData,\n volumeUSD: parseFloat(volumeUSD),\n reserveUSD: parseFloat(reserveUSD),\n reserve0: parseFloat(reserve0),\n reserve1: parseFloat(reserve1),\n token0Price: parseFloat(token0Price),\n token1Price: parseFloat(token1Price),\n }\n return accum\n }, {})\n}\n\ninterface PoolDatas {\n error: boolean\n data?: {\n [address: string]: PoolData\n }\n}\n\n/**\n * Fetch top pools by liquidity\n */\nconst usePoolDatas = (poolAddresses: string[]): PoolDatas => {\n const [fetchState, setFetchState] = useState({ error: false })\n const [t24h, t48h, t7d, t14d] = getDeltaTimestamps()\n const { blocks, error: blockError } = useBlocksFromTimestamps([t24h, t48h, t7d, t14d])\n const [block24h, block48h, block7d, block14d] = blocks ?? []\n\n useEffect(() => {\n const fetch = async () => {\n const { error, data } = await fetchPoolData(\n block24h.number,\n block48h.number,\n block7d.number,\n block14d.number,\n poolAddresses,\n )\n if (error) {\n setFetchState({ error: true })\n } else {\n const formattedPoolData = parsePoolData(data?.now)\n const formattedPoolData24h = parsePoolData(data?.oneDayAgo)\n const formattedPoolData48h = parsePoolData(data?.twoDaysAgo)\n const formattedPoolData7d = parsePoolData(data?.oneWeekAgo)\n const formattedPoolData14d = parsePoolData(data?.twoWeeksAgo)\n\n // Calculate data and format\n const formatted = poolAddresses.reduce((accum: { [address: string]: PoolData }, address) => {\n // Undefined data is possible if pool is brand new and didn't exist one day ago or week ago.\n const current: FormattedPoolFields | undefined = formattedPoolData[address]\n const oneDay: FormattedPoolFields | undefined = formattedPoolData24h[address]\n const twoDays: FormattedPoolFields | undefined = formattedPoolData48h[address]\n const week: FormattedPoolFields | undefined = formattedPoolData7d[address]\n const twoWeeks: FormattedPoolFields | undefined = formattedPoolData14d[address]\n\n const [volumeUSD, volumeUSDChange] = getChangeForPeriod(\n current?.volumeUSD,\n oneDay?.volumeUSD,\n twoDays?.volumeUSD,\n )\n const [volumeUSDWeek, volumeUSDChangeWeek] = getChangeForPeriod(\n current?.volumeUSD,\n week?.volumeUSD,\n twoWeeks?.volumeUSD,\n )\n\n const liquidityUSD = current ? current.reserveUSD : 0\n\n const liquidityUSDChange = getPercentChange(current?.reserveUSD, oneDay?.reserveUSD)\n\n const liquidityToken0 = current ? current.reserve0 : 0\n const liquidityToken1 = current ? current.reserve1 : 0\n\n const { totalFees24h, totalFees7d, lpFees24h, lpFees7d, lpApr7d } = getLpFeesAndApr(\n volumeUSD,\n volumeUSDWeek,\n liquidityUSD,\n )\n\n if (current) {\n accum[address] = {\n address,\n token0: {\n address: current.token0.id,\n name: current.token0.name,\n symbol: current.token0.symbol,\n },\n token1: {\n address: current.token1.id,\n name: current.token1.name,\n symbol: current.token1.symbol,\n },\n token0Price: current.token0Price,\n token1Price: current.token1Price,\n volumeUSD,\n volumeUSDChange,\n volumeUSDWeek,\n volumeUSDChangeWeek,\n totalFees24h,\n totalFees7d,\n lpFees24h,\n lpFees7d,\n lpApr7d,\n liquidityUSD,\n liquidityUSDChange,\n liquidityToken0,\n liquidityToken1,\n }\n }\n\n return accum\n }, {})\n setFetchState({ data: formatted, error: false })\n }\n }\n\n const allBlocksAvailable = block24h?.number && block48h?.number && block7d?.number && block14d?.number\n if (poolAddresses.length > 0 && allBlocksAvailable && !blockError) {\n fetch()\n }\n }, [poolAddresses, block24h, block48h, block7d, block14d, blockError])\n\n return fetchState\n}\n\nexport default usePoolDatas\n","import { ChainId, Currency, CurrencyAmount, Pair, Trade } from '@pancakeswap/sdk'\nimport { ParsedUrlQuery } from 'querystring'\nimport { useEffect, useMemo, useState } from 'react'\nimport { useAccount , useNetwork } from 'wagmi'\nimport { SLOW_INTERVAL } from 'config/constants'\nimport { DEFAULT_INPUT_CURRENCY, DEFAULT_OUTPUT_CURRENCY , getChainId } from 'config/constants/exchange'\nimport useSWRImmutable from 'swr/immutable'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { useTradeExactIn, useTradeExactOut } from 'hooks/Trades'\nimport { useRouter } from 'next/router'\nimport { useTranslation } from 'contexts/Localization'\nimport { isAddress } from 'utils'\nimport { getDeltaTimestamps } from 'utils/getDeltaTimestamps'\nimport { getBlocksFromTimestamps } from 'utils/getBlocksFromTimestamps'\nimport { getChangeForPeriod } from 'utils/getChangeForPeriod'\nimport { getLpFeesAndApr } from 'utils/getLpFeesAndApr'\nimport { computeSlippageAdjustedAmounts } from 'utils/exchange'\nimport getLpAddress from 'utils/getLpAddress'\nimport { getTokenAddress } from 'views/Swap/components/Chart/utils'\nimport tryParseAmount from 'utils/tryParseAmount'\nimport { AppState, useAppDispatch } from '../index'\nimport { useCurrencyBalances } from '../wallet/hooks'\nimport { Field, replaceSwapState, updateDerivedPairData, updatePairData } from './actions'\nimport { SwapState } from './reducer'\nimport { useUserSlippageTolerance } from '../user/hooks'\nimport fetchPairPriceData from './fetch/fetchPairPriceData'\nimport {\n normalizeChartData,\n normalizeDerivedChartData,\n normalizeDerivedPairDataByActiveToken,\n normalizePairDataByActiveToken,\n} from './normalizers'\nimport { PairDataTimeWindowEnum } from './types'\nimport { derivedPairByDataIdSelector, pairByDataIdSelector } from './selectors'\nimport fetchDerivedPriceData from './fetch/fetchDerivedPriceData'\nimport { pairHasEnoughLiquidity } from './fetch/utils'\nimport { parsePoolData, fetchPoolData, FormattedPoolFields } from '../info/queries/pools/poolData'\n\n\nexport function useSwapState(): AppState['swap'] {\n return useSelector((state) => state.swap)\n}\n\nconst BAD_RECIPIENT_ADDRESSES: string[] = [\n '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f', // v2 factory\n '0xf164fC0Ec4E93095b804a4795bBe1e041497b92a', // v2 router 01\n '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', // v2 router 02\n]\n\n/**\n * Returns true if any of the pairs or tokens in a trade have the given checksummed address\n * @param trade to check for the given address\n * @param checksummedAddress address to check in the pairs and tokens\n */\nfunction involvesAddress(trade: Trade, checksummedAddress: string): boolean {\n return (\n trade.route.path.some((token) => token.address === checksummedAddress) ||\n trade.route.pairs.some((pair) => pair.liquidityToken.address === checksummedAddress)\n )\n}\n\n// Get swap price for single token disregarding slippage and price impact\nexport function useSingleTokenSwapInfo(\n inputCurrencyId: string | undefined,\n inputCurrency: Currency | undefined,\n outputCurrencyId: string | undefined,\n outputCurrency: Currency | undefined,\n): { [key: string]: number } {\n const token0Address = getTokenAddress(inputCurrencyId)\n const token1Address = getTokenAddress(outputCurrencyId)\n\n const parsedAmount = tryParseAmount('1', inputCurrency ?? undefined)\n\n const bestTradeExactIn = useTradeExactIn(parsedAmount, outputCurrency ?? undefined)\n if (!inputCurrency || !outputCurrency || !bestTradeExactIn) {\n return null\n }\n\n const inputTokenPrice = parseFloat(bestTradeExactIn?.executionPrice?.toSignificant(6))\n const outputTokenPrice = 1 / inputTokenPrice\n\n return {\n [token0Address]: inputTokenPrice,\n [token1Address]: outputTokenPrice,\n }\n}\n\n// from the current swap inputs, compute the best trade and return it.\nexport function useDerivedSwapInfo(\n independentField: Field,\n typedValue: string,\n inputCurrency: Currency | undefined,\n outputCurrency: Currency | undefined,\n recipient: string,\n): {\n currencies: { [field in Field]?: Currency }\n currencyBalances: { [field in Field]?: CurrencyAmount }\n parsedAmount: CurrencyAmount | undefined\n v2Trade: Trade | undefined\n inputError?: string\n} {\n const { address } = useAccount()\n const { t } = useTranslation()\n\n const to: string | null = (recipient === null ? address : isAddress(recipient) || null) ?? null\n\n const relevantTokenBalances = useCurrencyBalances(address ?? undefined, [\n inputCurrency ?? undefined,\n outputCurrency ?? undefined,\n ])\n\n const isExactIn: boolean = independentField === Field.INPUT\n const parsedAmount = tryParseAmount(typedValue, (isExactIn ? inputCurrency : outputCurrency) ?? undefined)\n\n const bestTradeExactIn = useTradeExactIn(isExactIn ? parsedAmount : undefined, outputCurrency ?? undefined)\n const bestTradeExactOut = useTradeExactOut(inputCurrency ?? undefined, !isExactIn ? parsedAmount : undefined)\n\n const v2Trade = isExactIn ? bestTradeExactIn : bestTradeExactOut\n\n const currencyBalances = {\n [Field.INPUT]: relevantTokenBalances[0],\n [Field.OUTPUT]: relevantTokenBalances[1],\n }\n\n const currencies: { [field in Field]?: Currency } = {\n [Field.INPUT]: inputCurrency ?? undefined,\n [Field.OUTPUT]: outputCurrency ?? undefined,\n }\n\n let inputError: string | undefined\n if (!address) {\n inputError = t('Connect Wallet')\n }\n\n if (!parsedAmount) {\n inputError = inputError ?? t('Enter an amount')\n }\n\n if (!currencies[Field.INPUT] || !currencies[Field.OUTPUT]) {\n inputError = inputError ?? t('Select a token')\n }\n\n const formattedTo = isAddress(to)\n if (!to || !formattedTo) {\n inputError = inputError ?? t('Enter a recipient')\n } else if (\n BAD_RECIPIENT_ADDRESSES.indexOf(formattedTo) !== -1 ||\n (bestTradeExactIn && involvesAddress(bestTradeExactIn, formattedTo)) ||\n (bestTradeExactOut && involvesAddress(bestTradeExactOut, formattedTo))\n ) {\n inputError = inputError ?? t('Invalid recipient')\n }\n\n const [allowedSlippage] = useUserSlippageTolerance()\n\n const slippageAdjustedAmounts = v2Trade && allowedSlippage && computeSlippageAdjustedAmounts(v2Trade, allowedSlippage)\n\n // compare input balance to max input based on version\n const [balanceIn, amountIn] = [\n currencyBalances[Field.INPUT],\n slippageAdjustedAmounts ? slippageAdjustedAmounts[Field.INPUT] : null,\n ]\n\n if (balanceIn && amountIn && balanceIn.lessThan(amountIn)) {\n inputError = t('Insufficient %symbol% balance', { symbol: amountIn.currency.symbol })\n }\n\n return {\n currencies,\n currencyBalances,\n parsedAmount,\n v2Trade: v2Trade ?? undefined,\n inputError,\n }\n}\n\nfunction parseCurrencyFromURLParameter(urlParam: any): string {\n if (typeof urlParam === 'string') {\n const valid = isAddress(urlParam)\n if (valid) return valid\n if (urlParam.toUpperCase() === 'ETH') return 'ETH'\n if (valid === false) return 'ETH'\n }\n return ''\n}\n\nfunction parseTokenAmountURLParameter(urlParam: any): string {\n return typeof urlParam === 'string' && !Number.isNaN(parseFloat(urlParam)) ? urlParam : ''\n}\n\nfunction parseIndependentFieldURLParameter(urlParam: any): Field {\n return typeof urlParam === 'string' && urlParam.toLowerCase() === 'output' ? Field.OUTPUT : Field.INPUT\n}\n\nconst ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/\nfunction validatedRecipient(recipient: any): string | null {\n if (typeof recipient !== 'string') return null\n const address = isAddress(recipient)\n if (address) return address\n if (ADDRESS_REGEX.test(recipient)) return recipient\n return null\n}\n\nexport function queryParametersToSwapState(parsedQs: ParsedUrlQuery, chainId: ChainId): SwapState {\n const currentchainId = getChainId(chainId , true);\n let inputCurrency = parseCurrencyFromURLParameter(parsedQs.inputCurrency) || DEFAULT_INPUT_CURRENCY[currentchainId]\n let outputCurrency = parseCurrencyFromURLParameter(parsedQs.outputCurrency) || DEFAULT_OUTPUT_CURRENCY[currentchainId]\n if (inputCurrency === outputCurrency) {\n if (typeof parsedQs.outputCurrency === 'string') {\n inputCurrency = ''\n } else {\n outputCurrency = ''\n }\n }\n\n const recipient = validatedRecipient(parsedQs.recipient)\n\n return {\n [Field.INPUT]: {\n currencyId: inputCurrency,\n },\n [Field.OUTPUT]: {\n currencyId: outputCurrency,\n },\n typedValue: parseTokenAmountURLParameter(parsedQs.exactAmount),\n independentField: parseIndependentFieldURLParameter(parsedQs.exactField),\n recipient,\n pairDataById: {},\n derivedPairDataById: {},\n }\n}\n\n// updates the swap state to use the defaults for a given network\nexport function useDefaultsFromURLSearch():\n | { inputCurrencyId: string | undefined; outputCurrencyId: string | undefined }\n | undefined {\n const { chain } = useNetwork()\n const chainId = getChainId(chain);\n const dispatch = useAppDispatch()\n const { query } = useRouter()\n const [result, setResult] = useState<\n { inputCurrencyId: string | undefined; outputCurrencyId: string | undefined } | undefined\n >()\n\n useEffect(() => {\n if (!chainId) return\n const parsed = queryParametersToSwapState(query, chainId)\n\n dispatch(\n replaceSwapState({\n typedValue: parsed.typedValue,\n field: parsed.independentField,\n inputCurrencyId: parsed[Field.INPUT].currencyId,\n outputCurrencyId: parsed[Field.OUTPUT].currencyId,\n recipient: null,\n }),\n )\n\n setResult({ inputCurrencyId: parsed[Field.INPUT].currencyId, outputCurrencyId: parsed[Field.OUTPUT].currencyId })\n }, [dispatch, chainId, query])\n\n return result\n}\n\ntype useFetchPairPricesParams = {\n token0Address: string\n token1Address: string\n timeWindow: PairDataTimeWindowEnum\n currentSwapPrice: {\n [key: string]: number\n }\n}\n\nexport const useFetchPairPrices = ({\n token0Address,\n token1Address,\n timeWindow,\n currentSwapPrice,\n}: useFetchPairPricesParams) => {\n const [pairId, setPairId] = useState(null)\n const [isLoading, setIsLoading] = useState(false)\n const pairData = useSelector(pairByDataIdSelector({ pairId, timeWindow }))\n const derivedPairData = useSelector(derivedPairByDataIdSelector({ pairId, timeWindow }))\n const dispatch = useDispatch()\n\n useEffect(() => {\n const fetchDerivedData = async () => {\n console.info(\n '[Price Chart]: Not possible to retrieve price data from single pool, trying to fetch derived prices',\n )\n try {\n // Try to get at least derived data for chart\n // This is used when there is no direct data for pool\n // i.e. when multihops are necessary\n const derivedData = await fetchDerivedPriceData(token0Address, token1Address, timeWindow)\n if (derivedData) {\n const normalizedDerivedData = normalizeDerivedChartData(derivedData)\n dispatch(updateDerivedPairData({ pairData: normalizedDerivedData, pairId, timeWindow }))\n } else {\n dispatch(updateDerivedPairData({ pairData: [], pairId, timeWindow }))\n }\n } catch (error) {\n console.error('Failed to fetch derived prices for chart', error)\n dispatch(updateDerivedPairData({ pairData: [], pairId, timeWindow }))\n } finally {\n setIsLoading(false)\n }\n }\n\n const fetchAndUpdatePairPrice = async () => {\n setIsLoading(true)\n const { data } = await fetchPairPriceData({ pairId, timeWindow })\n if (data) {\n // Find out if Liquidity Pool has enough liquidity\n // low liquidity pool might mean that the price is incorrect\n // in that case try to get derived price\n const hasEnoughLiquidity = pairHasEnoughLiquidity(data, timeWindow)\n const newPairData = normalizeChartData(data, timeWindow) || []\n if (newPairData.length > 0 && hasEnoughLiquidity) {\n dispatch(updatePairData({ pairData: newPairData, pairId, timeWindow }))\n setIsLoading(false)\n } else {\n console.info(`[Price Chart]: Liquidity too low for ${pairId}`)\n dispatch(updatePairData({ pairData: [], pairId, timeWindow }))\n fetchDerivedData()\n }\n } else {\n dispatch(updatePairData({ pairData: [], pairId, timeWindow }))\n fetchDerivedData()\n }\n }\n\n if (!pairData && !derivedPairData && pairId && !isLoading) {\n fetchAndUpdatePairPrice()\n }\n }, [\n pairId,\n timeWindow,\n pairData,\n currentSwapPrice,\n token0Address,\n token1Address,\n derivedPairData,\n dispatch,\n isLoading,\n ])\n\n useEffect(() => {\n const updatePairId = () => {\n try {\n const pairAddress = getLpAddress(token0Address, token1Address)?.toLowerCase()\n if (pairAddress !== pairId) {\n setPairId(pairAddress)\n }\n } catch (error) {\n setPairId(null)\n }\n }\n\n updatePairId()\n }, [token0Address, token1Address, pairId])\n\n const normalizedPairData = useMemo(\n () => normalizePairDataByActiveToken({ activeToken: token0Address, pairData }),\n [token0Address, pairData],\n )\n\n const normalizedDerivedPairData = useMemo(\n () => normalizeDerivedPairDataByActiveToken({ activeToken: token0Address, pairData: derivedPairData }),\n [token0Address, derivedPairData],\n )\n\n const hasSwapPrice = currentSwapPrice && currentSwapPrice[token0Address] > 0\n\n const normalizedPairDataWithCurrentSwapPrice =\n normalizedPairData?.length > 0 && hasSwapPrice\n ? [...normalizedPairData, { time: new Date(), value: currentSwapPrice[token0Address] }]\n : normalizedPairData\n\n const normalizedDerivedPairDataWithCurrentSwapPrice =\n normalizedDerivedPairData?.length > 0 && hasSwapPrice\n ? [...normalizedDerivedPairData, { time: new Date(), value: currentSwapPrice[token0Address] }]\n : normalizedDerivedPairData\n\n const hasNoDirectData = normalizedPairDataWithCurrentSwapPrice && normalizedPairDataWithCurrentSwapPrice?.length === 0\n const hasNoDerivedData =\n normalizedDerivedPairDataWithCurrentSwapPrice && normalizedDerivedPairDataWithCurrentSwapPrice?.length === 0\n\n // undefined is used for loading\n let pairPrices = hasNoDirectData && hasNoDerivedData ? [] : undefined\n if (normalizedPairDataWithCurrentSwapPrice && normalizedPairDataWithCurrentSwapPrice?.length > 0) {\n pairPrices = normalizedPairDataWithCurrentSwapPrice\n } else if (\n normalizedDerivedPairDataWithCurrentSwapPrice &&\n normalizedDerivedPairDataWithCurrentSwapPrice?.length > 0\n ) {\n pairPrices = normalizedDerivedPairDataWithCurrentSwapPrice\n }\n return { pairPrices, pairId }\n}\n\nexport const useLPApr = (pair?: Pair) => {\n const { data: poolData } = useSWRImmutable(\n pair && pair.chainId === ChainId.BSC ? ['LP7dApr', pair.liquidityToken.address] : null,\n async () => {\n const timestampsArray = getDeltaTimestamps()\n const blocks = await getBlocksFromTimestamps(timestampsArray, 'desc', 1000)\n const [block24h, block48h, block7d, block14d] = blocks ?? []\n const { error, data } = await fetchPoolData(block24h.number, block48h.number, block7d.number, block14d.number, [\n pair.liquidityToken.address.toLowerCase(),\n ])\n if (error) return null\n const formattedPoolData = parsePoolData(data?.now)\n const formattedPoolData24h = parsePoolData(data?.oneDayAgo)\n const formattedPoolData48h = parsePoolData(data?.twoDaysAgo)\n const formattedPoolData7d = parsePoolData(data?.oneWeekAgo)\n const formattedPoolData14d = parsePoolData(data?.twoWeeksAgo)\n const current: FormattedPoolFields | undefined = formattedPoolData[pair.liquidityToken.address.toLowerCase()]\n const oneDay: FormattedPoolFields | undefined = formattedPoolData24h[pair.liquidityToken.address.toLowerCase()]\n const twoDays: FormattedPoolFields | undefined = formattedPoolData48h[pair.liquidityToken.address.toLowerCase()]\n const week: FormattedPoolFields | undefined = formattedPoolData7d[pair.liquidityToken.address.toLowerCase()]\n const twoWeeks: FormattedPoolFields | undefined = formattedPoolData14d[pair.liquidityToken.address.toLowerCase()]\n const [volumeUSD] = getChangeForPeriod(current?.volumeUSD, oneDay?.volumeUSD, twoDays?.volumeUSD)\n const [volumeUSDWeek] = getChangeForPeriod(current?.volumeUSD, week?.volumeUSD, twoWeeks?.volumeUSD)\n const liquidityUSD = current ? current.reserveUSD : 0\n const { lpApr7d } = getLpFeesAndApr(volumeUSD, volumeUSDWeek, liquidityUSD)\n return lpApr7d ? { lpApr7d } : null\n },\n {\n refreshInterval: SLOW_INTERVAL,\n },\n )\n\n return poolData\n}\n","import get from 'lodash/get'\nimport { AppState } from 'state'\nimport { PairDataTimeWindowEnum } from './types'\n\ntype pairByDataIdSelectorParams = {\n pairId: string\n timeWindow: PairDataTimeWindowEnum\n}\n\nexport const pairByDataIdSelector =\n ({ pairId, timeWindow }: pairByDataIdSelectorParams) =>\n (state: AppState) =>\n get(state, ['swap', 'pairDataById', pairId, timeWindow])\n\nexport const derivedPairByDataIdSelector =\n ({ pairId, timeWindow }: pairByDataIdSelectorParams) =>\n (state: AppState) =>\n get(state, ['swap', 'derivedPairDataById', pairId, timeWindow])\n","import { fromUnixTime } from 'date-fns'\nimport { PairDayDatasResponse, PairHoursDatasResponse } from './fetch/types'\nimport { DerivedPairDataNormalized, PairDataNormalized, PairDataTimeWindowEnum, PairPricesNormalized } from './types'\n\nexport const normalizeChartData = (\n data: PairHoursDatasResponse | PairDayDatasResponse | null,\n timeWindow: PairDataTimeWindowEnum,\n) => {\n switch (timeWindow) {\n case PairDataTimeWindowEnum.DAY:\n case PairDataTimeWindowEnum.WEEK:\n return (data as PairHoursDatasResponse)?.pairHourDatas?.map((fetchPairEntry) => ({\n time: fetchPairEntry.hourStartUnix,\n token0Id: fetchPairEntry.pair.token0.id,\n token1Id: fetchPairEntry.pair.token1.id,\n reserve0: parseFloat(fetchPairEntry.reserve0),\n reserve1: parseFloat(fetchPairEntry.reserve1),\n }))\n case PairDataTimeWindowEnum.MONTH:\n case PairDataTimeWindowEnum.YEAR:\n return (data as PairDayDatasResponse)?.pairDayDatas?.map((fetchPairEntry) => ({\n time: fetchPairEntry.date,\n token0Id: fetchPairEntry.pairAddress.token0.id,\n token1Id: fetchPairEntry.pairAddress.token1.id,\n reserve0: parseFloat(fetchPairEntry.reserve0),\n reserve1: parseFloat(fetchPairEntry.reserve1),\n }))\n default:\n return null\n }\n}\n\nexport const normalizeDerivedChartData = (data: any) => {\n if (!data?.token0DerivedBnb || data?.token0DerivedBnb.length === 0) {\n return []\n }\n return data?.token0DerivedBnb.reduce((acc, token0DerivedBnbEntry) => {\n const token1DerivedBnbEntry = data?.token1DerivedBnb?.find(\n (entry) => entry.timestamp === token0DerivedBnbEntry.timestamp,\n )\n if (!token1DerivedBnbEntry) {\n return acc\n }\n return [\n ...acc,\n {\n time: parseInt(token0DerivedBnbEntry.timestamp, 10),\n token0Id: token0DerivedBnbEntry.tokenAddress,\n token1Id: token1DerivedBnbEntry.tokenAddress,\n token0DerivedBNB: token0DerivedBnbEntry.derivedBNB,\n token1DerivedBNB: token1DerivedBnbEntry.derivedBNB,\n },\n ]\n }, [])\n}\n\ntype normalizePairDataByActiveTokenParams = {\n pairData: PairDataNormalized\n activeToken: string\n}\n\nexport const normalizePairDataByActiveToken = ({\n pairData,\n activeToken,\n}: normalizePairDataByActiveTokenParams): PairPricesNormalized =>\n pairData\n ?.map((pairPrice) => ({\n time: fromUnixTime(pairPrice.time),\n value:\n activeToken === pairPrice?.token0Id\n ? pairPrice.reserve1 / pairPrice.reserve0\n : pairPrice.reserve0 / pairPrice.reserve1,\n }))\n .reverse()\n\ntype normalizeDerivedPairDataByActiveTokenParams = {\n pairData: DerivedPairDataNormalized\n activeToken: string\n}\n\nexport const normalizeDerivedPairDataByActiveToken = ({\n pairData,\n activeToken,\n}: normalizeDerivedPairDataByActiveTokenParams): PairPricesNormalized =>\n pairData?.map((pairPrice) => ({\n time: fromUnixTime(pairPrice.time),\n value:\n activeToken === pairPrice?.token0Id\n ? pairPrice.token0DerivedBNB / pairPrice.token1DerivedBNB\n : pairPrice.token1DerivedBNB / pairPrice.token0DerivedBNB,\n }))\n","import { getUnixTime, startOfMinute, subDays, subWeeks } from 'date-fns'\n\n/**\n * Returns UTC timestamps for 24h ago, 48h ago, 7d ago and 14d ago relative to current date and time\n */\nexport const getDeltaTimestamps = (): [number, number, number, number] => {\n const utcCurrentTime = getUnixTime(new Date()) * 1000\n const t24h = getUnixTime(startOfMinute(subDays(utcCurrentTime, 1)))\n const t48h = getUnixTime(startOfMinute(subDays(utcCurrentTime, 2)))\n const t7d = getUnixTime(startOfMinute(subWeeks(utcCurrentTime, 1)))\n const t14d = getUnixTime(startOfMinute(subWeeks(utcCurrentTime, 2)))\n return [t24h, t48h, t7d, t14d]\n}\n","import { TOTAL_FEE, LP_HOLDERS_FEE, WEEKS_IN_YEAR } from '../config/constants/info'\n\nexport const getLpFeesAndApr = (volumeUSD: number, volumeUSDWeek: number, liquidityUSD: number) => {\n const totalFees24h = volumeUSD * TOTAL_FEE\n const totalFees7d = volumeUSDWeek * TOTAL_FEE\n const lpFees24h = volumeUSD * LP_HOLDERS_FEE\n const lpFees7d = volumeUSDWeek * LP_HOLDERS_FEE\n\n const lpApr7d = liquidityUSD > 0 ? (volumeUSDWeek * LP_HOLDERS_FEE * WEEKS_IN_YEAR * 100) / liquidityUSD : 0\n return {\n totalFees24h,\n totalFees7d,\n lpFees24h,\n lpFees7d,\n lpApr7d: lpApr7d !== Infinity ? lpApr7d : 0,\n }\n}\n","export type PairDataNormalized = {\n time: number\n token0Id: string\n token1Id: string\n reserve0: number\n reserve1: number\n}[]\n\nexport type DerivedPairDataNormalized = {\n time: number\n token0Id: string\n token1Id: string\n token0DerivedBNB: number\n token1DerivedBNB: number\n}[]\n\nexport type PairPricesNormalized = {\n time: Date\n value: number\n}[]\n\nexport enum PairDataTimeWindowEnum {\n DAY,\n WEEK,\n MONTH,\n YEAR,\n}\n","import { TransactionResponse } from '@ethersproject/providers'\nimport { useCallback, useMemo } from 'react'\nimport { useSelector } from 'react-redux'\nimport { Order } from '@gelatonetwork/limit-orders-lib'\nimport { useAccount, useNetwork } from 'wagmi'\nimport { getChainId } from 'config/constants/exchange'\nimport { AppState, useAppDispatch } from '../index'\nimport { addTransaction, TransactionType } from './actions'\nimport { TransactionDetails } from './reducer'\n\n// helper that can take a ethers library transaction response and add it to the list of transactions\nexport function useTransactionAdder(): (\n response: TransactionResponse,\n customData?: {\n summary?: string\n approval?: { tokenAddress: string; spender: string }\n claim?: { recipient: string }\n type?: TransactionType\n order?: Order\n },\n) => void {\n const { address: account } = useAccount()\n const { chain } = useNetwork()\n const chainId = getChainId(chain);\n const dispatch = useAppDispatch()\n\n return useCallback(\n (\n response: TransactionResponse,\n {\n summary,\n approval,\n claim,\n type,\n order,\n }: {\n summary?: string\n claim?: { recipient: string }\n approval?: { tokenAddress: string; spender: string }\n type?: TransactionType\n order?: Order\n } = {},\n ) => {\n if (!account) return\n if (!chainId) return\n\n const { hash } = response\n if (!hash) {\n throw Error('No transaction hash found.')\n }\n dispatch(addTransaction({ hash, from: account, chainId, approval, summary, claim, type, order }))\n },\n [dispatch, chainId, account],\n )\n}\n\n// returns all the transactions for the current chain\nexport function useAllTransactions(): { [txHash: string]: TransactionDetails } {\n\n const { chain } = useNetwork()\n const chainId = getChainId(chain);\n\n const state = useSelector((s) => s.transactions)\n\n return useMemo(() => (chainId ? state[chainId] ?? {} : {}), [chainId, state])\n}\n\nexport function useIsTransactionPending(transactionHash?: string): boolean {\n const transactions = useAllTransactions()\n\n if (!transactionHash || !transactions[transactionHash]) return false\n\n return !transactions[transactionHash].receipt\n}\n\n/**\n * Returns whether a transaction happened in the last day (86400 seconds * 1000 milliseconds / second)\n * @param tx to check for recency\n */\nexport function isTransactionRecent(tx: TransactionDetails): boolean {\n return new Date().getTime() - tx.addedTime < 86_400_000\n}\n\n// returns whether a token has a pending approval transaction\nexport function useHasPendingApproval(tokenAddress: string | undefined, spender: string | undefined): boolean {\n const allTransactions = useAllTransactions()\n return useMemo(\n () =>\n typeof tokenAddress === 'string' &&\n typeof spender === 'string' &&\n Object.keys(allTransactions).some((hash) => {\n const tx = allTransactions[hash]\n if (!tx) return false\n if (tx.receipt) {\n return false\n }\n const { approval } = tx\n if (!approval) return false\n return approval.spender === spender && approval.tokenAddress === tokenAddress && isTransactionRecent(tx)\n }),\n [allTransactions, spender, tokenAddress],\n )\n}\n\n// we want the latest one to come first, so return negative if a is after b\nfunction newTransactionsFirst(a: TransactionDetails, b: TransactionDetails) {\n return b.addedTime - a.addedTime\n}\n\n// calculate pending transactions\nexport function usePendingTransactions(): { hasPendingTransactions: boolean; pendingNumber: number } {\n const allTransactions = useAllTransactions()\n const sortedRecentTransactions = useMemo(() => {\n const txs = Object.values(allTransactions)\n return txs.filter(isTransactionRecent).sort(newTransactionsFirst)\n }, [allTransactions])\n\n const pending = sortedRecentTransactions.filter((tx) => !tx.receipt).map((tx) => tx.hash)\n const hasPendingTransactions = !!pending.length\n\n return {\n hasPendingTransactions,\n pendingNumber: pending.length,\n }\n}\n","import { Currency, CurrencyAmount, ETHER, JSBI, Token, TokenAmount } from '@pancakeswap/sdk'\nimport { useMemo } from 'react'\nimport { useAccount } from 'wagmi'\nimport ERC20_INTERFACE from 'config/abi/erc20'\nimport { useAllTokens } from 'hooks/Tokens'\nimport { useMulticallContract } from 'hooks/useContract'\nimport { isAddress } from 'utils'\nimport orderBy from 'lodash/orderBy'\nimport { useSingleContractMultipleData, useMultipleContractSingleData } from '../multicall/hooks'\n\n\n/**\n * Returns a map of the given addresses to their eventually consistent ETH balances.\n */\nexport function useBNBBalances(uncheckedAddresses?: (string | undefined)[]): {\n [address: string]: CurrencyAmount | undefined\n} {\n const multicallContract = useMulticallContract()\n\n const addresses: string[] = useMemo(\n () =>\n uncheckedAddresses ? orderBy(uncheckedAddresses.map(isAddress).filter((a): a is string => a !== false)) : [],\n [uncheckedAddresses],\n )\n\n const results = useSingleContractMultipleData(\n multicallContract,\n 'getEthBalance',\n useMemo(() => addresses.map((address) => [address]), [addresses]),\n )\n\n return useMemo(\n () =>\n addresses.reduce<{ [address: string]: CurrencyAmount }>((memo, address, i) => {\n const value = results?.[i]?.result?.[0]\n if (value) memo[address] = CurrencyAmount.ether(JSBI.BigInt(value.toString()))\n return memo\n }, {}),\n [addresses, results],\n )\n}\n\n/**\n * Returns a map of token addresses to their eventually consistent token balances for a single account.\n */\nexport function useTokenBalancesWithLoadingIndicator(\n address?: string,\n tokens?: (Token | undefined)[],\n): [{ [tokenAddress: string]: TokenAmount | undefined }, boolean] {\n const validatedTokens: Token[] = useMemo(\n () => tokens?.filter((t?: Token): t is Token => isAddress(t?.address) !== false) ?? [],\n [tokens],\n )\n\n const validatedTokenAddresses = useMemo(() => validatedTokens.map((vt) => vt.address), [validatedTokens])\n\n const balances = useMultipleContractSingleData(\n validatedTokenAddresses,\n ERC20_INTERFACE,\n 'balanceOf',\n useMemo(() => [address], [address]),\n )\n\n const anyLoading: boolean = useMemo(() => balances.some((callState) => callState.loading), [balances])\n\n return [\n useMemo(\n () =>\n address && validatedTokens.length > 0\n ? validatedTokens.reduce<{ [tokenAddress: string]: TokenAmount | undefined }>((memo, token, i) => {\n const value = balances?.[i]?.result?.[0]\n const amount = value ? JSBI.BigInt(value.toString()) : undefined\n if (amount) {\n memo[token.address] = new TokenAmount(token, amount)\n }\n return memo\n }, {})\n : {},\n [address, validatedTokens, balances],\n ),\n anyLoading,\n ]\n}\n\nexport function useTokenBalances(\n address?: string,\n tokens?: (Token | undefined)[],\n): { [tokenAddress: string]: TokenAmount | undefined } {\n return useTokenBalancesWithLoadingIndicator(address, tokens)[0]\n}\n\n// get the balance for a single token/account combo\nexport function useTokenBalance(account?: string, token?: Token): TokenAmount | undefined {\n const tokenBalances = useTokenBalances(account, [token])\n if (!token) return undefined\n return tokenBalances[token.address]\n}\n\nexport function useCurrencyBalances(\n account?: string,\n currencies?: (Currency | undefined)[],\n): (CurrencyAmount | undefined)[] {\n const tokens = useMemo(\n () => currencies?.filter((currency): currency is Token => currency instanceof Token) ?? [],\n [currencies],\n )\n\n const tokenBalances = useTokenBalances(account, tokens)\n const containsBNB: boolean = useMemo(() => currencies?.some((currency) => currency === ETHER) ?? false, [currencies])\n const uncheckedAddresses = useMemo(() => (containsBNB ? [account] : []), [containsBNB, account])\n const bnbBalance = useBNBBalances(uncheckedAddresses)\n\n return useMemo(\n () =>\n currencies?.map((currency) => {\n if (!account || !currency) return undefined\n if (currency instanceof Token) return tokenBalances[currency.address]\n if (currency === ETHER) return bnbBalance[account]\n return undefined\n }) ?? [],\n [account, currencies, bnbBalance, tokenBalances],\n )\n}\n\nexport function useCurrencyBalance(account?: string, currency?: Currency): CurrencyAmount | undefined {\n return useCurrencyBalances(account, [currency])[0]\n}\n\n// mimics useAllBalances\nexport function useAllTokenBalances(): { [tokenAddress: string]: TokenAmount | undefined } {\n const { address } = useAccount()\n const allTokens = useAllTokens()\n const allTokensArray = useMemo(() => Object.values(allTokens ?? {}), [allTokens])\n const balances = useTokenBalances(address ?? undefined, allTokensArray)\n return balances ?? {}\n}\n","import { Web3Provider } from '@ethersproject/providers'\nimport IPancakeRouter02ABI from 'config/abi/IPancakeRouter02.json'\nimport { IPancakeRouter02 } from 'config/abi/types/IPancakeRouter02'\nimport { JSBI, Percent, CurrencyAmount, Trade, Fraction, TokenAmount } from '@pancakeswap/sdk'\nimport {\n ROUTER_ADDRESS,\n BIPS_BASE,\n ONE_HUNDRED_PERCENT,\n INPUT_FRACTION_AFTER_FEE,\n BLOCKED_PRICE_IMPACT_NON_EXPERT,\n ALLOWED_PRICE_IMPACT_HIGH,\n ALLOWED_PRICE_IMPACT_MEDIUM,\n ALLOWED_PRICE_IMPACT_LOW,\n} from 'config/constants/exchange'\nimport { getContract, getProviderOrSigner } from './index'\nimport { Field } from '../state/swap/actions'\n\n// converts a basis points value to a sdk percent\nexport function basisPointsToPercent(num: number): Percent {\n return new Percent(JSBI.BigInt(num), BIPS_BASE)\n}\n\nexport function calculateSlippageAmount(value: CurrencyAmount, slippage: number): [JSBI, JSBI] {\n if (slippage < 0 || slippage > 10000) {\n throw Error(`Unexpected slippage value: ${slippage}`)\n }\n return [\n JSBI.divide(JSBI.multiply(value.raw, JSBI.BigInt(10000 - slippage)), BIPS_BASE),\n JSBI.divide(JSBI.multiply(value.raw, JSBI.BigInt(10000 + slippage)), BIPS_BASE),\n ]\n}\n\n// account is optional\nexport function getRouterContract(chainId: number, library: Web3Provider, account?: string) {\n return getContract(\n ROUTER_ADDRESS[chainId],\n IPancakeRouter02ABI,\n getProviderOrSigner(library, account),\n ) as IPancakeRouter02\n}\n\n// computes price breakdown for the trade\nexport function computeTradePriceBreakdown(trade?: Trade | null): {\n priceImpactWithoutFee: Percent | undefined\n realizedLPFee: CurrencyAmount | undefined | null\n} {\n // for each hop in our trade, take away the x*y=k price impact from 0.3% fees\n // e.g. for 3 tokens/2 hops: 1 - ((1 - .03) * (1-.03))\n const realizedLPFee = !trade\n ? undefined\n : ONE_HUNDRED_PERCENT.subtract(\n trade.route.pairs.reduce(\n (currentFee: Fraction): Fraction => currentFee.multiply(INPUT_FRACTION_AFTER_FEE),\n ONE_HUNDRED_PERCENT,\n ),\n )\n\n // remove lp fees from price impact\n const priceImpactWithoutFeeFraction = trade && realizedLPFee ? trade.priceImpact.subtract(realizedLPFee) : undefined\n\n // the x*y=k impact\n const priceImpactWithoutFeePercent = priceImpactWithoutFeeFraction\n ? new Percent(priceImpactWithoutFeeFraction?.numerator, priceImpactWithoutFeeFraction?.denominator)\n : undefined\n\n // the amount of the input that accrues to LPs\n const realizedLPFeeAmount =\n realizedLPFee &&\n trade &&\n (trade.inputAmount instanceof TokenAmount\n ? new TokenAmount(trade.inputAmount.token, realizedLPFee.multiply(trade.inputAmount.raw).quotient)\n : CurrencyAmount.ether(realizedLPFee.multiply(trade.inputAmount.raw).quotient))\n\n return { priceImpactWithoutFee: priceImpactWithoutFeePercent, realizedLPFee: realizedLPFeeAmount }\n}\n\n// computes the minimum amount out and maximum amount in for a trade given a user specified allowed slippage in bips\nexport function computeSlippageAdjustedAmounts(\n trade: Trade | undefined,\n allowedSlippage: number,\n): { [field in Field]?: CurrencyAmount } {\n const pct = basisPointsToPercent(allowedSlippage)\n return {\n [Field.INPUT]: trade?.maximumAmountIn(pct),\n [Field.OUTPUT]: trade?.minimumAmountOut(pct),\n }\n}\n\nexport function warningSeverity(priceImpact: Percent | undefined): 0 | 1 | 2 | 3 | 4 {\n if (!priceImpact?.lessThan(BLOCKED_PRICE_IMPACT_NON_EXPERT)) return 4\n if (!priceImpact?.lessThan(ALLOWED_PRICE_IMPACT_HIGH)) return 3\n if (!priceImpact?.lessThan(ALLOWED_PRICE_IMPACT_MEDIUM)) return 2\n if (!priceImpact?.lessThan(ALLOWED_PRICE_IMPACT_LOW)) return 1\n return 0\n}\n\nexport function formatExecutionPrice(trade?: Trade, inverted?: boolean): string {\n if (!trade) {\n return ''\n }\n return inverted\n ? `${trade.executionPrice.invert().toSignificant(6)} ${trade.inputAmount.currency.symbol} / ${\n trade.outputAmount.currency.symbol\n }`\n : `${trade.executionPrice.toSignificant(6)} ${trade.outputAmount.currency.symbol} / ${\n trade.inputAmount.currency.symbol\n }`\n}\n","import numeral from 'numeral'\n\n// Returns first 2 digits after first non-zero decimal\n// i.e. 0.001286 -> 0.0012, 0.9845 -> 0.98, 0.0102 -> 0.010, etc\n// Intended to be used for tokens whose value is less than $1\n// https://stackoverflow.com/a/23887837\nexport const getFirstThreeNonZeroDecimals = (value: number) => {\n return value.toFixed(9).match(/^-?\\d*\\.?0*\\d{0,2}/)[0]\n}\n\nexport type formatAmountNotation = 'compact' | 'standard'\n\n/**\n * This function is used to format token prices, liquidity, amount of tokens in TX, and in general any numbers on info section\n * @param amount - amount to be formatted\n * @param notation - whether to show 1M or 1,000,000\n * @param displayThreshold - threshold below which it will return simply returns <0.001 for 0.0005\n * @param tokenPrecision - set to true when you want precision to be 3 decimals for values < 1 and 2 decimals for values > 1\n * @param isInteger - if true the values will contain decimal part only if the amount is > 1000\n * @returns formatted string ready to be displayed\n */\nexport const formatAmount = (\n amount: number | undefined,\n options?: {\n notation?: formatAmountNotation\n displayThreshold?: number\n tokenPrecision?: boolean\n isInteger?: boolean\n },\n) => {\n const { notation = 'compact', displayThreshold, tokenPrecision, isInteger } = options || { notation: 'compact' }\n if (amount === 0) {\n if (isInteger) {\n return '0'\n }\n return '0.00'\n }\n if (!amount) return '-'\n if (displayThreshold && amount < displayThreshold) {\n return `<${displayThreshold}`\n }\n if (amount < 1 && !tokenPrecision) {\n return getFirstThreeNonZeroDecimals(amount)\n }\n\n let precision = 2\n if (tokenPrecision) {\n precision = amount < 1 ? 3 : 2\n }\n\n let format = `0.${'0'.repeat(precision)}a`\n\n if (notation === 'standard') {\n format = `0,0.${'0'.repeat(precision)}`\n }\n\n if (isInteger && amount < 1000) {\n format = '0'\n }\n\n const amountWithPrecision = parseFloat(amount.toFixed(precision))\n\n // toUpperCase is needed cause numeral doesn't have support for capital K M B out of the box\n return numeral(amountWithPrecision).format(format).toUpperCase()\n}\n","import { parseUnits } from '@ethersproject/units'\nimport { Currency, CurrencyAmount, JSBI, Token, TokenAmount } from '@pancakeswap/sdk'\n\n// try to parse a user entered amount for a given token\nconst tryParseAmount = (value?: string, currency?: Currency): CurrencyAmount | TokenAmount | undefined => {\n if (!value || !currency) {\n return undefined\n }\n try {\n const typedValueParsed = parseUnits(value, currency.decimals).toString()\n\n if (typedValueParsed !== '0') {\n return currency instanceof Token\n ? new TokenAmount(currency, JSBI.BigInt(typedValueParsed))\n : CurrencyAmount.ether(JSBI.BigInt(typedValueParsed))\n }\n } catch (error) {\n // should fail if the user specifies too many decimal places of precision (or maybe exceed max uint?)\n console.debug(`Failed to parse input amount: \"${value}\"`, error)\n }\n // necessary for all paths to return a value\n return undefined\n}\n\nexport default tryParseAmount\n","/* eslint-disable no-case-declarations */\n/**\n * Given a URI that may be ipfs, ipns, http, or https protocol, return the fetch-able http(s) URLs for the same content\n * @param uri to convert to fetch-able http url\n */\nexport default function uriToHttp(uri: string): string[] {\n const protocol = uri.split(':')[0].toLowerCase()\n switch (protocol) {\n case 'https':\n return [uri]\n case 'http':\n return [`https${uri.substring(4)}`, uri]\n case 'ipfs':\n const hash = uri.match(/^ipfs:(\\/\\/)?(.*)$/i)?.[2]\n return [`https://cloudflare-ipfs.com/ipfs/${hash}/`, `https://ipfs.io/ipfs/${hash}/`]\n case 'ipns':\n const name = uri.match(/^ipns:(\\/\\/)?(.*)$/i)?.[2]\n return [`https://cloudflare-ipfs.com/ipns/${name}/`, `https://ipfs.io/ipns/${name}/`]\n default:\n return []\n }\n}\n","import styled from 'styled-components'\nimport { Box, Flex } from '@pancakeswap/uikit'\nimport Footer from 'components/Menu/Footer'\nimport { PageMeta } from 'components/Layout/Page'\nimport { EXCHANGE_DOCS_URLS } from 'config/constants'\n\nconst StyledPage = styled.div<{ $removePadding: boolean; $noMinHeight }>`\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n padding: ${({ $removePadding }) => ($removePadding ? '0' : '16px')};\n padding-bottom: 0;\n min-height: ${({ $noMinHeight }) => ($noMinHeight ? 'initial' : 'calc(100vh - 64px)')};\n\n\n ${({ theme }) => theme.mediaQueries.xs} {\n background-size: auto;\n }\n\n ${({ theme }) => theme.mediaQueries.sm} {\n padding: ${({ $removePadding }) => ($removePadding ? '0' : '24px')};\n padding-bottom: 0;\n }\n\n ${({ theme }) => theme.mediaQueries.lg} {\n padding: ${({ $removePadding }) => ($removePadding ? '0' : '80px')};\n padding-bottom: 0;\n min-height: ${({ $noMinHeight }) => ($noMinHeight ? 'initial' : 'calc(100vh - 100px)')};\n }\n`\n\nconst Page: React.FC<\n React.HTMLAttributes & {\n removePadding?: boolean\n hideFooterOnDesktop?: boolean\n noMinHeight?: boolean\n helpUrl?: string\n }\n> = ({\n children,\n removePadding = false,\n hideFooterOnDesktop = false,\n noMinHeight = false,\n helpUrl = EXCHANGE_DOCS_URLS,\n ...props\n}) => {\n return (\n <>\n \n \n {children}\n \n \n \n )\n}\n\nexport default Page\n","// ETH Address\nconst BNB_ADDRESS = '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c'\n\nexport { BNB_ADDRESS }\n","import { BNB_ADDRESS } from './constants'\n\nconst MIN_VALUE_DISPLAYED = 0.001\n\nexport const getTimeWindowChange = (lineChartData) => {\n if (lineChartData.length > 0) {\n const firstValue = lineChartData.find(({ value }) => !!value && value > 0)?.value ?? 0\n const lastValue = lineChartData[lineChartData.length - 1].value\n const changeValue = lastValue - firstValue\n\n return {\n changeValue:\n changeValue > 0 ? Math.max(changeValue, MIN_VALUE_DISPLAYED) : Math.min(changeValue, MIN_VALUE_DISPLAYED * -1),\n changePercentage: ((changeValue / firstValue) * 100).toFixed(2),\n }\n }\n\n return {\n changeValue: 0,\n changePercentage: 0,\n }\n}\n\nexport const getTokenAddress = (tokenAddress: undefined | string) => {\n if (!tokenAddress) {\n return ''\n }\n const lowerCaseAddress = tokenAddress.toLowerCase()\n if (lowerCaseAddress === 'bnb') {\n return BNB_ADDRESS\n }\n\n return lowerCaseAddress\n}\n"],"names":["_templateObject","data","_tagged_template_literal","_templateObject1","_templateObject2","_templateObject3","PromotedGradient","keyframes","StyledCard","styled","componentId","param","theme","radii","card","isDisabled","colors","isActive","css","space","StyledCardInner","Box","withConfig","hasCustomBorder","background","defaultProps","isSuccess","isWarning","_param","ribbon","children","props","_object_without_properties","_jsx","_object_spread_props","_object_spread","_jsxs","borderBackground","Link","external","OpenNewIcon","color","ml","Svg","viewBox","href","width","d","TransactionState","primary","IconWrapper","pending","success","failure","Transaction","tx","useNetwork","chain","chainId","getChainId","summary","receipt","status","LinkExternal","getBscScanLink","hash","CircleLoader","CheckmarkIcon","CloseIcon","renderTransactions","transactions","Flex","flexDirection","map","addedTime","onDismiss","address","useAccount","dispatch","useAppDispatch","allTransactions","useAllTransactions","useTranslation","t","sortedRecentTransactions","orderBy","Object","values","filter","isTransactionRecent","confirmed","clearAllTransactionsCallback","useCallback","clearAllTransactions","Modal","title","headerBackground","account","ModalBody","length","AutoRow","mb","style","justifyContent","Text","Button","variant","scale","onClick","ConnectWalletButton","onPresentTransactionsModal","useModal","TransactionsModal","IconButton","HistoryIcon","AppHeaderContainer","cardBorder","subtitle","helper","backTo","noConfig","expertMode","useExpertModeManager","alignItems","gap","passHref","as","ArrowBackIcon","Heading","NotificationDot","show","GlobalSettings","mode","SettingsMode","Transactions","QuestionHelper","text","mr","placement","fontSize","BodyWrapper","Card","AppBody","padding","border","borderRadius","LightCard","backgroundAlt","LightCardA","LightGreyCard","GreyCard","inputSecondary","textDisabled","Column","ColumnCenter","AutoColumn","justify","Row","align","RowBetween","RowFixed","rotate","StyledSVG","size","stroke","rest","fill","xmlns","path","strokeWidth","strokeLinecap","strokeLinejoin","StyledLogo","Logo","CurrencyLogo","currency","uriLocations","useHttpLocations","WrappedTokenInfo","logoURI","undefined","srcs","useMemo","ETHER","Token","getTokenLogoURL","BinanceIcon","alt","symbol","Wrapper","margin","DoubleCurrencyLogo","currency0","currency1","toString","marginRight","StyledListLogo","ListLogo","WEEKS_IN_YEAR","TOTAL_FEE","LP_HOLDERS_FEE","TREASURY_FEE","BUYBACK_FEE","ONE_DAY_UNIX","ONE_HOUR_SECONDS","isTradeBetter","tradeA","tradeB","minimumDelta","ZERO_PERCENT","tradeType","currencyEquals","inputAmount","outputAmount","Error","equalTo","executionPrice","lessThan","raw","multiply","add","ONE_HUNDRED_PERCENT","useAllCommonPairs","currencyA","currencyB","wrappedCurrency","tokenA","tokenB","bases","ADDITIONAL_BASES","BASES_TO_CHECK_TRADES_AGAINST","common","additionalA","additionalB","basePairs","flatMap","base","otherBase","allPairCombinations","tokens","Boolean","t0","t1","tokenA_","tokenB_","customBases","CUSTOM_BASES","customBasesA","customBasesB","find","equals","allPairs","usePairs","result","PairState","reduce","memo","curr","liquidityToken","useTradeExactIn","currencyAmountIn","currencyOut","allowedPairs","singleHopOnly","useUserSingleHopOnly","Trade","maxHops","maxNumResults","bestTradeSoFar","i","currentTrade","BETTER_TRADE_LESS_HOPS_THRESHOLD","useTradeExactOut","currencyIn","currencyAmountOut","useIsTransactionUnsupported","unsupportedTokens","useUnsupportedTokens","tokenIn","tokenOut","keys","includes","useIsTransactionWarning","useWarningTokens","uri","uriToHttp","getGQLHeaders","endpoint","INFO_CLIENT","process","env","NEXT_PUBLIC_SF_HEADER","window","sfHeader","infoClient","GraphQLClient","headers","SF_HEADER","timeout","BIT_QUERY_HEADER","graphQLClient","request","variables","Promise","race","_","reject","setTimeout","multiQuery","queryConstructor","subqueries","skipCount","fetchedData","allFound","skip","client","end","subqueriesSlice","error","slice","requestWithTimeout","console","getBlockSubqueries","timestamps","timestamp","blocksQueryConstructor","gql","getBlocksFromTimestamps","sortDirection","blocks","key","BLOCKS_CLIENT","push","split","number","parseInt","block","getAmountChange","valueNow","valueBefore","getChangeForPeriod","valueOnePeriodAgo","valueTwoPeriodsAgo","currentPeriodAmount","percentageChange","getPercentChange","token1","token2","ChainId","token1AsTokenInstance","token2AsTokenInstance","String","checksummedToken1Address","isAddress","checksummedToken2Address","Pair","timeWindowIdsCountMapping","PairDataTimeWindowEnum","timeWindowGapMapping","getPairSequentialId","id","pairId","replace","getIdsByTimeWindow","pairAddress","pairLastId","timeWindow","idsCount","pairLastIdAsNumber","Number","times","value","fetchPairPriceData","lastPairHourIdData","lastId","pairHourId","pairHourIds","lastPairDayIdData","pairDayIds","pairHourDatas","first","lastPairHourId","pairHourDatasByIds","pairIds","pairDayDatas","lastPairDayId","pairDayDatasByIdsQuery","getDerivedPrices","tokenAddress","getDerivedPricesQueryConstructor","getTokenDerivedBnbPrices","prices","tokenPrices","forEach","priceKey","derivedBNB","parseFloat","tokenPrice","getSkipDaysToStart","fetchDerivedPriceData","token0Address","token1Address","interval","endTimestamp","startTimestamp","time","token0DerivedBnb","token1DerivedBnb","getInterval","getUnixTime","Date","startOfHour","sub","days","all","POOL_AT_BLOCK","pools","blockString","addressesString","join","fetchPoolData","block24h","block48h","block7d","block14d","poolAddresses","query","parsePoolData","pairs","accum","poolData","volumeUSD","reserveUSD","reserve0","reserve1","token0Price","token1Price","useSwapState","useSelector","state","swap","BAD_RECIPIENT_ADDRESSES","involvesAddress","trade","checksummedAddress","route","some","token","pair","useSingleTokenSwapInfo","inputCurrencyId","inputCurrency","outputCurrencyId","outputCurrency","bestTradeExactIn","getTokenAddress","parsedAmount","tryParseAmount","inputTokenPrice","toSignificant","outputTokenPrice","useDerivedSwapInfo","independentField","typedValue","recipient","isExactIn","inputError","to","relevantTokenBalances","useCurrencyBalances","Field","bestTradeExactOut","v2Trade","currencyBalances","currencies","formattedTo","indexOf","allowedSlippage","useUserSlippageTolerance","slippageAdjustedAmounts","computeSlippageAdjustedAmounts","balanceIn","amountIn","parseCurrencyFromURLParameter","urlParam","valid","toUpperCase","ADDRESS_REGEX","queryParametersToSwapState","parsedQs","currentchainId","DEFAULT_INPUT_CURRENCY","DEFAULT_OUTPUT_CURRENCY","test","validatedRecipient","currencyId","exactAmount","isNaN","toLowerCase","parseIndependentFieldURLParameter","exactField","pairDataById","derivedPairDataById","useDefaultsFromURLSearch","useRouter","useState","setResult","useEffect","parsed","replaceSwapState","field","useFetchPairPrices","currentSwapPrice","setPairId","isLoading","setIsLoading","pairData","get","pairByDataIdSelector","derivedPairData","derivedPairByDataIdSelector","useDispatch","fetchDerivedData","derivedData","normalizedDerivedData","info","acc","token0DerivedBnbEntry","token1DerivedBnbEntry","entry","token0Id","token1Id","token0DerivedBNB","token1DerivedBNB","updateDerivedPairData","fetchAndUpdatePairPrice","hasEnoughLiquidity","newPairData","amountOfDataPoints","totalLiquidity","fetchPairEntry","pairHasEnoughLiquidity","hourStartUnix","token0","date","normalizeChartData","updatePairData","getLpAddress","updatePairId","normalizedPairData","activeToken","pairPrice","fromUnixTime","reverse","normalizePairDataByActiveToken","normalizedDerivedPairData","normalizeDerivedPairDataByActiveToken","hasSwapPrice","normalizedPairDataWithCurrentSwapPrice","normalizedDerivedPairDataWithCurrentSwapPrice","hasNoDirectData","hasNoDerivedData","pairPrices","useLPApr","useSWRImmutable","timestampsArray","formattedPoolData","formattedPoolData24h","formattedPoolData48h","formattedPoolData7d","formattedPoolData14d","current","oneDay","twoDays","week","twoWeeks","volumeUSDWeek","liquidityUSD","lpApr7d","utcCurrentTime","startOfMinute","subDays","subWeeks","getDeltaTimestamps","now","oneDayAgo","twoDaysAgo","oneWeekAgo","twoWeeksAgo","totalFees24h","totalFees7d","lpFees24h","lpFees7d","Infinity","getLpFeesAndApr","refreshInterval","SLOW_INTERVAL","DAY","WEEK","MONTH","YEAR","useTransactionAdder","response","approval","claim","type","order","addTransaction","from","s","getTime","useHasPendingApproval","spender","useTokenBalancesWithLoadingIndicator","validatedTokens","validatedTokenAddresses","vt","balances","useMultipleContractSingleData","ERC20_INTERFACE","anyLoading","callState","loading","amount","JSBI","TokenAmount","useTokenBalances","useTokenBalance","tokenBalances","containsBNB","bnbBalance","uncheckedAddresses","multicallContract","useMulticallContract","addresses","a","results","useSingleContractMultipleData","CurrencyAmount","useBNBBalances","useCurrencyBalance","useAllTokenBalances","allTokens","useAllTokens","calculateSlippageAmount","slippage","BIPS_BASE","getRouterContract","library","getContract","ROUTER_ADDRESS","IPancakeRouter02ABI","getProviderOrSigner","computeTradePriceBreakdown","realizedLPFee","currentFee","INPUT_FRACTION_AFTER_FEE","priceImpactWithoutFeeFraction","priceImpact","subtract","priceImpactWithoutFee","Percent","numerator","denominator","quotient","num","pct","maximumAmountIn","minimumAmountOut","warningSeverity","BLOCKED_PRICE_IMPACT_NON_EXPERT","ALLOWED_PRICE_IMPACT_HIGH","ALLOWED_PRICE_IMPACT_MEDIUM","ALLOWED_PRICE_IMPACT_LOW","formatExecutionPrice","inverted","invert","formatAmount","options","notation","displayThreshold","tokenPrecision","isInteger","toFixed","match","precision","format","repeat","amountWithPrecision","numeral","typedValueParsed","parseUnits","decimals","debug","substring","name","StyledPage","$removePadding","$noMinHeight","mediaQueries","xs","sm","lg","removePadding","hideFooterOnDesktop","noMinHeight","helpUrl","EXCHANGE_DOCS_URLS","PageMeta","flexGrow","BNB_ADDRESS","getTimeWindowChange","lineChartData","firstValue","changeValue","Math","max","min","MIN_VALUE_DISPLAYED","changePercentage","lowerCaseAddress"],"sourceRoot":""}