diff --git a/src/mappings/pool/collect.ts b/src/mappings/pool/collect.ts index cc4e8080..af71d561 100644 --- a/src/mappings/pool/collect.ts +++ b/src/mappings/pool/collect.ts @@ -35,7 +35,7 @@ export function handleCollect(event: CollectEvent): void { collectedAmountToken0, token0 as Token, collectedAmountToken1, - token1 as Token + token1 as Token, ) // Reset tvl aggregates until new amounts calculated diff --git a/src/mappings/pool/swap.ts b/src/mappings/pool/swap.ts index 1743b261..f20d680a 100644 --- a/src/mappings/pool/swap.ts +++ b/src/mappings/pool/swap.ts @@ -48,7 +48,7 @@ export function handleSwap(event: SwapEvent): void { // get amount that should be tracked only - div 2 because cant count both input and output as volume const amountTotalUSDTracked = getTrackedAmountUSD(amount0Abs, token0 as Token, amount1Abs, token1 as Token).div( - BigDecimal.fromString('2') + BigDecimal.fromString('2'), ) const amountTotalETHTracked = safeDiv(amountTotalUSDTracked, bundle.ethPriceUSD) const amountTotalUSDUntracked = amount0USD.plus(amount1USD).div(BigDecimal.fromString('2')) diff --git a/src/utils/pricing.ts b/src/utils/pricing.ts index 1496054a..1f53c9d7 100644 --- a/src/utils/pricing.ts +++ b/src/utils/pricing.ts @@ -48,10 +48,7 @@ const Q192 = BigInt.fromI32(2).pow(192 as u8) export function sqrtPriceX96ToTokenPrices(sqrtPriceX96: BigInt, token0: Token, token1: Token): BigDecimal[] { const num = sqrtPriceX96.times(sqrtPriceX96).toBigDecimal() const denom = BigDecimal.fromString(Q192.toString()) - const price1 = num - .div(denom) - .times(exponentToBigDecimal(token0.decimals)) - .div(exponentToBigDecimal(token1.decimals)) + const price1 = num.div(denom).times(exponentToBigDecimal(token0.decimals)).div(exponentToBigDecimal(token1.decimals)) const price0 = safeDiv(BigDecimal.fromString('1'), price1) return [price0, price1]