Skip to content

Commit 04909bf

Browse files
authored
temp: use tvl from subgraph (#15577)
1 parent 100d150 commit 04909bf

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

projects/spacebar/index.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
const ADDRESSES = require('../helper/coreAssets.json')
22
const { request, } = require("graphql-request")
3-
const { getLogs } = require('../helper/cache/getLogs')
3+
// const { getLogs } = require('../helper/cache/getLogs')
44

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"
76

87
const tvlQuery = `
98
{
@@ -13,24 +12,23 @@ const tvlQuery = `
1312
}
1413
`
1514

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+
}
3221
}
3322

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+
3432
module.exports = {
3533
blast: {
3634
tvl,

0 commit comments

Comments
 (0)