@@ -2,6 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json')
2
2
const { staking } = require ( "../helper/staking" ) ;
3
3
const { gmxExports } = require ( "../helper/gmx" ) ;
4
4
const { sumTokens2 } = require ( "../helper/unwrapLPs" ) ;
5
+ const { getLogs2} = require ( "../helper/cache/getLogs" ) ;
5
6
6
7
// sonic
7
8
const sonicVault = "0xe9263682E837eFabb145f8C632B9d2c518D90652" ;
@@ -10,17 +11,24 @@ const sonicNAVI = "0x6881B80ea7C858E4aEEf63893e18a8A36f3682f3";
10
11
11
12
// sonicV2
12
13
const sonicV2Vault = "0x41cD8CaFc24A771031B9eB9C57cFC94D86045eB6" ;
13
- const sonicV2Assets = [ ADDRESSES . sonic . USDC_e ]
14
+ const sonicV2SettingManager = "0x7b9e962dd8AeD0Db9A1D8a2D7A962ad8b871Ce4F" ;
14
15
15
16
const tvl = async ( api ) => {
16
- await Promise . all ( [
17
- gmxExports ( { vault : sonicVault } ) ( api ) ,
18
- sumTokens2 ( { api, tokens : sonicV2Assets , owner : sonicV2Vault } ) ] )
17
+ const logs = await getLogs2 ( {
18
+ api,
19
+ target : sonicV2SettingManager ,
20
+ eventAbi : 'event SetEnableStaking(address indexed token, bool isEnabled)' ,
21
+ fromBlock : 655713 ,
22
+ } )
23
+ const sonicV2Assets = logs . map ( i => i . token )
24
+ await Promise . all ( [
25
+ gmxExports ( { vault : sonicVault } ) ( api ) ,
26
+ sumTokens2 ( { api, tokens : sonicV2Assets , owner : sonicV2Vault } ) ] )
19
27
} ;
20
28
21
29
module . exports = {
22
- sonic : {
23
- tvl,
24
- staking : staking ( sonicStaking , sonicNAVI )
25
- }
30
+ sonic : {
31
+ tvl,
32
+ staking : staking ( sonicStaking , sonicNAVI )
33
+ }
26
34
}
0 commit comments