@@ -125,7 +125,7 @@ GoldRushDecoder.on(
125
125
const { raw_log_data, raw_log_topics } = log_event ;
126
126
127
127
const { args : decoded } = decodeEventLog ( {
128
- abi : FactoryABI ,
128
+ abi : PairABI ,
129
129
topics : raw_log_topics as [ ] ,
130
130
data : raw_log_data as `0x${string } `,
131
131
eventName : "Burn" ,
@@ -186,3 +186,225 @@ GoldRushDecoder.on(
186
186
} ;
187
187
}
188
188
) ;
189
+
190
+ GoldRushDecoder . on (
191
+ "uniswap-v3:Mint" ,
192
+ [ "eth-mainnet" ] ,
193
+ PairABI as Abi ,
194
+ async ( log_event , tx , chain_name , covalent_client ) : Promise < EventType > => {
195
+ const { raw_log_data, raw_log_topics } = log_event ;
196
+
197
+ const { args : decoded } = decodeEventLog ( {
198
+ abi : PairABI ,
199
+ topics : raw_log_topics as [ ] ,
200
+ data : raw_log_data as `0x${string } `,
201
+ eventName : "Mint" ,
202
+ } ) as {
203
+ eventName : "Mint" ;
204
+ args : {
205
+ sender : string ;
206
+ owner : string ;
207
+ tickLower : bigint ;
208
+ tickUpper : bigint ;
209
+ amount : bigint ;
210
+ amount0 : bigint ;
211
+ amount1 : bigint ;
212
+ } ;
213
+ } ;
214
+
215
+ const details : EventDetails = [
216
+ {
217
+ heading : "sender" ,
218
+ value : decoded . sender ,
219
+ type : "address"
220
+ } ,
221
+ {
222
+ heading : "owner" ,
223
+ value : decoded . owner ,
224
+ type : "address"
225
+ } ,
226
+ {
227
+ heading : "tickLower" ,
228
+ value : decoded . tickLower . toString ( ) ,
229
+ type : "text"
230
+ } ,
231
+ {
232
+ heading : "tickUpper" ,
233
+ value : decoded . tickUpper . toString ( ) ,
234
+ type : "text"
235
+ } ,
236
+ {
237
+ heading : "amount" ,
238
+ value : decoded . amount . toString ( ) ,
239
+ type : "text"
240
+ } ,
241
+ {
242
+ heading : "amount0" ,
243
+ value : decoded . amount0 . toString ( ) ,
244
+ type : "text"
245
+ } ,
246
+ {
247
+ heading : "amount1" ,
248
+ value : decoded . amount1 . toString ( ) ,
249
+ type : "text"
250
+ } ,
251
+ ] ;
252
+
253
+ return {
254
+ action : DECODED_ACTION . SWAPPED ,
255
+ category : DECODED_EVENT_CATEGORY . DEX ,
256
+ name : "Mint" ,
257
+ protocol : {
258
+ logo : log_event . sender_logo_url as string ,
259
+ name : "Uniswap V3" ,
260
+ } ,
261
+ details,
262
+ } ;
263
+ }
264
+ ) ;
265
+
266
+ GoldRushDecoder . on (
267
+ "uniswap-v3:Swap" ,
268
+ [ "eth-mainnet" ] ,
269
+ PairABI as Abi ,
270
+ async ( log_event , tx , chain_name , covalent_client ) : Promise < EventType > => {
271
+ const { raw_log_data, raw_log_topics } = log_event ;
272
+
273
+ const { args : decoded } = decodeEventLog ( {
274
+ abi : PairABI ,
275
+ topics : raw_log_topics as [ ] ,
276
+ data : raw_log_data as `0x${string } `,
277
+ eventName : "Swap" ,
278
+ } ) as {
279
+ eventName : "Swap" ;
280
+ args : {
281
+ sender : string ;
282
+ recipient : string ;
283
+ amount0 : bigint ;
284
+ amount1 : bigint ;
285
+ sqrtPriceX96 : bigint ;
286
+ liquidity : bigint ;
287
+ tick : bigint ;
288
+ } ;
289
+ } ;
290
+
291
+ const details : EventDetails = [
292
+ {
293
+ heading : "sender" ,
294
+ value : decoded . sender ,
295
+ type : "address"
296
+ } ,
297
+ {
298
+ heading : "recipient" ,
299
+ value : decoded . recipient ,
300
+ type : "address"
301
+ } ,
302
+ {
303
+ heading : "amount0" ,
304
+ value : decoded . amount0 . toString ( ) ,
305
+ type : "text"
306
+ } ,
307
+ {
308
+ heading : "amount1" ,
309
+ value : decoded . amount1 . toString ( ) ,
310
+ type : "text"
311
+ } ,
312
+ {
313
+ heading : "sqrtPriceX96" ,
314
+ value : decoded . sqrtPriceX96 . toString ( ) ,
315
+ type : "text"
316
+ } ,
317
+ {
318
+ heading : "liquidity" ,
319
+ value : decoded . liquidity . toString ( ) ,
320
+ type : "text"
321
+ } ,
322
+ {
323
+ heading : "tick" ,
324
+ value : decoded . tick . toString ( ) ,
325
+ type : "text"
326
+ } ,
327
+ ] ;
328
+
329
+ return {
330
+ action : DECODED_ACTION . SWAPPED ,
331
+ category : DECODED_EVENT_CATEGORY . DEX ,
332
+ name : "Swap" ,
333
+ protocol : {
334
+ logo : log_event . sender_logo_url as string ,
335
+ name : "Uniswap V3" ,
336
+ } ,
337
+ details,
338
+ } ;
339
+ }
340
+ ) ;
341
+
342
+ GoldRushDecoder . on (
343
+ "uniswap-v3:Collect" ,
344
+ [ "eth-mainnet" ] ,
345
+ PairABI as Abi ,
346
+ async ( log_event , tx , chain_name , covalent_client ) : Promise < EventType > => {
347
+ const { raw_log_data, raw_log_topics } = log_event ;
348
+
349
+ const { args : decoded } = decodeEventLog ( {
350
+ abi : PairABI ,
351
+ topics : raw_log_topics as [ ] ,
352
+ data : raw_log_data as `0x${string } `,
353
+ eventName : "Collect" ,
354
+ } ) as {
355
+ eventName : "Collect" ;
356
+ args : {
357
+ owner : string ;
358
+ recipient : string ;
359
+ tickLower : bigint ;
360
+ tickUpper : bigint ;
361
+ amount0 : bigint ;
362
+ amount1 : bigint ;
363
+ } ;
364
+ } ;
365
+
366
+ const details : EventDetails = [
367
+ {
368
+ heading : "owner" ,
369
+ value : decoded . owner ,
370
+ type : "address"
371
+ } ,
372
+ {
373
+ heading : "recipient" ,
374
+ value : decoded . recipient ,
375
+ type : "address"
376
+ } ,
377
+ {
378
+ heading : "tickLower" ,
379
+ value : decoded . tickLower . toString ( ) ,
380
+ type : "text"
381
+ } ,
382
+ {
383
+ heading : "tickUpper" ,
384
+ value : decoded . tickUpper . toString ( ) ,
385
+ type : "text"
386
+ } ,
387
+ {
388
+ heading : "amount0" ,
389
+ value : decoded . amount0 . toString ( ) ,
390
+ type : "text"
391
+ } ,
392
+ {
393
+ heading : "amount1" ,
394
+ value : decoded . amount1 . toString ( ) ,
395
+ type : "text"
396
+ } ,
397
+ ] ;
398
+
399
+ return {
400
+ action : DECODED_ACTION . SWAPPED ,
401
+ category : DECODED_EVENT_CATEGORY . DEX ,
402
+ name : "Collect Fees" ,
403
+ protocol : {
404
+ logo : log_event . sender_logo_url as string ,
405
+ name : "Uniswap V3" ,
406
+ } ,
407
+ details,
408
+ } ;
409
+ }
410
+ ) ;
0 commit comments