File tree Expand file tree Collapse file tree 2 files changed +65
-4
lines changed Expand file tree Collapse file tree 2 files changed +65
-4
lines changed Original file line number Diff line number Diff line change 1
1
const { staking } = require ( "../helper/staking" ) ;
2
2
const { gmxExports } = require ( "../helper/gmx" ) ;
3
- const sdk = require ( '@defillama/sdk' )
4
3
5
- const vaultAddress = "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C" ;
4
+ const vaultAddresses = {
5
+ base : "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C" ,
6
+ mode : "0xff745bdB76AfCBa9d3ACdCd71664D4250Ef1ae49"
7
+ } ;
8
+ const stakingAddresses = {
9
+ base : "0x3085F25Cbb5F34531229077BAAC20B9ef2AE85CB" ,
10
+ mode : "0x773F34397d5F378D993F498Ee646FFe4184E00A3"
11
+ } ;
12
+ const tokenAddresses = {
13
+ base : "0x548f93779fBC992010C07467cBaf329DD5F059B7" ,
14
+ mode : "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"
15
+ } ;
6
16
7
17
module . exports = {
8
- methodology : "BMX liquidity is calculated by the value of tokens in the BLT pool." ,
18
+ methodology : "BMX Classic liquidity is calculated by the value of tokens in the BLT/MLT pool. TVL also includes BMX staked ." ,
9
19
base : {
10
- tvl : gmxExports ( { vault : vaultAddress } )
20
+ tvl : gmxExports ( { vault : vaultAddresses . base } ) ,
21
+ staking : staking ( stakingAddresses . base , tokenAddresses . base )
11
22
} ,
23
+ mode : {
24
+ tvl : gmxExports ( { vault : vaultAddresses . mode } ) ,
25
+ staking : staking ( stakingAddresses . mode , tokenAddresses . mode )
26
+ }
12
27
} ;
Original file line number Diff line number Diff line change
1
+ const ADDRESSES = require ( '../helper/coreAssets.json' )
2
+ const { request, } = require ( "graphql-request" ) ;
3
+
4
+ const freestyleConfig = {
5
+ base : {
6
+ token : ADDRESSES . base . USDC ,
7
+ start : 1700006400 ,
8
+ graphUrl : "https://api.studio.thegraph.com/query/62454/analytics_base_8_2/version/latest" ,
9
+ accountSource : '0x6D63921D8203044f6AbaD8F346d3AEa9A2719dDD'
10
+ } ,
11
+ }
12
+
13
+ async function tvl ( api ) {
14
+ const { token, graphUrl, start, accountSource } = freestyleConfig [ api . chain ]
15
+
16
+ const query = `
17
+ query stats($from: String!, $to: String!) {
18
+ dailyHistories(
19
+ where: {
20
+ timestamp_gte: $from
21
+ timestamp_lte: $to
22
+ accountSource: "${ accountSource } "
23
+ }
24
+ ) {
25
+ timestamp
26
+ platformFee
27
+ accountSource
28
+ tradeVolume
29
+ deposit
30
+ withdraw
31
+ }
32
+ }
33
+ `
34
+ const { dailyHistories } = await request ( graphUrl , query , {
35
+ from : start . toString ( ) ,
36
+ to : api . timestamp . toString ( ) ,
37
+ } ) ;
38
+
39
+ let total = dailyHistories . reduce ( ( acc , cur ) => acc + ( Number ( cur . deposit ) - Number ( cur . withdraw ) ) , 0 ) ;
40
+
41
+ api . add ( token , total )
42
+ }
43
+
44
+ Object . keys ( freestyleConfig ) . forEach ( chain => {
45
+ module . exports [ chain ] = { tvl }
46
+ } )
You can’t perform that action at this time.
0 commit comments