@@ -43,10 +43,6 @@ function getPosition(event: ethereum.Event, tokenId: BigInt): Position | null {
43
43
position . transaction = loadTransaction ( event ) . id
44
44
position . feeGrowthInside0LastX128 = positionResult . value8
45
45
position . feeGrowthInside1LastX128 = positionResult . value9
46
-
47
- position . amountDepositedUSD = ZERO_BD
48
- position . amountWithdrawnUSD = ZERO_BD
49
- position . amountCollectedUSD = ZERO_BD
50
46
}
51
47
}
52
48
@@ -84,6 +80,11 @@ function savePositionSnapshot(position: Position, event: ethereum.Event): void {
84
80
}
85
81
86
82
export function handleIncreaseLiquidity ( event : IncreaseLiquidity ) : void {
83
+ // temp fix
84
+ if ( event . block . number . equals ( BigInt . fromI32 ( 14317993 ) ) ) {
85
+ return
86
+ }
87
+
87
88
let position = getPosition ( event , event . params . tokenId )
88
89
89
90
// position was not able to be fetched
@@ -95,7 +96,6 @@ export function handleIncreaseLiquidity(event: IncreaseLiquidity): void {
95
96
if ( Address . fromString ( position . pool ) . equals ( Address . fromHexString ( '0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248' ) ) ) {
96
97
return
97
98
}
98
- let bundle = Bundle . load ( '1' )
99
99
100
100
let token0 = Token . load ( position . token0 )
101
101
let token1 = Token . load ( position . token1 )
@@ -107,11 +107,6 @@ export function handleIncreaseLiquidity(event: IncreaseLiquidity): void {
107
107
position . depositedToken0 = position . depositedToken0 . plus ( amount0 )
108
108
position . depositedToken1 = position . depositedToken1 . plus ( amount1 )
109
109
110
- let newDepositUSD = amount0
111
- . times ( token0 . derivedETH . times ( bundle . ethPriceUSD ) )
112
- . plus ( amount1 . times ( token1 . derivedETH . times ( bundle . ethPriceUSD ) ) )
113
- position . amountDepositedUSD = position . amountDepositedUSD . plus ( newDepositUSD )
114
-
115
110
updateFeeVars ( position ! , event , event . params . tokenId )
116
111
117
112
position . save ( )
@@ -120,6 +115,11 @@ export function handleIncreaseLiquidity(event: IncreaseLiquidity): void {
120
115
}
121
116
122
117
export function handleDecreaseLiquidity ( event : DecreaseLiquidity ) : void {
118
+ // temp fix
119
+ if ( event . block . number == BigInt . fromI32 ( 14317993 ) ) {
120
+ return
121
+ }
122
+
123
123
let position = getPosition ( event , event . params . tokenId )
124
124
125
125
// position was not able to be fetched
@@ -132,7 +132,6 @@ export function handleDecreaseLiquidity(event: DecreaseLiquidity): void {
132
132
return
133
133
}
134
134
135
- let bundle = Bundle . load ( '1' )
136
135
let token0 = Token . load ( position . token0 )
137
136
let token1 = Token . load ( position . token1 )
138
137
let amount0 = convertTokenToDecimal ( event . params . amount0 , token0 . decimals )
@@ -142,11 +141,6 @@ export function handleDecreaseLiquidity(event: DecreaseLiquidity): void {
142
141
position . withdrawnToken0 = position . withdrawnToken0 . plus ( amount0 )
143
142
position . withdrawnToken1 = position . withdrawnToken1 . plus ( amount1 )
144
143
145
- let newWithdrawUSD = amount0
146
- . times ( token0 . derivedETH . times ( bundle . ethPriceUSD ) )
147
- . plus ( amount1 . times ( token1 . derivedETH . times ( bundle . ethPriceUSD ) ) )
148
- position . amountWithdrawnUSD = position . amountWithdrawnUSD . plus ( newWithdrawUSD )
149
-
150
144
position = updateFeeVars ( position ! , event , event . params . tokenId )
151
145
position . save ( )
152
146
savePositionSnapshot ( position ! , event )
@@ -162,23 +156,10 @@ export function handleCollect(event: Collect): void {
162
156
return
163
157
}
164
158
165
-
166
- let bundle = Bundle . load ( '1' )
167
159
let token0 = Token . load ( position . token0 )
168
- let token1 = Token . load ( position . token1 )
169
160
let amount0 = convertTokenToDecimal ( event . params . amount0 , token0 . decimals )
170
- let amount1 = convertTokenToDecimal ( event . params . amount1 , token1 . decimals )
171
- position . collectedToken0 = position . collectedToken0 . plus ( amount0 )
172
- position . collectedToken1 = position . collectedToken1 . plus ( amount1 )
173
-
174
- position . collectedFeesToken0 = position . collectedToken0 . minus ( position . withdrawnToken0 )
175
- position . collectedFeesToken1 = position . collectedToken1 . minus ( position . withdrawnToken1 )
176
-
177
- let newCollectUSD = amount0
178
- . times ( token0 . derivedETH . times ( bundle . ethPriceUSD ) )
179
- . plus ( amount1 . times ( token1 . derivedETH . times ( bundle . ethPriceUSD ) ) )
180
- position . amountCollectedUSD = position . amountCollectedUSD . plus ( newCollectUSD )
181
-
161
+ position . collectedFeesToken0 = position . collectedFeesToken0 . plus ( amount0 )
162
+ position . collectedFeesToken1 = position . collectedFeesToken1 . plus ( amount0 )
182
163
183
164
position = updateFeeVars ( position ! , event , event . params . tokenId )
184
165
position . save ( )
0 commit comments