Skip to content

Commit 17b3117

Browse files
authored
add graphene on base fantom and mantle (DefiLlama#9223)
1 parent 1ac03ec commit 17b3117

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

projects/graphene/index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const { getLogs } = require("../helper/cache/getLogs");
2+
const { sumTokens2 } = require("../helper/unwrapLPs");
3+
4+
const config = {
5+
base: {
6+
fromBlock: 5314581,
7+
controller: "0xfbF069Dbbf453C1ab23042083CFa980B3a672BbA",
8+
},
9+
fantom: {
10+
fromBlock: 69969086,
11+
controller: "0xf37102e11E06276ac9D393277BD7b63b3393b361",
12+
},
13+
mantle: {
14+
fromBlock: 18438182,
15+
controller: "0x7900f766F06e361FDDB4FdeBac5b138c4EEd8d4A",
16+
},
17+
};
18+
19+
Object.keys(config).forEach((chain) => {
20+
const { controller, fromBlock } = config[chain];
21+
module.exports[chain] = {
22+
tvl: async (_, _b, _cb, { api }) => {
23+
const logs = await getLogs({
24+
api,
25+
target: controller,
26+
topic: "PairCreated(uint128,address,address)",
27+
eventAbi:
28+
"event PairCreated(uint128 indexed pairId, address indexed token0, address indexed token1)",
29+
onlyArgs: true,
30+
fromBlock,
31+
});
32+
const tokens = logs.map((i) => [i.token0, i.token1]).flat();
33+
34+
return sumTokens2({ api, owner: controller, tokens });
35+
},
36+
};
37+
});

0 commit comments

Comments
 (0)