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d,CAAEA,MAAAA,CAAAA,CAAO,CAAAC,SAAKD,EAAME,MAAM,CAACC,MAAM,CAACC,IAAI,CAACC,EAAE,GAGxC8B,EAAoBxC,EAAAA,EAAAA,CAAAA,GAAAA,CAAAA,UAAU,qCAGrB,GAAeK,IAAd,CAAEA,MAAAA,CAAAA,CAAO,CAAAC,SAAKD,EAAME,MAAM,CAACC,MAAM,CAACe,IAAI,CAACU,KAAK,GAIpCjC,EAAAA,EAAAA,CAAAA,GAAAA,CAAAA,UAAU,qCAQjB,GAAeK,IAAd,CAAEA,MAAAA,CAAAA,CAAO,CAAAC,SAAKD,EAAME,MAAM,CAACC,MAAM,CAACe,IAAI,CAACU,KAAK,GAI9D,IAAMQ,EAAWzC,CAAAA,EAAAA,EAAAA,EAAAA,EAAO0C,EAAAA,GAAYA,EAAAA,UAAAA,CAAAA,oCAEhC,GAAerC,IAAd,CAAEA,MAAAA,CAAAA,CAAO,CAAAC,SAAKD,EAAME,MAAM,CAACC,MAAM,CAACC,IAAI,CAACgB,EAAE,GAIxCkB,EAAU3C,EAAAA,EAAAA,CAAAA,GAAAA,CAAAA,UAAU,qCACrB,GAAgB4C,IAAf,CAAEA,OAAAA,CAAAA,CAAQ,CAAAtC,SAAKsC,CAAK,EACtB,GAAeC,IAAd,CAAEA,MAAAA,CAAAA,CAAO,CAAAvC,SAAKuC,CAAI,EAIrB,GAAexC,IAAd,CAAEA,MAAAA,CAAAA,CAAO,CAAAC,SAAKD,EAAMO,OAAO,CAACS,EAAE,GAG3ByB,EAAS9C,CAAAA,EAAAA,EAAAA,EAAAA,EAAO+C,EAAAA,EAAAA,CAAAA,eAA6B,EAAAC,UAAA","sources":["webpack://_N_E/./utils/calculator/data.ts","webpack://_N_E/./utils/calculator/helper.ts","webpack://_N_E/./utils/calculator/math.ts","webpack://_N_E/./views/style.ts","webpack://_N_E/<anon>"],"sourcesContent":["import { priceToTick } from \"@/helper/positionHelper\";\nimport {\n ISubgraphToken,\n Pool,\n Position,\n Tick,\n} from \"@/interfaces/calculator/uniswap.interface\";\nimport {\n ApertureSupportedChainId,\n getLogger,\n viem,\n} from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport {\n Pool as SDKPool,\n Position as SDKPosition,\n} from \"@aperture_finance/uniswap-v3-sdk\";\nimport { Token as SDKToken } from \"@uniswap/sdk-core\";\nimport axios from \"axios\";\nimport Big from \"big.js\";\nimport BigNumber from \"bignumber.js\";\nimport { getUniqueItems, sortTokens } from \"./helper\";\nimport {\n averageArray,\n getLiquidityDelta,\n getTokensAmountFromDepositAmountUSD,\n} from \"./math\";\n\nconst _querySupgraph = async (\n subgraphEndpoint: string,\n query: string\n): Promise<any> => {\n const { data } = await axios({\n url: subgraphEndpoint,\n method: \"post\",\n data: {\n query,\n },\n });\n\n const errors = data.errors;\n if (errors && errors.length > 0) {\n throw new Error(`Uniswap Subgraph Errors: ${JSON.stringify(errors)}`);\n }\n\n return data.data;\n};\n\nexport const getPoolVolumes = async (\n subgraphEndpoint: string,\n poolAddress: string,\n numberOfDays: number = 30\n) => {\n const { poolDayDatas } = await _querySupgraph(\n subgraphEndpoint,\n `{\n poolDayDatas(skip: 1, first: ${numberOfDays}, orderBy: date, orderDirection: desc, where:{pool: \"${poolAddress}\"}) {\n volumeUSD\n }\n }`\n );\n\n return poolDayDatas;\n};\n\nexport const getPositionBreakdown = async (\n networkId: ApertureSupportedChainId,\n mockPool: SDKPool,\n priceAssumptionValue: number,\n priceRangeMinValue: number,\n priceRangeMaxValue: number,\n token0CurrentPrice: number,\n token1CurrentPrice: number,\n depositAmount: string,\n token0: ISubgraphToken,\n token1: ISubgraphToken\n) => {\n const positionBreakdown = [];\n const { amount0, amount1 } = getTokensAmountFromDepositAmountUSD(\n priceAssumptionValue,\n priceRangeMinValue,\n priceRangeMaxValue,\n token1CurrentPrice,\n token0CurrentPrice,\n Number(depositAmount)\n );\n const deltaL = getLiquidityDelta(\n priceAssumptionValue,\n priceRangeMinValue,\n priceRangeMaxValue,\n amount0,\n amount1,\n Number(token0?.decimals || 18),\n Number(token1?.decimals || 18)\n );\n const tokenA = new SDKToken(\n networkId,\n mockPool.token0.address,\n mockPool.token0.decimals\n );\n const tokenB = new SDKToken(\n networkId,\n mockPool.token1.address,\n mockPool.token1.decimals\n );\n const tickLower = priceToTick(\n tokenA,\n tokenB,\n new BigNumber(priceRangeMinValue).toFixed(),\n mockPool.tickSpacing,\n true\n );\n const tickUpper = priceToTick(\n tokenA,\n tokenB,\n new BigNumber(priceRangeMaxValue).toFixed(),\n mockPool.tickSpacing,\n true\n );\n if (tickLower === tickUpper) return [];\n const mockPosition = new SDKPosition({\n pool: mockPool,\n liquidity: deltaL.toFixed(0),\n tickLower: Math.min(tickLower, tickUpper),\n tickUpper: Math.max(tickLower, tickUpper),\n });\n\n const multiplier = 2; // Max price for breakdown is priceAssumptionValue * 2\n const splits = 200; // Fetch price breakdown for 200 times\n const denominator = splits / multiplier;\n const decimals = Math.pow(\n 10,\n mockPool.token1.decimals - mockPool.token0.decimals\n );\n for (let count = 1; count <= splits; count++) {\n try {\n const mockPrice = viem.getPositionAtPrice(\n mockPosition,\n new Big((priceAssumptionValue * decimals * count) / denominator)\n );\n positionBreakdown.push({\n price: (priceAssumptionValue * count) / denominator,\n token0Amount: Number(mockPrice.amount0.toExact()),\n token1Amount: Number(mockPrice.amount1.toExact()),\n });\n } catch (error) {\n console.log(error);\n getLogger().error(`Failed to getPositionAtPrice:`, error as Error);\n }\n }\n return positionBreakdown;\n};\n\nexport const getAvgTradingVolume = async (\n subgraphEndpoint: string,\n poolAddress: string,\n numberOfDays: number = 7\n): Promise<number> => {\n const poolDayDatas = await getPoolVolumes(\n subgraphEndpoint,\n poolAddress,\n numberOfDays\n );\n\n const volumes = poolDayDatas.map((d: { volumeUSD: string }) =>\n Number(d.volumeUSD)\n );\n return averageArray(volumes);\n};\n\nconst _getPoolTicksByPage = async (\n subgraphEndpoint: string,\n poolAddress: string,\n page: number\n): Promise<Tick[]> => {\n try {\n const res = await _querySupgraph(\n subgraphEndpoint,\n `{\n ticks(first: 1000, skip: ${\n page * 1000\n }, where: { poolAddress: \"${poolAddress}\" }, orderBy: tickIdx) {\n tickIdx\n liquidityNet\n price0\n price1\n }\n }`\n );\n return res.ticks;\n } catch (e) {\n getLogger().warn(\"Failed to get pool ticks\", {\n error: (e as Error).message,\n });\n return [];\n }\n};\nexport const getPoolTicks = async (\n subgraphEndpoint: string,\n poolAddress: string\n): Promise<Tick[]> => {\n const PAGE_SIZE = 3;\n let result: Tick[] = [];\n let page = 0;\n while (true) {\n const [pool1, pool2, pool3] = await Promise.all([\n _getPoolTicksByPage(subgraphEndpoint, poolAddress, page),\n _getPoolTicksByPage(subgraphEndpoint, poolAddress, page + 1),\n _getPoolTicksByPage(subgraphEndpoint, poolAddress, page + 2),\n ]);\n\n result = [...result, ...pool1, ...pool2, ...pool3];\n if (pool1.length === 0 || pool2.length === 0 || pool3.length === 0) {\n break;\n }\n page += PAGE_SIZE;\n }\n return result;\n};\n\n// TODO\nconst _processTokenInfo = (token: ISubgraphToken) => {\n // token.logoURI = getTokenLogoURL(getCurrentNetwork().id, token.id);\n // // TODO: check the network id before replace the token name\n\n // if (token.name === \"Wrapped Ether\" || token.name === \"Wrapped Ethereum\") {\n // token.name = \"Ethereum\";\n // token.symbol = \"ETH\";\n // token.logoURI =\n // \"https://cdn.iconscout.com/icon/free/png-128/ethereum-2752194-2285011.png\";\n // }\n // if (token.name === \"Wrapped Matic\") {\n // token.name = \"Polygon Native Token\";\n // token.symbol = \"MATIC\";\n // }\n // if (token.name === \"Wrapped BNB\") {\n // token.name = \"BSC Native Token\";\n // token.symbol = \"BNB\";\n // }\n\n return token;\n};\n\nexport const getTopTokenList = async (\n subgraphEndpoint: string\n): Promise<ISubgraphToken[]> => {\n const res = await _querySupgraph(\n subgraphEndpoint,\n `{\n tokens(skip: 0, first: 500, orderBy: volumeUSD, orderDirection: desc) {\n id\n name\n symbol\n volumeUSD\n decimals\n }\n }`\n );\n\n if (res === undefined || res.tokens.length === 0) {\n return [];\n }\n\n const tokens = res.tokens as ISubgraphToken[];\n let result = tokens\n .map(_processTokenInfo)\n .filter((token) => token.symbol.length < 30);\n\n return result;\n};\n\nexport const getToken = async (\n subgraphEndpoint: string,\n tokenAddress: string\n): Promise<ISubgraphToken> => {\n const res = await _querySupgraph(\n subgraphEndpoint,\n `{\n token(id: \"${tokenAddress.toLowerCase()}\") {\n id\n name\n symbol\n volumeUSD\n decimals\n }\n }`\n );\n\n if (res.token !== null) {\n res.token = _processTokenInfo(res.token);\n }\n\n return res.token;\n};\n\nexport const getPoolFromPair = async (\n subgraphEndpoint: string,\n token0: ISubgraphToken,\n token1: ISubgraphToken,\n disabledTopPositions?: boolean\n): Promise<Pool[]> => {\n const sortedTokens = sortTokens(token0, token1);\n\n let feeGrowthGlobal = `feeGrowthGlobal0X128\\nfeeGrowthGlobal1X128`;\n if (disabledTopPositions) {\n feeGrowthGlobal = \"\";\n }\n\n const { pools } = await _querySupgraph(\n subgraphEndpoint,\n `{\n pools(orderBy: feeTier, where: {\n token0: \"${sortedTokens[0].id}\",\n token1: \"${sortedTokens[1].id}\"}) {\n id\n tick\n sqrtPrice\n feeTier\n liquidity\n token0Price\n token1Price\n ${feeGrowthGlobal}\n }\n }`\n );\n\n return pools as Pool[];\n};\n\nexport const getCurrentTick = async (\n subgraphEndpoint: string,\n poolId: string\n): Promise<string> => {\n const { pool } = await _querySupgraph(\n subgraphEndpoint,\n `{\n pool(id: \"${poolId}\") {\n tick\n }\n }`\n );\n return pool.tick;\n};\n\nconst _getPoolPositionsByPage = async (\n subgraphEndpoint: string,\n poolAddress: string,\n page: number\n): Promise<Position[]> => {\n try {\n const res = await _querySupgraph(\n subgraphEndpoint,\n `{\n positions(where: {\n pool: \"${poolAddress}\",\n liquidity_gt: 0,\n }, first: 1000, skip: ${page * 1000}) {\n id\n owner\n pool {\n id\n liquidity\n feesUSD\n feeTier\n tick\n sqrtPrice\n token0Price\n token1Price\n feeGrowthGlobal0X128\n feeGrowthGlobal1X128\n totalValueLockedUSD\n token0 {\n id\n name\n symbol\n derivedETH\n decimals\n }\n token1 {\n id\n name\n symbol\n derivedETH\n decimals\n }\n }\n tickLower {\n tickIdx\n feeGrowthOutside0X128\n feeGrowthOutside1X128\n }\n tickUpper {\n tickIdx\n feeGrowthOutside0X128\n feeGrowthOutside1X128\n }\n depositedToken0\n depositedToken1\n liquidity\n collectedFeesToken0\n collectedFeesToken1\n feeGrowthInside0LastX128\n feeGrowthInside1LastX128\n transaction {\n timestamp\n }\n }\n }`\n );\n\n return res.positions;\n } catch (e) {\n return [];\n }\n};\n\nexport const getPoolPositions = async (\n subgraphEndpoint: string,\n poolAddress: string\n): Promise<Position[]> => {\n const PAGE_SIZE = 3;\n let result: Position[] = [];\n let page = 0;\n while (true) {\n const [p1, p2, p3] = await Promise.all([\n _getPoolPositionsByPage(subgraphEndpoint, poolAddress, page),\n _getPoolPositionsByPage(subgraphEndpoint, poolAddress, page + 1),\n _getPoolPositionsByPage(subgraphEndpoint, poolAddress, page + 2),\n ]);\n\n result = [...result, ...p1, ...p2, ...p3];\n if (p1.length === 0 || p2.length === 0 || p3.length === 0) {\n break;\n }\n page += PAGE_SIZE;\n }\n return result;\n};\n\nconst getBulkTokens = async (\n subgraphEndpoint: string,\n tokenAddresses: string[]\n): Promise<ISubgraphToken[]> => {\n const res = await _querySupgraph(\n subgraphEndpoint,\n `{\n tokens(where: {id_in: [${tokenAddresses\n .map((id) => `\"${id}\"`)\n .join(\",\")}]}) {\n id\n name\n symbol\n volumeUSD\n decimals\n totalValueLockedUSD\n tokenDayData(first: 1, orderBy: date, orderDirection: desc) {\n priceUSD\n }\n }\n }`\n );\n\n if (res.tokens !== null) {\n res.tokens = res.tokens.map(_processTokenInfo);\n }\n\n return res.tokens;\n};\n\nexport const getPools = async (\n subgraphEndpoint: string,\n totalValueLockedUSD_gte: number,\n volumeUSD_gte: number\n): Promise<{\n pools: Pool[];\n tokens: ISubgraphToken[];\n}> => {\n try {\n const res = await _querySupgraph(\n subgraphEndpoint,\n `{\n pools (first: 300, orderBy: totalValueLockedUSD, orderDirection: desc, where: {liquidity_gt: 0, totalValueLockedUSD_gte: ${totalValueLockedUSD_gte}, volumeUSD_gte: ${volumeUSD_gte}}) {\n id\n token0 {\n id\n }\n token1 {\n id\n }\n feeTier\n liquidity\n tick\n totalValueLockedUSD\n poolDayData(first: 90, skip: 1, orderBy: date, orderDirection: desc) {\n date\n volumeUSD\n open \n high\n low\n close\n }\n }\n }`\n );\n\n if (res === undefined || res.pools.length === 0) {\n return { pools: [], tokens: [] };\n }\n\n const tokenIds = getUniqueItems(\n res.pools.reduce(\n (acc: string[], p: Pool) => [...acc, p.token0.id, p.token1.id],\n []\n )\n );\n const queryPage = Math.ceil(tokenIds.length / 100);\n // batch query getBulkTokens function by page using Promise.all\n const tokens = await Promise.all(\n Array.from({ length: queryPage }, (_, i) => {\n const start = i * 100;\n const end = start + 100;\n return getBulkTokens(subgraphEndpoint, tokenIds.slice(start, end));\n })\n ).then((res) => res.flat());\n // sort token by volume\n tokens.sort((a, b) => Number(b.volumeUSD) - Number(a.volumeUSD));\n // map poolCount\n const poolCountByTokenHash = res.pools.reduce((acc: any, p: Pool) => {\n acc[p.token0.id] = (acc[p.token0.id] || 0) + 1;\n acc[p.token1.id] = (acc[p.token1.id] || 0) + 1;\n return acc;\n }, {});\n const _tokens = tokens.map((t: ISubgraphToken) => {\n return {\n ...t,\n poolCount: poolCountByTokenHash[t.id],\n };\n });\n // create hash of tokens id\n const tokenHash = _tokens.reduce((acc: any, t: ISubgraphToken) => {\n acc[t.id] = t;\n return acc;\n }, {});\n // map token0 and token1 to pool\n const pools = res.pools\n .map((p: Pool) => {\n return {\n ...p,\n token0: tokenHash[p.token0.id],\n token1: tokenHash[p.token1.id],\n };\n })\n // fix poolDayData incorrect data\n .map((p: Pool) => {\n const poolDayData = [];\n for (let i = 0; i < p.poolDayData.length - 1; ++i) {\n p.poolDayData[i].open = p.poolDayData[i + 1].close;\n poolDayData.push(p.poolDayData[i]);\n }\n p.poolDayData = poolDayData;\n return p;\n })\n // filter out if poolDayData < 14\n .filter((p: Pool) => p.poolDayData.length >= 14);\n\n return { pools, tokens };\n } catch (e) {\n return { pools: [], tokens: [] };\n }\n};\n","import { PriceChart } from \"@/interfaces/calculator/coingecko.interface\";\nimport {\n ISubgraphToken,\n Pool,\n} from \"@/interfaces/calculator/uniswap.interface\";\nimport {\n BasicInfo,\n CalculatorAmmInfo,\n Calculator_AMM,\n ChartToken,\n E_AMM,\n SupportedChainId,\n} from \"@aperture/uikitv2\";\nimport { ApertureSupportedChainId } from \"@aperture_finance/uniswap-v3-automation-sdk\";\nimport { Token } from \"@uniswap/sdk-core\";\nimport { getTickFromPrice } from \"./math\";\n\nexport const DEFAULT_AMM = E_AMM.Uniswap as Calculator_AMM;\nexport const isCalculatorAMM = (amm: BasicInfo) => {\n return !!CalculatorAmmInfo[amm.name];\n};\n\nexport const getFeeTierPercentage = (tier: string): number => {\n if (tier === \"100\") return 0.01 / 100;\n if (tier === \"500\") return 0.05 / 100;\n if (tier === \"3000\") return 0.3 / 100;\n if (tier === \"10000\") return 1 / 100;\n return 0;\n};\n\nexport const sortTokens = (\n token0: ISubgraphToken,\n token1: ISubgraphToken\n): ISubgraphToken[] => {\n if (token0.id < token1.id) {\n return [token0, token1];\n }\n return [token1, token0];\n};\n\n// return unique string in string[]\nexport const getUniqueItems = (arr: string[]): string[] => {\n return arr.filter((v, i, a) => a.indexOf(v) === i);\n};\n\nconst apiKey = \"f9ed9810e15cd166e224bf88fe4d5b61\";\n\nexport const SubgraphURLs: Record<\n Calculator_AMM,\n Partial<Record<SupportedChainId, string>>\n> = {\n [E_AMM.Uniswap]: {\n [SupportedChainId.ETHEREUM]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV`,\n [SupportedChainId.ARBITRUM]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/FbCGRftH4a3yZugY7TnbYgPJVEv2LvMT6oF1fxPe9aJM`, // still has some issues\n [SupportedChainId.OPTIMISM]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/Cghf4LfVqPiFw6fp6Y5X5Ubc8UpmUhSfJL82zwiBFLaj`,\n [SupportedChainId.POLYGON]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/3hCPRGf4z88VC5rsBKU5AA9FBBq5nF3jbKJG7VZCbhjm`,\n [SupportedChainId.BASE]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/43Hwfi3dJSoGpyas9VwNoDAv55yjgGrPpNSmbQZArzMG`,\n [SupportedChainId.BNB]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/G5MUbSBM7Nsrm9tH2tGQUiAF4SZDGf2qeo1xPLYjKr7K`,\n [SupportedChainId.AVALANCHE]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/GVH9h9KZ9CqheUEL93qMbq7QwgoBu32QXQDPR6bev4Eo`,\n [SupportedChainId.SCROLL]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/5ixVdGDt3MtSPZdzqE4TdhJuFBfQZPcmAkgTctt5eAZv`,\n },\n [E_AMM.PancakeSwap]: {\n [SupportedChainId.ETHEREUM]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/CJYGNhb7RvnhfBDjqpRnD3oxgyhibzc7fkAMa38YV3oS`,\n [SupportedChainId.BNB]: `https://gateway.thegraph.com/api/${apiKey}/subgraphs/id/A1fvJWQLBeUAggX2WQTMm3FKjXTekNXo77ZySun4YN2m`,\n },\n};\n\nexport const getDefaultPoolTicks = (\n token0: ISubgraphToken,\n token1: ISubgraphToken,\n selectedPool: Pool\n) => {\n const price0 = Number.MAX_SAFE_INTEGER;\n const price1 = 1 / Number.MAX_SAFE_INTEGER;\n const minTick = getTickFromPrice(price0, token0.decimals, token1.decimals);\n const maxTick = getTickFromPrice(price1, token0.decimals, token1.decimals);\n return [\n {\n tickIdx: String(minTick),\n price0: String(price0),\n price1: String(price1),\n liquidityNet: selectedPool.liquidity,\n },\n {\n tickIdx: String(maxTick),\n price0: String(price1),\n price1: String(price0),\n liquidityNet: \"-\" + selectedPool.liquidity,\n },\n ];\n};\n\ntype IVolumeTVL = {\n totalValueLockedUSD_gte: number;\n volumeUSD_gte: number;\n};\nexport const NetworkVolumeTVL: Partial<Record<SupportedChainId, IVolumeTVL>> = {\n [SupportedChainId.ETHEREUM]: {\n totalValueLockedUSD_gte: 1000000,\n volumeUSD_gte: 500000,\n },\n [SupportedChainId.POLYGON]: {\n totalValueLockedUSD_gte: 100000,\n volumeUSD_gte: 50000,\n },\n [SupportedChainId.OPTIMISM]: {\n totalValueLockedUSD_gte: 1000000,\n volumeUSD_gte: 500000,\n },\n [SupportedChainId.ARBITRUM]: {\n totalValueLockedUSD_gte: 0,\n volumeUSD_gte: 0,\n },\n [SupportedChainId.BNB]: {\n totalValueLockedUSD_gte: 100000,\n volumeUSD_gte: 50000,\n },\n};\nexport const DefaultVolumeTVL: IVolumeTVL = {\n totalValueLockedUSD_gte: 100000,\n volumeUSD_gte: 50000,\n};\n\nexport const getTokenFromSubgraphToken = (\n token: ISubgraphToken,\n networkId: ApertureSupportedChainId\n) => {\n const _token = new Token(networkId, token.id, Number(token.decimals));\n return _token;\n};\n\nexport const convertToChartToken = (\n token: ISubgraphToken,\n priceChart: PriceChart\n): ChartToken => {\n return {\n ticker: token.symbol,\n decimals: Number(token.decimals),\n price: priceChart.currentPriceUSD.toFixed(2),\n };\n};\n","import {\n ISubgraphToken,\n Pool,\n Position,\n Tick,\n} from \"@/interfaces/calculator/uniswap.interface\";\nimport bn from \"bignumber.js\";\nimport { getFeeTierPercentage } from \"./helper\";\n\nbn.config({ EXPONENTIAL_AT: 999999, DECIMAL_PLACES: 40 });\n\nconst Q96 = new bn(2).pow(96);\nconst Q128 = new bn(2).pow(128);\nconst ZERO = new bn(0);\n\n// Ref: https://ethereum.stackexchange.com/a/144704\nexport const calculatePositionFees = (\n pool: Pool,\n position: Position,\n token0: ISubgraphToken | null,\n token1: ISubgraphToken | null\n) => {\n const tickCurrent = Number(pool.tick);\n const tickLower = Number(position.tickLower.tickIdx);\n const tickUpper = Number(position.tickUpper.tickIdx);\n const liquidity = new bn(position.liquidity);\n\n // Check out the relevant formulas below which are from Uniswap Whitepaper Section 6.3 and 6.4\n // ð‘“ð‘Ÿ =ð‘“ð‘”−ð‘“ð‘(ð‘–ð‘™)−ð‘“ð‘Ž(ð‘–ð‘¢)\n // ð‘“ð‘¢ =ð‘™Â·(ð‘“ð‘Ÿ(ð‘¡1)−ð‘“ð‘Ÿ(ð‘¡0))\n // Global fee growth per liquidity 'ð‘“ð‘”' for both token 0 and token 1\n let feeGrowthGlobal_0 = new bn(pool.feeGrowthGlobal0X128);\n let feeGrowthGlobal_1 = new bn(pool.feeGrowthGlobal1X128);\n\n // Fee growth outside 'ð‘“ð‘œ' of our lower tick for both token 0 and token 1\n let tickLowerFeeGrowthOutside_0 = new bn(\n position.tickLower.feeGrowthOutside0X128\n );\n let tickLowerFeeGrowthOutside_1 = new bn(\n position.tickLower.feeGrowthOutside1X128\n );\n\n // Fee growth outside 'ð‘“ð‘œ' of our upper tick for both token 0 and token 1\n let tickUpperFeeGrowthOutside_0 = new bn(\n position.tickUpper.feeGrowthOutside0X128\n );\n let tickUpperFeeGrowthOutside_1 = new bn(\n position.tickUpper.feeGrowthOutside1X128\n );\n\n // These are 'ð‘“ð‘(ð‘–ð‘™)' and 'ð‘“ð‘Ž(ð‘–ð‘¢)' from the formula\n // for both token 0 and token 1\n let tickLowerFeeGrowthBelow_0 = ZERO;\n let tickLowerFeeGrowthBelow_1 = ZERO;\n let tickUpperFeeGrowthAbove_0 = ZERO;\n let tickUpperFeeGrowthAbove_1 = ZERO;\n\n // These are the calculations for 'ð‘“b(ð‘–)' from the formula\n // for both token 0 and token 1\n if (tickCurrent >= tickLower) {\n tickLowerFeeGrowthBelow_0 = tickLowerFeeGrowthOutside_0;\n tickLowerFeeGrowthBelow_1 = tickLowerFeeGrowthOutside_1;\n } else {\n tickLowerFeeGrowthBelow_0 = feeGrowthGlobal_0.minus(\n tickLowerFeeGrowthOutside_0\n );\n tickLowerFeeGrowthBelow_1 = feeGrowthGlobal_1.minus(\n tickLowerFeeGrowthOutside_1\n );\n }\n\n // These are the calculations for 'ð‘“ð‘Ž(ð‘–)' from the formula\n // for both token 0 and token 1\n if (tickCurrent < tickUpper) {\n tickUpperFeeGrowthAbove_0 = tickUpperFeeGrowthOutside_0;\n tickUpperFeeGrowthAbove_1 = tickUpperFeeGrowthOutside_1;\n } else {\n tickUpperFeeGrowthAbove_0 = feeGrowthGlobal_0.minus(\n tickUpperFeeGrowthOutside_0\n );\n tickUpperFeeGrowthAbove_1 = feeGrowthGlobal_1.minus(\n tickUpperFeeGrowthOutside_1\n );\n }\n\n // Calculations for 'ð‘“ð‘Ÿ(ð‘¡1)' part of the 'ð‘“ð‘¢ =ð‘™Â·(ð‘“ð‘Ÿ(ð‘¡1)−ð‘“ð‘Ÿ(ð‘¡0))' formula\n // for both token 0 and token 1\n let fr_t1_0 = feeGrowthGlobal_0\n .minus(tickLowerFeeGrowthBelow_0)\n .minus(tickUpperFeeGrowthAbove_0);\n let fr_t1_1 = feeGrowthGlobal_1\n .minus(tickLowerFeeGrowthBelow_1)\n .minus(tickUpperFeeGrowthAbove_1);\n\n // 'ð‘“ð‘Ÿ(ð‘¡0)' part of the 'ð‘“ð‘¢ =ð‘™Â·(ð‘“ð‘Ÿ(ð‘¡1)−ð‘“ð‘Ÿ(ð‘¡0))' formula\n // for both token 0 and token 1\n let feeGrowthInsideLast_0 = new bn(position.feeGrowthInside0LastX128);\n let feeGrowthInsideLast_1 = new bn(position.feeGrowthInside1LastX128);\n\n // The final calculations for the 'ð‘“ð‘¢ =ð‘™Â·(ð‘“ð‘Ÿ(ð‘¡1)−ð‘“ð‘Ÿ(ð‘¡0))' uncollected fees formula\n // for both token 0 and token 1 since we now know everything that is needed to compute it\n let uncollectedFees_0 = mulDiv(\n liquidity,\n fr_t1_0.minus(feeGrowthInsideLast_0),\n Q128\n );\n let uncollectedFees_1 = mulDiv(\n liquidity,\n fr_t1_1.minus(feeGrowthInsideLast_1),\n Q128\n );\n\n // Decimal adjustment to get final results\n let uncollectedFeesAdjusted_0 = uncollectedFees_0.div(\n expandDecimals(1, Number(token0?.decimals || 18)).toFixed(\n Number(token0?.decimals || 18)\n )\n );\n let uncollectedFeesAdjusted_1 = uncollectedFees_1.div(\n expandDecimals(1, Number(token1?.decimals || 18)).toFixed(\n Number(token1?.decimals || 18)\n )\n );\n\n return [\n uncollectedFeesAdjusted_0.toNumber(),\n uncollectedFeesAdjusted_1.toNumber(),\n ];\n};\n\nexport const getTickFromPrice = (\n price: number,\n token0Decimal: string | number,\n token1Decimal: string | number\n): number => {\n const token0 = expandDecimals(price, Number(token0Decimal));\n const token1 = expandDecimals(1, Number(token1Decimal));\n const sqrtPrice = encodeSqrtPriceX96(token1).div(encodeSqrtPriceX96(token0));\n\n return Math.log(sqrtPrice.toNumber()) / Math.log(Math.sqrt(1.0001));\n};\n\nexport const getPriceFromTick = (\n tick: number,\n token0Decimal: string,\n token1Decimal: string\n): number => {\n const sqrtPrice = new bn(Math.pow(Math.sqrt(1.0001), tick)).multipliedBy(\n new bn(2).pow(96)\n );\n const token0 = expandDecimals(1, Number(token0Decimal));\n const token1 = expandDecimals(1, Number(token1Decimal));\n const L2 = mulDiv(\n encodeSqrtPriceX96(token0),\n encodeSqrtPriceX96(token1),\n Q96\n );\n const price = mulDiv(L2, Q96, sqrtPrice)\n .div(new bn(2).pow(96))\n .div(new bn(10).pow(token0Decimal))\n .pow(2);\n\n return price.toNumber();\n};\n\n// Calculate the position tokens deposit ratio.\nexport const getPositionTokensDepositRatio = (\n P: number,\n Pl: number,\n Pu: number\n): number => {\n const deltaL = 1000; // can be any number\n\n let deltaY = deltaL * (Math.sqrt(P) - Math.sqrt(Pl));\n if (P < Pl) deltaY = 0;\n if (P >= Pu) deltaY = deltaL * (Math.sqrt(Pu) - Math.sqrt(Pl));\n\n let deltaX = deltaL * (1 / Math.sqrt(P) - 1 / Math.sqrt(Pu));\n if (P < Pl) deltaX = deltaL * (1 / Math.sqrt(Pl) - 1 / Math.sqrt(Pu));\n if (P >= Pu) deltaX = 0;\n\n return deltaY / deltaX;\n};\n\n// for calculation detail, please visit README.md (Section: Calculation Breakdown, No. 1)\ninterface TokensAmount {\n amount0: number;\n amount1: number;\n liquidityDelta: number;\n}\n\nexport const getTokensAmountFromDepositAmountUSD = (\n P: number,\n Pl: number,\n Pu: number,\n priceUSDX: number,\n priceUSDY: number,\n depositAmountUSD: number\n): TokensAmount => {\n let deltaL = 0;\n let deltaY = 0;\n let deltaX = 0;\n const sqrtP = Math.sqrt(P);\n const sqrtPl = Math.sqrt(Pl);\n const sqrtPu = Math.sqrt(Pu);\n\n // check division by 0\n const invSqrtP = sqrtP !== 0 ? 1 / sqrtP : 0;\n const invSqrtPu = sqrtPu !== 0 ? 1 / sqrtPu : 0;\n\n const denominator =\n (sqrtP - sqrtPl) * priceUSDY + (invSqrtP - invSqrtPu) * priceUSDX;\n if (denominator !== 0 && isFinite(denominator)) {\n deltaL = depositAmountUSD / denominator;\n }\n\n deltaY = deltaL * (sqrtP - sqrtPl);\n // Validate deltaY\n if (!isFinite(deltaY) || isNaN(deltaY) || deltaY * priceUSDY < 0) {\n deltaY = 0;\n } else if (deltaY * priceUSDY > depositAmountUSD) {\n deltaY = depositAmountUSD / priceUSDY;\n }\n\n deltaX = deltaL * (invSqrtP - invSqrtPu);\n // Validate deltaX\n if (!isFinite(deltaX) || isNaN(deltaX) || deltaX * priceUSDX < 0) {\n deltaX = 0;\n } else if (deltaX * priceUSDX > depositAmountUSD) {\n deltaX = depositAmountUSD / priceUSDX;\n }\n\n return { amount0: deltaX, amount1: deltaY, liquidityDelta: deltaL };\n};\n\n// for calculation detail, please visit README.md (Section: Calculation Breakdown, No. 2)\nconst getLiquidityForAmount0 = (\n sqrtRatioAX96: bn,\n sqrtRatioBX96: bn,\n amount0: bn\n): bn => {\n // amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower))\n const intermediate = mulDiv(sqrtRatioBX96, sqrtRatioAX96, Q96);\n return mulDiv(amount0, intermediate, sqrtRatioBX96.minus(sqrtRatioAX96));\n};\n\nconst getLiquidityForAmount1 = (\n sqrtRatioAX96: bn,\n sqrtRatioBX96: bn,\n amount1: bn\n): bn => {\n // amount1 / (sqrt(upper) - sqrt(lower))\n return mulDiv(amount1, Q96, sqrtRatioBX96.minus(sqrtRatioAX96));\n};\n\nexport const getSqrtPriceX96 = (\n price: number,\n token0Decimal: number,\n token1Decimal: number\n): bn => {\n const token0 = expandDecimals(price, token0Decimal);\n const token1 = expandDecimals(1, token1Decimal);\n\n return token0.div(token1).sqrt().multipliedBy(Q96);\n};\n\nexport const getLiquidityDelta = (\n P: number,\n lowerP: number,\n upperP: number,\n amount0: number,\n amount1: number,\n token0Decimal: number,\n token1Decimal: number\n): bn => {\n const amt0 = expandDecimals(amount0, token1Decimal);\n const amt1 = expandDecimals(amount1, token0Decimal);\n\n const sqrtRatioX96 = getSqrtPriceX96(P, token0Decimal, token1Decimal);\n const sqrtRatioAX96 = getSqrtPriceX96(lowerP, token0Decimal, token1Decimal);\n const sqrtRatioBX96 = getSqrtPriceX96(upperP, token0Decimal, token1Decimal);\n\n let liquidity: bn;\n if (sqrtRatioX96.lte(sqrtRatioAX96)) {\n liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amt0);\n } else if (sqrtRatioX96.lt(sqrtRatioBX96)) {\n const liquidity0 = getLiquidityForAmount0(\n sqrtRatioX96,\n sqrtRatioBX96,\n amt0\n );\n const liquidity1 = getLiquidityForAmount1(\n sqrtRatioAX96,\n sqrtRatioX96,\n amt1\n );\n\n liquidity = bn.min(liquidity0, liquidity1);\n } else {\n liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amt1);\n }\n\n return liquidity;\n};\n\nexport const estimateFee = (\n liquidityDelta: bn,\n liquidity: bn,\n volume24H: number,\n feeTier: string\n): number => {\n const feeTierPercentage = getFeeTierPercentage(feeTier);\n const liquidityPercentage = liquidityDelta\n .div(liquidity.plus(liquidityDelta))\n .toNumber();\n\n return feeTierPercentage * volume24H * liquidityPercentage;\n};\n\nexport const getLiquidityFromTick = (poolTicks: Tick[], tick: number): bn => {\n // calculate a cumulative of liquidityNet from all ticks that poolTicks[i] <= tick\n let liquidity: bn = new bn(0);\n for (let i = 0; i < poolTicks.length - 1; ++i) {\n liquidity = liquidity.plus(new bn(poolTicks[i].liquidityNet));\n\n const lowerTick = Number(poolTicks[i].tickIdx);\n const upperTick = Number(poolTicks[i + 1]?.tickIdx);\n\n if (lowerTick <= tick && tick <= upperTick) {\n break;\n }\n }\n\n return liquidity;\n};\n\n// private helper functions\nconst encodeSqrtPriceX96 = (price: number | string | bn): bn => {\n return new bn(price).sqrt().multipliedBy(Q96).integerValue(3);\n};\n\nconst expandDecimals = (n: number | string | bn, exp: number): bn => {\n return new bn(n).multipliedBy(new bn(10).pow(exp));\n};\n\nconst mulDiv = (a: bn, b: bn, multiplier: bn) => {\n return a.multipliedBy(b).div(multiplier);\n};\n\nexport const averageArray = (data: number[]): number => {\n if (data.length < 1) return 0;\n return data.reduce((result, val) => result + val, 0) / data.length;\n};\n","import { ApertureLogos } from \"@aperture/assetkit\";\nimport {\n CommonLgText,\n FlexColumn,\n Headline1,\n Headline5,\n T1Regular,\n} from \"@aperture/uikit\";\nimport styled from \"styled-components\";\nimport { LayoutProps, SpaceProps, compose, layout, space } from \"styled-system\";\n\nexport const Headline = styled(T1Regular)`\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-family: \"Roboto Flex\";\n`;\n\nexport const Title = styled.div`\n display: flex;\n align-items: center;\n flex-direction: row;\n`;\n\nexport const TitleText = styled(Headline1)`\n width: 100%;\n font-weight: 500;\n font-family: \"Dunbar Tall\";\n text-align: start;\n color: ${({ theme }) => theme.colors.global.text.T1};\n`;\n\nexport const Container = styled.div`\n box-sizing: border-box;\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: ${({ theme }) => theme.spacing.xl};\n`;\n\nexport const Row = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n`;\n\nexport const RowWithGap = styled.div<{ gap: string }>`\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: ${({ gap }) => gap};\n`;\n\nexport const PageContainer = styled(FlexColumn)`\n margin-top: 20px;\n align-items: center;\n gap: ${({ theme }) => theme.spacing[\"3xl\"]};\n width: 100%;\n max-width: calc(100vw * 0.75);\n padding-bottom: 30px;\n`;\n\nexport const EmptyBox = styled.div<LayoutProps & SpaceProps>`\n width: 100%;\n height: 276px;\n font-weight: 500;\n border-radius: ${({ theme }) => theme.radii.md};\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: ${({ theme }) => theme.spacing.lg};\n border: 1px solid ${({ theme }) => theme.colors.global.line.Line1};\n color: ${({ theme }) => theme.colors.global.text.T3};\n > svg,\n path {\n fill: ${({ theme }) => theme.colors.global.text.T1};\n }\n ${compose(layout, space)}\n`;\n\nexport const CommonContainer = styled.div<LayoutProps & { padding?: string }>`\n padding: ${({ padding }) => padding || \"0\"};\n background: ${({ theme }) => theme.colors.global.background.BG2};\n color: ${({ theme }) => theme.colors.global.text.T1};\n border: ${({ padding }) =>\n !padding\n ? \"none\"\n : `1px solid ${({ theme }) => theme.colors.global.line.Line2};`};\n border-radius: ${({ theme }) => theme.radii.md};\n box-sizing: border-box;\n ${layout}\n`;\n\nexport const PositionContainer = styled(CommonContainer)`\n width: 100%;\n`;\n\nexport const OtherInfo = styled(CommonContainer)<{ gap?: string }>`\n display: flex;\n flex-direction: column;\n gap: ${({ theme, gap }) => gap ?? theme.spacing.md};\n color: ${({ theme }) => theme.colors.global.text.T1};\n`;\n\nexport const RowTitle = styled(Headline5)`\n color: ${({ theme }) => theme.colors.global.text.T1};\n`;\nexport const Text1 = styled(Headline5)`\n font-size: 16px;\n line-height: 20px;\n font-weight: 500;\n color: ${({ theme }) => theme.colors.global.text.T1};\n`;\nexport const Text2 = styled(Text1)`\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n`;\n\nexport const Expires = styled(FlexColumn)`\n width: 160px;\n align-items: flex-end;\n justify-content: center;\n gap: ${({ theme }) => theme.spacing.xl};\n color: ${({ theme }) => theme.colors.global.text.T1};\n`;\n\nexport const DividerHorizontal = styled.div`\n height: 1px;\n width: 100%;\n background-color: ${({ theme }) => theme.colors.global.line.Line2};\n align-self: stretch;\n`;\n\nexport const DividerVertical = styled.div`\n ::after {\n position: absolute;\n top: 0;\n bottom: 0;\n content: \"\";\n width: 1px;\n height: 100%;\n background-color: ${({ theme }) => theme.colors.global.line.Line2};\n }\n`;\n\nexport const TimeZone = styled(CommonLgText)`\n text-align: right;\n color: ${({ theme }) => theme.colors.global.text.T3};\n margin-top: -8px;\n`;\n\nexport const IconDiv = styled.div<{ width: number; height: number }>`\n height: ${({ height }) => height}px;\n width: ${({ width }) => width}px;\n flex: 1 1 0%;\n display: flex;\n align-items: center;\n gap: ${({ theme }) => theme.spacing.md};\n`;\n\nexport const Loader = styled(ApertureLogos.TransparentLogo)`\n height: 80px;\n width: 80px;\n animation: rotation infinite 3s linear;\n\n @keyframes rotation {\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n }\n`;\n"],"names":["_querySupgraph","subgraphEndpoint","query","data","axios","url","method","errors","length","concat","JSON","stringify","getPoolVolumes","poolAddress","numberOfDays","poolDayDatas","getPositionBreakdown","networkId","mockPool","priceAssumptionValue","priceRangeMinValue","priceRangeMaxValue","token0CurrentPrice","token1CurrentPrice","depositAmount","token0","token1","positionBreakdown","amount0","amount1","getTokensAmountFromDepositAmountUSD","Number","deltaL","getLiquidityDelta","decimals","tokenA","SDKToken","address","tokenB","tickLower","priceToTick","BigNumber","toFixed","tickSpacing","tickUpper","mockPosition","SDKPosition","pool","liquidity","Math","min","max","pow","count","mockPrice","viem","Big","splits","push","price","token0Amount","toExact","token1Amount","error","console","log","getLogger","getAvgTradingVolume","volumes","map","d","volumeUSD","averageArray","_getPoolTicksByPage","page","res","ticks","e","warn","message","getPoolTicks","result","pool1","pool2","pool3","Promise","all","_processTokenInfo","token","getToken","tokenAddress","toLowerCase","getPoolFromPair","disabledTopPositions","sortedTokens","sortTokens","feeGrowthGlobal","pools","id","getBulkTokens","tokenAddresses","join","tokens","getPools","totalValueLockedUSD_gte","volumeUSD_gte","undefined","tokenIds","getUniqueItems","reduce","acc","p","queryPage","ceil","Array","from","_","i","start","slice","then","flat","sort","a","b","poolCountByTokenHash","_tokens","t","poolCount","tokenHash","poolDayData","open","close","filter","DEFAULT_AMM","E_AMM","isCalculatorAMM","CalculatorAmmInfo","amm","name","getFeeTierPercentage","tier","arr","v","indexOf","apiKey","SubgraphURLs","SupportedChainId","getDefaultPoolTicks","selectedPool","price0","MAX_SAFE_INTEGER","price1","minTick","getTickFromPrice","maxTick","tickIdx","String","liquidityNet","NetworkVolumeTVL","DefaultVolumeTVL","getTokenFromSubgraphToken","_token","Token","convertToChartToken","priceChart","ticker","symbol","currentPriceUSD","bn","EXPONENTIAL_AT","DECIMAL_PLACES","Q96","token0Decimal","token1Decimal","expandDecimals","sqrtPrice","encodeSqrtPriceX96","div","toNumber","sqrt","getPriceFromTick","tick","multipliedBy","L2","mulDiv","P","Pl","Pu","priceUSDX","priceUSDY","depositAmountUSD","deltaY","deltaX","sqrtP","sqrtPl","sqrtPu","invSqrtP","invSqrtPu","denominator","isFinite","isNaN","liquidityDelta","getLiquidityForAmount0","sqrtRatioAX96","sqrtRatioBX96","intermediate","minus","getLiquidityForAmount1","getSqrtPriceX96","lowerP","upperP","amt0","amt1","sqrtRatioX96","lte","lt","liquidity0","liquidity1","estimateFee","volume24H","feeTier","feeTierPercentage","liquidityPercentage","plus","getLiquidityFromTick","poolTicks","lowerTick","upperTick","integerValue","n","exp","multiplier","val","Headline","styled","T1Regular","Title","TitleText","Headline1","theme","param","colors","global","text","T1","Container","spacing","xl","Row","RowWithGap","gap","PageContainer","FlexColumn","EmptyBox","radii","md","lg","line","Line1","T3","compose","layout","space","CommonContainer","padding","background","BG2","Line2","OtherInfo","RowTitle","Headline5","Text1","Text2","Expires","DividerHorizontal","TimeZone","CommonLgText","IconDiv","height","width","Loader","ApertureLogos","withConfig"],"sourceRoot":""}