Skip to content

Commit

Permalink
fix(lint): auto-fix [ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
mzywang committed May 9, 2024
1 parent 161da3f commit 1b15d50
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/mappings/pool/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/pool/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
5 changes: 1 addition & 4 deletions src/utils/pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 1b15d50

Please sign in to comment.