Skip to content

Commit 21c57dd

Browse files
committed
1 parent fce850a commit 21c57dd

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

projects/intentx.js

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

4-
const graphUrl =
5-
"https://api.studio.thegraph.com/query/62472/intentx-analytics_082/version/latest";
6-
74
const BETA_START = 1700006400; // 2023-11-15T00:00:00+00:00
85

96
const query = gql`
@@ -25,31 +22,32 @@ const query = gql`
2522
}
2623
`;
2724

25+
const config = {
26+
blast: { token: ADDRESSES.blast.USDB, graphUrl: "https://api.studio.thegraph.com/query/62472/intentx-analytics_082_blast/version/latest", },
27+
base: { token: ADDRESSES.base.USDbC, graphUrl: "https://api.studio.thegraph.com/query/62472/intentx-analytics_082/version/latest", },
28+
}
2829

29-
async function getTVL(toTimestamp) {
30+
async function getTVL(api) {
31+
const { token, graphUrl } = config[api.chain];
3032
const { dailyHistories } = await request(graphUrl, query, {
3133
from: BETA_START.toString(),
32-
to: toTimestamp.toString(),
34+
to: api.timestamp.toString(),
3335
});
3436

35-
const total = dailyHistories.reduce(
36-
(acc, cur) => acc + (Number(cur.deposit) - Number(cur.withdraw)),
37-
0
38-
);
39-
40-
return {
41-
["base:" + ADDRESSES.base.USDbC]: total,
42-
};
37+
const total = dailyHistories.reduce((acc, cur) => acc + (Number(cur.deposit) - Number(cur.withdraw)), 0);
38+
api.add(token, total)
4339
}
4440

4541
module.exports = {
4642
timetravel: false,
4743
start: BETA_START,
48-
base: {
49-
tvl: async ({ timestamp }) => {
50-
return getTVL(timestamp);
51-
},
52-
},
53-
hallmarks: [[1700006400, "Open Beta Start"], [1704200400, "0.8.2 Migration"]],
44+
};
5445

46+
47+
module.exports = {
48+
timetravel: false,
49+
start: BETA_START,
50+
blast: { tvl: getTVL },
51+
base: { tvl: getTVL },
52+
hallmarks: [[1700006400, "Open Beta Start"], [1704200400, "0.8.2 Migration"]],
5553
};

0 commit comments

Comments
 (0)