Skip to content

Commit 5bd2b11

Browse files
committed
1 parent a811787 commit 5bd2b11

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

projects/diamondswap/index.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const { uniTvlExports } = require('../helper/unknownTokens')
2+
const { getLogs, getAddress } = require('../helper/cache/getLogs')
3+
const { sumTokens2 } = require('../helper/unwrapLPs')
4+
5+
module.exports = uniTvlExports({
6+
odyssey: '0x7d57C45dC107497C5c5c0F544a84691D2b06BC83',
7+
base: '0xdc93aca9bf72ceb35d1f2cd305bd8335b5b88757',
8+
avax: '0x7ab5ac142799b0a3b6f95c27a1f2149ebcf5287d',
9+
})
10+
11+
12+
async function tvl(api) {
13+
const { factories } = config[api.chain]
14+
const ownerTokens = []
15+
16+
for (const { factory, fromBlock } of factories) {
17+
const logs = await getLogs({
18+
api,
19+
target: factory,
20+
topics: ['0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9'],
21+
fromBlock,
22+
})
23+
const pools = logs.map(i => getAddress(i.data.slice(0, 64 + 2)))
24+
const token0s = await api.multiCall({ abi: 'address:token0', calls: pools })
25+
const token1s = await api.multiCall({ abi: 'address:token1', calls: pools })
26+
pools.map((pool, i) => ownerTokens.push([[token0s[i], token1s[i]], pool]))
27+
}
28+
return sumTokens2({ api, ownerTokens })
29+
}
30+
31+
const config = {
32+
ethereum: { factories: [{ factory: '0xE1046fcB1057ef82B68f3A6B8eBb0e411Cf334E0', fromBlock: 18024947, },], },
33+
bsc: {
34+
factories: [{
35+
factory: '0x81a1417cbec636e631fa62b81f970a5ec23b39ca', fromBlock:
36+
32062831,
37+
},],
38+
},
39+
}
40+
41+
Object.keys(config).forEach(chain => {
42+
module.exports[chain] = { tvl }
43+
})

projects/helper/chains.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@
239239
"oas",
240240
"oasis",
241241
"obyte",
242+
"odyssey",
242243
"okexchain",
243244
"omax",
244245
"ontology",

projects/helper/env.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const DEFAULTS = {
2323
SOPHON_RPC_MULTICALL: "0x5f4867441d2416cA88B1b3fd38f21811680CD2C8",
2424
VANA_RPC_MULTICALL: "0xFe92b91F3326e58557478c28EeAe1936E0c7148a",
2525
FILECOIN_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11",
26+
ODYSSEY_RPC_MULTICALL: "0xD5F04861e1249F488ef8898607cF7ad0F334d823",
2627
}
2728

2829
const ENV_KEYS = [

projects/helper/tokenMapping.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ const fixBalancesTokens = {
8282
wc: {
8383
[ADDRESSES.null]: { coingeckoId: 'ethereum', decimals: 18 },
8484
},
85+
odyssey: {
86+
[ADDRESSES.null]: { coingeckoId: 'dione', decimals: 18 },
87+
'0xf21cbaf7bd040d686bd390957770d2ea652e4013': { coingeckoId: 'dione', decimals: 18 },
88+
}
8589
}
8690

8791
ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) })

0 commit comments

Comments
 (0)