From ad77cf2cc9b7a35eb2525982a5377b58bf56ba4f Mon Sep 17 00:00:00 2001 From: Michael Wang <44713145+mzywang@users.noreply.github.com> Date: Tue, 26 Mar 2024 09:17:25 -0400 Subject: [PATCH 1/5] remove extra tick data --- schema.graphql | 74 ------------------------------------ src/mappings/core.ts | 23 ----------- src/utils/intervalUpdates.ts | 27 ------------- src/utils/tick.ts | 13 ------- 4 files changed, 137 deletions(-) diff --git a/schema.graphql b/schema.graphql index 6b10e59b..4b6ec18a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -160,33 +160,10 @@ type Tick @entity { price0: BigDecimal! # calculated price of token1 of tick within this pool - constant price1: BigDecimal! - # lifetime volume of token0 with this tick in range - volumeToken0: BigDecimal! - # lifetime volume of token1 with this tick in range - volumeToken1: BigDecimal! - # lifetime volume in derived USD with this tick in range - volumeUSD: BigDecimal! - # lifetime volume in untracked USD with this tick in range - untrackedVolumeUSD: BigDecimal! - # fees in USD - feesUSD: BigDecimal! - # all time collected fees in token0 - collectedFeesToken0: BigDecimal! - # all time collected fees in token1 - collectedFeesToken1: BigDecimal! - # all time collected fees in USD - collectedFeesUSD: BigDecimal! # created time createdAtTimestamp: BigInt! # created block createdAtBlockNumber: BigInt! - # Fields used to help derived relationship - liquidityProviderCount: BigInt! # used to detect new exchanges - # derived fields - # swaps: [Swap!]! @derivedFrom(field: "tick") - # vars needed for fee computation - feeGrowthOutside0X128: BigInt! - feeGrowthOutside1X128: BigInt! } type Position @entity { @@ -539,57 +516,6 @@ type PoolHourData @entity { close: BigDecimal! } -type TickHourData @entity { - # format: -- - id: ID! - # unix timestamp for start of hour - periodStartUnix: Int! - # pointer to pool - pool: Pool! - # pointer to tick - tick: Tick! - # total liquidity pool has as tick lower or upper at end of period - liquidityGross: BigInt! - # how much liquidity changes when tick crossed at end of period - liquidityNet: BigInt! - # hourly volume of token0 with this tick in range - volumeToken0: BigDecimal! - # hourly volume of token1 with this tick in range - volumeToken1: BigDecimal! - # hourly volume in derived USD with this tick in range - volumeUSD: BigDecimal! - # fees in USD - feesUSD: BigDecimal! -} - -# Data accumulated and condensed into day stats for each exchange -# Note: this entity gets saved only if there is a change during the day -type TickDayData @entity { - # format: -- - id: ID! - # timestamp rounded to current day by dividing by 86400 - date: Int! - # pointer to pool - pool: Pool! - # pointer to tick - tick: Tick! - # total liquidity pool has as tick lower or upper at end of period - liquidityGross: BigInt! - # how much liquidity changes when tick crossed at end of period - liquidityNet: BigInt! - # hourly volume of token0 with this tick in range - volumeToken0: BigDecimal! - # hourly volume of token1 with this tick in range - volumeToken1: BigDecimal! - # hourly volume in derived USD with this tick in range - volumeUSD: BigDecimal! - # fees in USD - feesUSD: BigDecimal! - # vars needed for fee computation - feeGrowthOutside0X128: BigInt! - feeGrowthOutside1X128: BigInt! -} - type TokenDayData @entity { # token address concatendated with date id: ID! diff --git a/src/mappings/core.ts b/src/mappings/core.ts index 2b0b4bf7..1e1b590d 100644 --- a/src/mappings/core.ts +++ b/src/mappings/core.ts @@ -15,7 +15,6 @@ import { findEthPerToken, getEthPriceInUSD, getTrackedAmountUSD, sqrtPriceX96ToT import { updatePoolDayData, updatePoolHourData, - updateTickDayData, updateTokenDayData, updateTokenHourData, updateUniswapDayData @@ -165,10 +164,6 @@ export function handleMint(event: MintEvent): void { pool.save() factory.save() mint.save() - - // Update inner tick vars and save the ticks - updateTickFeeVarsAndSave(lowerTick, event) - updateTickFeeVarsAndSave(upperTick, event) } } @@ -257,9 +252,6 @@ export function handleBurn(event: BurnEvent): void { lowerTick.liquidityNet = lowerTick.liquidityNet.minus(amount) upperTick.liquidityGross = upperTick.liquidityGross.minus(amount) upperTick.liquidityNet = upperTick.liquidityNet.plus(amount) - - updateTickFeeVarsAndSave(lowerTick, event) - updateTickFeeVarsAndSave(upperTick, event) } updateUniswapDayData(event) updatePoolDayData(event) @@ -521,18 +513,6 @@ export function handleFlash(event: FlashEvent): void { pool.save() } -function updateTickFeeVarsAndSave(tick: Tick, event: ethereum.Event): void { - let poolAddress = event.address - // not all ticks are initialized so obtaining null is expected behavior - let poolContract = PoolABI.bind(poolAddress) - let tickResult = poolContract.ticks(tick.tickIdx.toI32()) - tick.feeGrowthOutside0X128 = tickResult.value2 - tick.feeGrowthOutside1X128 = tickResult.value3 - tick.save() - - updateTickDayData(tick, event) -} - function loadTickUpdateFeeVarsAndSave(tickId: i32, event: ethereum.Event): void { let poolAddress = event.address let tick = Tick.load( @@ -541,7 +521,4 @@ function loadTickUpdateFeeVarsAndSave(tickId: i32, event: ethereum.Event): void .concat('#') .concat(tickId.toString()) ) - if (tick !== null) { - updateTickFeeVarsAndSave(tick, event) - } } diff --git a/src/utils/intervalUpdates.ts b/src/utils/intervalUpdates.ts index 1e0c0e40..b4ba8a67 100644 --- a/src/utils/intervalUpdates.ts +++ b/src/utils/intervalUpdates.ts @@ -10,7 +10,6 @@ import { TokenHourData, Bundle, PoolHourData, - TickDayData, Tick } from './../types/schema' import { FACTORY_ADDRESS } from './constants' @@ -225,29 +224,3 @@ export function updateTokenHourData(token: Token, event: ethereum.Event): TokenH return tokenHourData as TokenHourData } - -export function updateTickDayData(tick: Tick, event: ethereum.Event): TickDayData { - let timestamp = event.block.timestamp.toI32() - let dayID = timestamp / 86400 - let dayStartTimestamp = dayID * 86400 - let tickDayDataID = tick.id.concat('-').concat(dayID.toString()) - let tickDayData = TickDayData.load(tickDayDataID) - if (tickDayData === null) { - tickDayData = new TickDayData(tickDayDataID) - tickDayData.date = dayStartTimestamp - tickDayData.pool = tick.pool - tickDayData.tick = tick.id - } - tickDayData.liquidityGross = tick.liquidityGross - tickDayData.liquidityNet = tick.liquidityNet - tickDayData.volumeToken0 = tick.volumeToken0 - tickDayData.volumeToken1 = tick.volumeToken0 - tickDayData.volumeUSD = tick.volumeUSD - tickDayData.feesUSD = tick.feesUSD - tickDayData.feeGrowthOutside0X128 = tick.feeGrowthOutside0X128 - tickDayData.feeGrowthOutside1X128 = tick.feeGrowthOutside1X128 - - tickDayData.save() - - return tickDayData as TickDayData -} diff --git a/src/utils/tick.ts b/src/utils/tick.ts index c206a2c2..4f36729a 100644 --- a/src/utils/tick.ts +++ b/src/utils/tick.ts @@ -15,7 +15,6 @@ export function createTick(tickId: string, tickIdx: i32, poolId: string, event: tick.createdAtBlockNumber = event.block.number tick.liquidityGross = ZERO_BI tick.liquidityNet = ZERO_BI - tick.liquidityProviderCount = ZERO_BI tick.price0 = ONE_BD tick.price1 = ONE_BD @@ -25,18 +24,6 @@ export function createTick(tickId: string, tickIdx: i32, poolId: string, event: tick.price0 = price0 tick.price1 = safeDiv(ONE_BD, price0) - tick.volumeToken0 = ZERO_BD - tick.volumeToken1 = ZERO_BD - tick.volumeUSD = ZERO_BD - tick.feesUSD = ZERO_BD - tick.untrackedVolumeUSD = ZERO_BD - tick.collectedFeesToken0 = ZERO_BD - tick.collectedFeesToken1 = ZERO_BD - tick.collectedFeesUSD = ZERO_BD - tick.liquidityProviderCount = ZERO_BI - tick.feeGrowthOutside0X128 = ZERO_BI - tick.feeGrowthOutside1X128 = ZERO_BI - return tick } From 061a09c0d3f05def352ae34fd81c820f3872761d Mon Sep 17 00:00:00 2001 From: Michael Wang <44713145+mzywang@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:12:34 -0400 Subject: [PATCH 2/5] remove nfpm --- abis/NonfungiblePositionManager.json | 1193 -------------------------- schema.graphql | 71 -- src/mappings/position-manager.ts | 189 ---- subgraph.yaml | 36 - 4 files changed, 1489 deletions(-) delete mode 100644 abis/NonfungiblePositionManager.json delete mode 100644 src/mappings/position-manager.ts diff --git a/abis/NonfungiblePositionManager.json b/abis/NonfungiblePositionManager.json deleted file mode 100644 index 29cef050..00000000 --- a/abis/NonfungiblePositionManager.json +++ /dev/null @@ -1,1193 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_factory", - "type": "address" - }, - { - "internalType": "address", - "name": "_WETH9", - "type": "address" - }, - { - "internalType": "address", - "name": "_tokenDescriptor_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Collect", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "DecreaseLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "IncreaseLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "WETH9", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "baseURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint128", - "name": "amount0Max", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1Max", - "type": "uint128" - } - ], - "name": "collect", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenA", - "type": "address" - }, - { - "internalType": "address", - "name": "tokenB", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - } - ], - "name": "createAndInitializePoolIfNecessary", - "outputs": [ - { - "internalType": "address", - "name": "pool", - "type": "address" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "amount0Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "decreaseLiquidity", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount0Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount0Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "name": "increaseLiquidity", - "outputs": [ - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint256", - "name": "amount0Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Desired", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount0Min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Min", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - } - ], - "internalType": "struct INonfungiblePositionManager.MintParams", - "name": "params", - "type": "tuple" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "positions", - "outputs": [ - { - "internalType": "uint96", - "name": "nonce", - "type": "uint96" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "address", - "name": "token0", - "type": "address" - }, - { - "internalType": "address", - "name": "token1", - "type": "address" - }, - { - "internalType": "uint24", - "name": "fee", - "type": "uint24" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside0LastX128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside1LastX128", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "tokensOwed0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "tokensOwed1", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "selfPermit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "selfPermitAllowed", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "selfPermitAllowedIfNecessary", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "selfPermitIfNecessary", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountMinimum", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "sweepToken", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount0Owed", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Owed", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "uniswapV3MintCallback", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountMinimum", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "unwrapWETH9", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] \ No newline at end of file diff --git a/schema.graphql b/schema.graphql index 4b6ec18a..85e70edd 100644 --- a/schema.graphql +++ b/schema.graphql @@ -166,77 +166,6 @@ type Tick @entity { createdAtBlockNumber: BigInt! } -type Position @entity { - # Positions created through NonfungiblePositionManager - # NFT token id - id: ID! - # owner of the NFT - owner: Bytes! - # pool position is within - pool: Pool! - # allow indexing by tokens - token0: Token! - # allow indexing by tokens - token1: Token! - # lower tick of the position - tickLower: Tick! - # upper tick of the position - tickUpper: Tick! - # total position liquidity - liquidity: BigInt! - # amount of token 0 ever deposited to position - depositedToken0: BigDecimal! - # amount of token 1 ever deposited to position - depositedToken1: BigDecimal! - # amount of token 0 ever withdrawn from position (without fees) - withdrawnToken0: BigDecimal! - # amount of token 1 ever withdrawn from position (without fees) - withdrawnToken1: BigDecimal! - # all time collected fees in token0 - collectedFeesToken0: BigDecimal! - # all time collected fees in token1 - collectedFeesToken1: BigDecimal! - # tx in which the position was initialized - transaction: Transaction! - # vars needed for fee computation - feeGrowthInside0LastX128: BigInt! - feeGrowthInside1LastX128: BigInt! -} - -type PositionSnapshot @entity { - # # - id: ID! - # owner of the NFT - owner: Bytes! - # pool the position is within - pool: Pool! - # position of which the snap was taken of - position: Position! - # block in which the snap was created - blockNumber: BigInt! - # timestamp of block in which the snap was created - timestamp: BigInt! - # total position liquidity - liquidity: BigInt! - # amount of token 0 ever deposited to position - depositedToken0: BigDecimal! - # amount of token 1 ever deposited to position - depositedToken1: BigDecimal! - # amount of token 0 ever withdrawn from position (without fees) - withdrawnToken0: BigDecimal! - # amount of token 1 ever withdrawn from position (without fees) - withdrawnToken1: BigDecimal! - # all time collected fees in token0 - collectedFeesToken0: BigDecimal! - # all time collected fees in token1 - collectedFeesToken1: BigDecimal! - # tx in which the snapshot was initialized - transaction: Transaction! - # internal vars needed for fee computation - feeGrowthInside0LastX128: BigInt! - feeGrowthInside1LastX128: BigInt! -} - type Transaction @entity { # txn hash id: ID! diff --git a/src/mappings/position-manager.ts b/src/mappings/position-manager.ts deleted file mode 100644 index 49f5d7d1..00000000 --- a/src/mappings/position-manager.ts +++ /dev/null @@ -1,189 +0,0 @@ -/* eslint-disable prefer-const */ -import { - Collect, - DecreaseLiquidity, - IncreaseLiquidity, - NonfungiblePositionManager, - Transfer -} from '../types/NonfungiblePositionManager/NonfungiblePositionManager' -import { Bundle, Position, PositionSnapshot, Token } from '../types/schema' -import { ADDRESS_ZERO, factoryContract, ZERO_BD, ZERO_BI } from '../utils/constants' -import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts' -import { convertTokenToDecimal, loadTransaction } from '../utils' - -function getPosition(event: ethereum.Event, tokenId: BigInt): Position | null { - let position = Position.load(tokenId.toString()) - if (position === null) { - let contract = NonfungiblePositionManager.bind(event.address) - let positionCall = contract.try_positions(tokenId) - - // the following call reverts in situations where the position is minted - // and deleted in the same block - from my investigation this happens - // in calls from BancorSwap - // (e.g. 0xf7867fa19aa65298fadb8d4f72d0daed5e836f3ba01f0b9b9631cdc6c36bed40) - if (!positionCall.reverted) { - let positionResult = positionCall.value - let poolAddress = factoryContract.getPool(positionResult.value2, positionResult.value3, positionResult.value4) - - position = new Position(tokenId.toString()) - // The owner gets correctly updated in the Transfer handler - position.owner = Address.fromString(ADDRESS_ZERO) - position.pool = poolAddress.toHexString() - position.token0 = positionResult.value2.toHexString() - position.token1 = positionResult.value3.toHexString() - position.tickLower = position.pool.concat('#').concat(positionResult.value5.toString()) - position.tickUpper = position.pool.concat('#').concat(positionResult.value6.toString()) - position.liquidity = ZERO_BI - position.depositedToken0 = ZERO_BD - position.depositedToken1 = ZERO_BD - position.withdrawnToken0 = ZERO_BD - position.withdrawnToken1 = ZERO_BD - position.collectedFeesToken0 = ZERO_BD - position.collectedFeesToken1 = ZERO_BD - position.transaction = loadTransaction(event).id - position.feeGrowthInside0LastX128 = positionResult.value8 - position.feeGrowthInside1LastX128 = positionResult.value9 - } - } - - return position -} - -function updateFeeVars(position: Position, event: ethereum.Event, tokenId: BigInt): Position { - let positionManagerContract = NonfungiblePositionManager.bind(event.address) - let positionResult = positionManagerContract.try_positions(tokenId) - if (!positionResult.reverted) { - position.feeGrowthInside0LastX128 = positionResult.value.value8 - position.feeGrowthInside1LastX128 = positionResult.value.value9 - } - return position -} - -function savePositionSnapshot(position: Position, event: ethereum.Event): void { - let positionSnapshot = new PositionSnapshot(position.id.concat('#').concat(event.block.number.toString())) - positionSnapshot.owner = position.owner - positionSnapshot.pool = position.pool - positionSnapshot.position = position.id - positionSnapshot.blockNumber = event.block.number - positionSnapshot.timestamp = event.block.timestamp - positionSnapshot.liquidity = position.liquidity - positionSnapshot.depositedToken0 = position.depositedToken0 - positionSnapshot.depositedToken1 = position.depositedToken1 - positionSnapshot.withdrawnToken0 = position.withdrawnToken0 - positionSnapshot.withdrawnToken1 = position.withdrawnToken1 - positionSnapshot.collectedFeesToken0 = position.collectedFeesToken0 - positionSnapshot.collectedFeesToken1 = position.collectedFeesToken1 - positionSnapshot.transaction = loadTransaction(event).id - positionSnapshot.feeGrowthInside0LastX128 = position.feeGrowthInside0LastX128 - positionSnapshot.feeGrowthInside1LastX128 = position.feeGrowthInside1LastX128 - positionSnapshot.save() -} - -export function handleIncreaseLiquidity(event: IncreaseLiquidity): void { - // temp fix - if (event.block.number.equals(BigInt.fromI32(14317993))) { - return - } - - let position = getPosition(event, event.params.tokenId) - - // position was not able to be fetched - if (position == null) { - return - } - - // temp fix - if (Address.fromString(position.pool).equals(Address.fromHexString('0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248'))) { - return - } - - let token0 = Token.load(position.token0) - let token1 = Token.load(position.token1) - - if (token0 && token1) { - let amount0 = convertTokenToDecimal(event.params.amount0, token0.decimals) - let amount1 = convertTokenToDecimal(event.params.amount1, token1.decimals) - - position.liquidity = position.liquidity.plus(event.params.liquidity) - position.depositedToken0 = position.depositedToken0.plus(amount0) - position.depositedToken1 = position.depositedToken1.plus(amount1) - - updateFeeVars(position, event, event.params.tokenId) - - position.save() - - savePositionSnapshot(position, event) - } -} - -export function handleDecreaseLiquidity(event: DecreaseLiquidity): void { - // temp fix - if (event.block.number == BigInt.fromI32(14317993)) { - return - } - - let position = getPosition(event, event.params.tokenId) - - // position was not able to be fetched - if (position == null) { - return - } - - // temp fix - if (Address.fromString(position.pool).equals(Address.fromHexString('0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248'))) { - return - } - - let token0 = Token.load(position.token0) - let token1 = Token.load(position.token1) - - if (token0 && token1) { - let amount0 = convertTokenToDecimal(event.params.amount0, token0.decimals) - let amount1 = convertTokenToDecimal(event.params.amount1, token1.decimals) - - position.liquidity = position.liquidity.minus(event.params.liquidity) - position.withdrawnToken0 = position.withdrawnToken0.plus(amount0) - position.withdrawnToken1 = position.withdrawnToken1.plus(amount1) - - position = updateFeeVars(position, event, event.params.tokenId) - position.save() - savePositionSnapshot(position, event) - } -} - -export function handleCollect(event: Collect): void { - let position = getPosition(event, event.params.tokenId) - // position was not able to be fetched - if (position == null) { - return - } - if (Address.fromString(position.pool).equals(Address.fromHexString('0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248'))) { - return - } - - let token0 = Token.load(position.token0) - - if (token0) { - let amount0 = convertTokenToDecimal(event.params.amount0, token0.decimals) - position.collectedFeesToken0 = position.collectedFeesToken0.plus(amount0) - position.collectedFeesToken1 = position.collectedFeesToken1.plus(amount0) - } - - position = updateFeeVars(position, event, event.params.tokenId) - position.save() - savePositionSnapshot(position, event) -} - -export function handleTransfer(event: Transfer): void { - let position = getPosition(event, event.params.tokenId) - - // position was not able to be fetched - if (position == null) { - return - } - - position.owner = event.params.to - position.save() - - savePositionSnapshot(position, event) -} diff --git a/subgraph.yaml b/subgraph.yaml index f8e2d3dc..d2156671 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -3,9 +3,6 @@ description: Uniswap is a decentralized protocol for automated token exchange on repository: https://github.com/Uniswap/uniswap-v3-subgraph schema: file: ./schema.graphql -graft: - base: QmZeCuoZeadgHkGwLwMeguyqUKz1WPWQYKcKyMCeQqGhsF - block: 19470000 features: - nonFatalErrors - grafting @@ -39,39 +36,6 @@ dataSources: eventHandlers: - event: PoolCreated(indexed address,indexed address,indexed uint24,int24,address) handler: handlePoolCreated - - kind: ethereum/contract - name: NonfungiblePositionManager - network: mainnet - source: - address: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88' - abi: NonfungiblePositionManager - startBlock: 12369651 - mapping: - kind: ethereum/events - apiVersion: 0.0.7 - language: wasm/assemblyscript - file: ./src/mappings/position-manager.ts - entities: - - Pool - - Token - abis: - - name: NonfungiblePositionManager - file: ./abis/NonfungiblePositionManager.json - - name: Pool - file: ./abis/pool.json - - name: Factory - file: ./abis/factory.json - - name: ERC20 - file: ./abis/ERC20.json - eventHandlers: - - event: IncreaseLiquidity(indexed uint256,uint128,uint256,uint256) - handler: handleIncreaseLiquidity - - event: DecreaseLiquidity(indexed uint256,uint128,uint256,uint256) - handler: handleDecreaseLiquidity - - event: Collect(indexed uint256,address,uint256,uint256) - handler: handleCollect - - event: Transfer(indexed address,indexed address,indexed uint256) - handler: handleTransfer templates: - kind: ethereum/contract name: Pool From 214b19c9d6c6fe5eec4cc43dca196a1a5d1fe349 Mon Sep 17 00:00:00 2001 From: Michael Wang <44713145+mzywang@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:21:39 -0400 Subject: [PATCH 3/5] fix tick removal --- src/mappings/core.ts | 50 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/src/mappings/core.ts b/src/mappings/core.ts index 1e1b590d..0f08ecb8 100644 --- a/src/mappings/core.ts +++ b/src/mappings/core.ts @@ -148,6 +148,9 @@ export function handleMint(event: MintEvent): void { upperTick.liquidityGross = upperTick.liquidityGross.plus(amount) upperTick.liquidityNet = upperTick.liquidityNet.minus(amount) + lowerTick.save() + upperTick.save() + // TODO: Update Tick's volume, fees, and liquidity provider count. Computing these on the tick // level requires reimplementing some of the swapping code from v3-core. @@ -252,6 +255,9 @@ export function handleBurn(event: BurnEvent): void { lowerTick.liquidityNet = lowerTick.liquidityNet.minus(amount) upperTick.liquidityGross = upperTick.liquidityGross.minus(amount) upperTick.liquidityNet = upperTick.liquidityNet.plus(amount) + + lowerTick.save() + upperTick.save() } updateUniswapDayData(event) updatePoolDayData(event) @@ -465,40 +471,6 @@ export function handleSwap(event: SwapEvent): void { pool.save() token0.save() token1.save() - - // Update inner vars of current or crossed ticks - let newTick = pool.tick - if (oldTick && newTick) { - let tickSpacing = feeTierToTickSpacing(pool.feeTier) - let modulo = newTick.mod(tickSpacing) - if (modulo.equals(ZERO_BI)) { - // Current tick is initialized and needs to be updated - loadTickUpdateFeeVarsAndSave(newTick.toI32(), event) - } - - let numIters = oldTick - .minus(newTick) - .abs() - .div(tickSpacing) - - if (numIters.gt(BigInt.fromI32(100))) { - // In case more than 100 ticks need to be updated ignore the update in - // order to avoid timeouts. From testing this behavior occurs only upon - // pool initialization. This should not be a big issue as the ticks get - // updated later. For early users this error also disappears when calling - // collect - } else if (newTick.gt(oldTick)) { - let firstInitialized = oldTick.plus(tickSpacing.minus(modulo)) - for (let i = firstInitialized; i.le(newTick); i = i.plus(tickSpacing)) { - loadTickUpdateFeeVarsAndSave(i.toI32(), event) - } - } else if (newTick.lt(oldTick)) { - let firstInitialized = oldTick.minus(modulo) - for (let i = firstInitialized; i.ge(newTick); i = i.minus(tickSpacing)) { - loadTickUpdateFeeVarsAndSave(i.toI32(), event) - } - } - } } } @@ -512,13 +484,3 @@ export function handleFlash(event: FlashEvent): void { pool.feeGrowthGlobal1X128 = feeGrowthGlobal1X128 as BigInt pool.save() } - -function loadTickUpdateFeeVarsAndSave(tickId: i32, event: ethereum.Event): void { - let poolAddress = event.address - let tick = Tick.load( - poolAddress - .toHexString() - .concat('#') - .concat(tickId.toString()) - ) -} From 7c19c1118569fea38dcdd1573c9a156355a1deee Mon Sep 17 00:00:00 2001 From: Michael Wang <44713145+mzywang@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:50:31 -0400 Subject: [PATCH 4/5] remove fee growth --- abis/pool.json | 2 +- schema.graphql | 12 ------------ src/mappings/core.ts | 15 --------------- src/mappings/factory.ts | 2 -- src/utils/intervalUpdates.ts | 8 -------- subgraph.yaml | 2 -- 6 files changed, 1 insertion(+), 40 deletions(-) diff --git a/abis/pool.json b/abis/pool.json index c87d64dd..6dd20663 100644 --- a/abis/pool.json +++ b/abis/pool.json @@ -985,4 +985,4 @@ "stateMutability": "view", "type": "function" } -] \ No newline at end of file +] diff --git a/schema.graphql b/schema.graphql index 85e70edd..5af3066e 100644 --- a/schema.graphql +++ b/schema.graphql @@ -89,10 +89,6 @@ type Pool @entity { liquidity: BigInt! # current price tracker sqrtPrice: BigInt! - # tracker for global fee growth - feeGrowthGlobal0X128: BigInt! - # tracker for global fee growth - feeGrowthGlobal1X128: BigInt! # token0 per token1 token0Price: BigDecimal! # token1 per token0 @@ -375,10 +371,6 @@ type PoolDayData @entity { token1Price: BigDecimal! # current tick at end of period tick: BigInt - # tracker for global fee growth - feeGrowthGlobal0X128: BigInt! - # tracker for global fee growth - feeGrowthGlobal1X128: BigInt! # tvl derived in USD at end of period tvlUSD: BigDecimal! # volume in token0 @@ -419,10 +411,6 @@ type PoolHourData @entity { token1Price: BigDecimal! # current tick at end of period tick: BigInt - # tracker for global fee growth - feeGrowthGlobal0X128: BigInt! - # tracker for global fee growth - feeGrowthGlobal1X128: BigInt! # tvl derived in USD at end of period tvlUSD: BigDecimal! # volume in token0 diff --git a/src/mappings/core.ts b/src/mappings/core.ts index 0f08ecb8..501926d4 100644 --- a/src/mappings/core.ts +++ b/src/mappings/core.ts @@ -409,10 +409,6 @@ export function handleSwap(event: SwapEvent): void { // update fee growth let poolContract = PoolABI.bind(event.address) - let feeGrowthGlobal0X128 = poolContract.feeGrowthGlobal0X128() - let feeGrowthGlobal1X128 = poolContract.feeGrowthGlobal1X128() - pool.feeGrowthGlobal0X128 = feeGrowthGlobal0X128 as BigInt - pool.feeGrowthGlobal1X128 = feeGrowthGlobal1X128 as BigInt // interval data let uniswapDayData = updateUniswapDayData(event) @@ -473,14 +469,3 @@ export function handleSwap(event: SwapEvent): void { token1.save() } } - -export function handleFlash(event: FlashEvent): void { - // update fee growth - let pool = Pool.load(event.address.toHexString())! - let poolContract = PoolABI.bind(event.address) - let feeGrowthGlobal0X128 = poolContract.feeGrowthGlobal0X128() - let feeGrowthGlobal1X128 = poolContract.feeGrowthGlobal1X128() - pool.feeGrowthGlobal0X128 = feeGrowthGlobal0X128 as BigInt - pool.feeGrowthGlobal1X128 = feeGrowthGlobal1X128 as BigInt - pool.save() -} diff --git a/src/mappings/factory.ts b/src/mappings/factory.ts index d8a3ed16..7cc6c6ac 100644 --- a/src/mappings/factory.ts +++ b/src/mappings/factory.ts @@ -117,8 +117,6 @@ export function handlePoolCreated(event: PoolCreated): void { pool.txCount = ZERO_BI pool.liquidity = ZERO_BI pool.sqrtPrice = ZERO_BI - pool.feeGrowthGlobal0X128 = ZERO_BI - pool.feeGrowthGlobal1X128 = ZERO_BI pool.token0Price = ZERO_BD pool.token1Price = ZERO_BD pool.observationIndex = ZERO_BI diff --git a/src/utils/intervalUpdates.ts b/src/utils/intervalUpdates.ts index b4ba8a67..b55baa7e 100644 --- a/src/utils/intervalUpdates.ts +++ b/src/utils/intervalUpdates.ts @@ -59,8 +59,6 @@ export function updatePoolDayData(event: ethereum.Event): PoolDayData { poolDayData.volumeUSD = ZERO_BD poolDayData.feesUSD = ZERO_BD poolDayData.txCount = ZERO_BI - poolDayData.feeGrowthGlobal0X128 = ZERO_BI - poolDayData.feeGrowthGlobal1X128 = ZERO_BI poolDayData.open = pool.token0Price poolDayData.high = pool.token0Price poolDayData.low = pool.token0Price @@ -76,8 +74,6 @@ export function updatePoolDayData(event: ethereum.Event): PoolDayData { poolDayData.liquidity = pool.liquidity poolDayData.sqrtPrice = pool.sqrtPrice - poolDayData.feeGrowthGlobal0X128 = pool.feeGrowthGlobal0X128 - poolDayData.feeGrowthGlobal1X128 = pool.feeGrowthGlobal1X128 poolDayData.token0Price = pool.token0Price poolDayData.token1Price = pool.token1Price poolDayData.tick = pool.tick @@ -108,8 +104,6 @@ export function updatePoolHourData(event: ethereum.Event): PoolHourData { poolHourData.volumeUSD = ZERO_BD poolHourData.txCount = ZERO_BI poolHourData.feesUSD = ZERO_BD - poolHourData.feeGrowthGlobal0X128 = ZERO_BI - poolHourData.feeGrowthGlobal1X128 = ZERO_BI poolHourData.open = pool.token0Price poolHourData.high = pool.token0Price poolHourData.low = pool.token0Price @@ -127,8 +121,6 @@ export function updatePoolHourData(event: ethereum.Event): PoolHourData { poolHourData.sqrtPrice = pool.sqrtPrice poolHourData.token0Price = pool.token0Price poolHourData.token1Price = pool.token1Price - poolHourData.feeGrowthGlobal0X128 = pool.feeGrowthGlobal0X128 - poolHourData.feeGrowthGlobal1X128 = pool.feeGrowthGlobal1X128 poolHourData.close = pool.token0Price poolHourData.tick = pool.tick poolHourData.tvlUSD = pool.totalValueLockedUSD diff --git a/subgraph.yaml b/subgraph.yaml index d2156671..10a3b3e7 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -66,5 +66,3 @@ templates: handler: handleMint - event: Burn(indexed address,indexed int24,indexed int24,uint128,uint256,uint256) handler: handleBurn - - event: Flash(indexed address,indexed address,uint256,uint256,uint256,uint256) - handler: handleFlash From 0628a2149a6bf77a8e2539658c70071f55a41e0e Mon Sep 17 00:00:00 2001 From: Michael Wang <44713145+mzywang@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:52:45 -0400 Subject: [PATCH 5/5] remove pool bind --- src/mappings/core.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/mappings/core.ts b/src/mappings/core.ts index 501926d4..9ddfa92a 100644 --- a/src/mappings/core.ts +++ b/src/mappings/core.ts @@ -407,9 +407,6 @@ export function handleSwap(event: SwapEvent): void { swap.sqrtPriceX96 = event.params.sqrtPriceX96 swap.logIndex = event.logIndex - // update fee growth - let poolContract = PoolABI.bind(event.address) - // interval data let uniswapDayData = updateUniswapDayData(event) let poolDayData = updatePoolDayData(event)