1
1
const ADDRESSES = require ( '../helper/coreAssets.json' )
2
2
const { request, } = require ( "graphql-request" )
3
- const { getLogs } = require ( '../helper/cache/getLogs' )
3
+ // const { getLogs } = require('../helper/cache/getLogs')
4
4
5
- const graphUrl =
6
- "https://api.studio.thegraph.com/query/67212/spacebar/version/latest"
5
+ const graphUrl = "https://api.studio.thegraph.com/query/67212/spacebar/version/latest"
7
6
8
7
const tvlQuery = `
9
8
{
@@ -13,24 +12,23 @@ const tvlQuery = `
13
12
}
14
13
`
15
14
16
- // async function tvl() {
17
- // const response = await request(graphUrl, tvlQuery)
18
- // const tvlAmount = response.totalValueLocked.amount
19
- // return {
20
- // ["blast:" + ADDRESSES.null]:
21
- // tvlAmount.toString(),
22
- // }
23
- // }
24
-
25
- async function tvl ( api ) {
26
- const registry = '0xE1784da2b8F42C31Fb729E870A4A8064703555c2'
27
- const fromBlock = 203239
28
- const unStakeLogs = await getLogs ( { api, target : registry , eventAbi : 'event Unstake(address indexed service, address indexed user, address indexed to, uint256 amount)' , onlyArgs : true , fromBlock, extraKey : 'unstake' , } )
29
- const stakeLogs = await getLogs ( { api, target : registry , eventAbi : 'event Stake(address indexed service, address indexed user, uint256 amount)' , onlyArgs : true , fromBlock, extraKey : 'stake' , } )
30
- stakeLogs . forEach ( log => api . addGasToken ( log . amount ) )
31
- unStakeLogs . forEach ( log => api . addGasToken ( Number ( log . amount ) * - 1 ) )
15
+ async function tvl ( ) {
16
+ const response = await request ( graphUrl , tvlQuery )
17
+ const tvlAmount = response . totalValueLocked . amount
18
+ return {
19
+ [ "blast:" + ADDRESSES . null ] : tvlAmount . toString ( ) ,
20
+ }
32
21
}
33
22
23
+ // async function tvl(api) {
24
+ // const registry = '0xE1784da2b8F42C31Fb729E870A4A8064703555c2'
25
+ // const fromBlock = 203239
26
+ // const unStakeLogs = await getLogs({ api, target: registry, eventAbi: 'event Unstake(address indexed service, address indexed user, address indexed to, uint256 amount)', onlyArgs: true, fromBlock, extraKey: 'unstake',})
27
+ // const stakeLogs = await getLogs({ api, target: registry, eventAbi: 'event Stake(address indexed service, address indexed user, uint256 amount)', onlyArgs: true, fromBlock, extraKey: 'stake',})
28
+ // stakeLogs.forEach(log => api.addGasToken(log.amount))
29
+ // unStakeLogs.forEach(log => api.addGasToken(Number(log.amount) * -1))
30
+ // }
31
+
34
32
module . exports = {
35
33
blast : {
36
34
tvl,
0 commit comments