File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ const { getLogs } = require ( "../helper/cache/getLogs" ) ;
2
+ const { sumTokens2 } = require ( "../helper/unwrapLPs" ) ;
3
+
4
+ const config = {
5
+ base : {
6
+ fromBlock : 5314581 ,
7
+ controller : "0xfbF069Dbbf453C1ab23042083CFa980B3a672BbA" ,
8
+ } ,
9
+ fantom : {
10
+ fromBlock : 69969086 ,
11
+ controller : "0xf37102e11E06276ac9D393277BD7b63b3393b361" ,
12
+ } ,
13
+ mantle : {
14
+ fromBlock : 18438182 ,
15
+ controller : "0x7900f766F06e361FDDB4FdeBac5b138c4EEd8d4A" ,
16
+ } ,
17
+ } ;
18
+
19
+ Object . keys ( config ) . forEach ( ( chain ) => {
20
+ const { controller, fromBlock } = config [ chain ] ;
21
+ module . exports [ chain ] = {
22
+ tvl : async ( _ , _b , _cb , { api } ) => {
23
+ const logs = await getLogs ( {
24
+ api,
25
+ target : controller ,
26
+ topic : "PairCreated(uint128,address,address)" ,
27
+ eventAbi :
28
+ "event PairCreated(uint128 indexed pairId, address indexed token0, address indexed token1)" ,
29
+ onlyArgs : true ,
30
+ fromBlock,
31
+ } ) ;
32
+ const tokens = logs . map ( ( i ) => [ i . token0 , i . token1 ] ) . flat ( ) ;
33
+
34
+ return sumTokens2 ( { api, owner : controller , tokens } ) ;
35
+ } ,
36
+ } ;
37
+ } ) ;
You can’t perform that action at this time.
0 commit comments