@@ -3,58 +3,63 @@ const contracts = require("./contracts");
3
3
const { staking } = require ( "../helper/staking" ) ;
4
4
const { getLogs } = require ( "../helper/cache/getLogs" ) ;
5
5
const bridgedAssets = [ ADDRESSES . ethereum . STETH , ADDRESSES . ethereum . EETH ] ;
6
- const { getConfig } = require ( '../helper/cache' )
6
+ const { getConfig } = require ( '../helper/cache' ) ;
7
7
8
8
const config = {
9
9
ethereum : {
10
10
factory : "0x27b1dacd74688af24a64bd3c9c1b143118740784" ,
11
- factoryV3 : "0x1A6fCc85557BC4fB7B534ed835a03EF056552D52" ,
12
- factoryV4 : '0x3d75Bd20C983edb5fD218A1b7e0024F1056c7A2F' ,
13
11
fromBlock : 16032059 ,
14
- fromBlockV3 : 18669498 ,
15
- fromBlockV4 : 20323253
12
+ factories : [
13
+ { factory : "0x1a6fcc85557bc4fb7b534ed835a03ef056552d52" , fromBlock : 18669498 } , // v3
14
+ { factory : "0x3d75bd20c983edb5fd218a1b7e0024f1056c7a2f" , fromBlock : 20323253 } , // v4
15
+ { factory : "0x6fcf753f2c67b83f7b09746bbc4fa0047b35d050" , fromBlock : 20512280 } , // v5
16
+ ] ,
16
17
} ,
17
18
arbitrum : {
18
19
factory : "0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8" ,
19
- factoryV3 : "0x2FCb47B58350cD377f94d3821e7373Df60bD9Ced" ,
20
- factoryV4 : '0xd9f5e9589016da862D2aBcE980A5A5B99A94f3E8' ,
21
20
fromBlock : 62979673 ,
22
- fromBlockV3 : 154873897 ,
23
- fromBlockV4 : 233004891
21
+ factories : [
22
+ { factory : "0x2fcb47b58350cd377f94d3821e7373df60bd9ced" , fromBlock : 154873897 } , // v3
23
+ { factory : "0xd9f5e9589016da862d2abce980a5a5b99a94f3e8" , fromBlock : 233004891 } , // v4
24
+ { factory : "0xd29e76c6f15ada0150d10a1d3f45accd2098283b" , fromBlock : 242035998 } , // v5
25
+ ] ,
24
26
} ,
25
27
bsc : {
26
- factory : "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E" ,
27
- factoryV3 : "0xC40fEbF5A33b8C92B187d9be0fD3fe0ac2E4B07c" ,
28
- factoryV4 : '0x7D20e644D2A9e149e5be9bE9aD2aB243a7835d37' ,
28
+ factory : "0x2bea6bfd8fbff45aa2a893eb3b6d85d10efcc70e" ,
29
29
fromBlock : 34060741 ,
30
- fromBlockV3 : 33884419 ,
31
- fromBlockV4 : 40539593 ,
30
+ factories : [
31
+ { factory : "0xc40febf5a33b8c92b187d9be0fd3fe0ac2e4b07c" , fromBlock : 33884419 } , // v3
32
+ { factory : "0x7d20e644d2a9e149e5be9be9ad2ab243a7835d37" , fromBlock : 40539593 } , // v4
33
+ { factory : "0x7c7f73f7a320364dbb3c9aaa9bccd402040ee0f9" , fromBlock : 41294178 } , // v5
34
+ ] ,
32
35
pts : [
33
- "0x5eC2ae0AFDEc891E7702344dc2A31C636B3627Eb " ,
34
- "0x70c1138B54ba212776d3A9d29b6160C54C31cd5d " ,
35
- "0x04eb6B56ff53f457c8E857ca8D4fbC8d9a531c0C " ,
36
+ "0x5ec2ae0afdec891e7702344dc2a31c636b3627eb " ,
37
+ "0x70c1138b54ba212776d3a9d29b6160c54c31cd5d " ,
38
+ "0x04eb6b56ff53f457c8e857ca8d4fbc8d9a531c0c " ,
36
39
] ,
37
40
} ,
38
41
optimism : {
39
- factory : "0x17F100fB4bE2707675c6439468d38249DD993d58" ,
40
- factoryV3 : "0x4A2B38b9cBd83c86F261a4d64c243795D4d44aBC" ,
41
- factoryV4 : '0x73Be47237F12F36203823BAc9A4d80dC798B7015' ,
42
+ factory : "0x17f100fb4be2707675c6439468d38249dd993d58" ,
42
43
fromBlock : 108061448 ,
43
- fromBlockV3 : 112783590 ,
44
- fromBlockV4 : 122792017
44
+ factories : [
45
+ { factory : "0x4a2b38b9cbd83c86f261a4d64c243795d4d44abc" , fromBlock : 112783590 } , // v3
46
+ { factory : "0x73be47237f12f36203823bac9a4d80dc798b7015" , fromBlock : 122792017 } , // v4
47
+ { factory : "0x02adf72d5d06a9c92136562eb237c07696833a84" , fromBlock : 123998311 } , // v5
48
+ ] ,
45
49
} ,
46
50
mantle : {
47
- factoryV3 : "0xD228EC1f7D4313fe321fab511A872475D07F5bA6" ,
48
- factoryV4 : '0xCa274A44a52241c1a8EFb9f84Bf492D8363929FC' ,
49
- fromBlockV3 : 61484384 ,
50
- fromBlockV4 : 66526601
51
+ factories : [
52
+ { factory : "0xd228ec1f7d4313fe321fab511a872475d07f5ba6" , fromBlock : 61484384 } , // v3
53
+ { factory : "0xca274a44a52241c1a8efb9f84bf492d8363929fc" , fromBlock : 66526601 } , // v4
54
+ { factory : "0xcb02435716b0143d4ac1bdf370302d619e714126" , fromBlock : 67661738 } , // v5
55
+ ] ,
51
56
} ,
52
57
} ;
53
58
54
59
module . exports = { } ;
55
60
56
61
Object . keys ( config ) . forEach ( ( chain ) => {
57
- const { factory, factoryV3 , factoryV4 , fromBlock, pts, fromBlockV3 , fromBlockV4 } = config [ chain ] ;
62
+ const { factory, fromBlock, pts, factories , } = config [ chain ] ;
58
63
module . exports [ chain ] = {
59
64
tvl : async ( api ) => {
60
65
const logs = factory
@@ -70,36 +75,20 @@ Object.keys(config).forEach((chain) => {
70
75
fromBlock,
71
76
} )
72
77
: [ ] ;
78
+ for ( let { factory, fromBlock } of factories ) {
79
+ logs . push (
80
+ ...( await getLogs ( {
81
+ api,
82
+ target : factory ,
83
+ eventAbi :
84
+ "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)" ,
85
+ onlyArgs : true ,
86
+ fromBlock,
87
+ } ) )
88
+ ) ;
89
+ }
73
90
74
- const logsV3 = factoryV3
75
- ? await getLogs ( {
76
- api,
77
- target : factoryV3 ,
78
- topic : [
79
- "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af" ,
80
- ] ,
81
- eventAbi :
82
- "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)" ,
83
- onlyArgs : true ,
84
- fromBlock : fromBlockV3 ,
85
- } )
86
- : [ ] ;
87
-
88
- const logsV4 = factoryV4
89
- ? await getLogs ( {
90
- api,
91
- target : factoryV4 ,
92
- topic : [
93
- "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af" ,
94
- ] ,
95
- eventAbi :
96
- "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)" ,
97
- onlyArgs : true ,
98
- fromBlock : fromBlockV4 ,
99
- } )
100
- : [ ] ;
101
-
102
- const pt = logs . map ( ( i ) => i . PT ) . concat ( logsV3 . map ( ( i ) => i . PT ) ) . concat ( logsV4 . map ( ( i ) => i . PT ) ) ;
91
+ const pt = logs . map ( ( i ) => i . PT ) ;
103
92
if ( pts ) pt . push ( ...pts ) ;
104
93
let sy = [
105
94
...new Set (
0 commit comments