Skip to content

Commit

Permalink
remove fee growth
Browse files Browse the repository at this point in the history
  • Loading branch information
mzywang committed Mar 27, 2024
1 parent 8bce6ea commit 7c19c11
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 40 deletions.
2 changes: 1 addition & 1 deletion abis/pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -985,4 +985,4 @@
"stateMutability": "view",
"type": "function"
}
]
]
12 changes: 0 additions & 12 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions src/mappings/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
}
2 changes: 0 additions & 2 deletions src/mappings/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions src/utils/intervalUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7c19c11

Please sign in to comment.