Skip to content

Commit 19e2d10

Browse files
committed
track halo trade univ3
1 parent 05358f4 commit 19e2d10

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/halotrade-v3/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const { getConfig } = require('../helper/cache')
2+
const { get } = require('../helper/http')
3+
const { sumTokens2 } = require('../helper/unwrapLPs')
4+
5+
module.exports = {
6+
aura: { tvl },
7+
}
8+
9+
async function tvl(api) {
10+
const pools = await getConfig('halo-trade/uni-v3-pools', undefined, {
11+
fetcher: async () => {
12+
let page = 0
13+
let size = 100
14+
let hasMore = true
15+
const pools = []
16+
do {
17+
const { data: { res: { results } } } = await get(`https://api.halotrade.zone/api/v1/evm/univ3/halo-pool/poolList?page=${page}&pageSize=${size}`)
18+
page++
19+
hasMore = results.length === size
20+
pools.push(...results.map(i => i.poolContractAddr))
21+
} while (hasMore)
22+
return pools
23+
}
24+
})
25+
const token0s = await api.multiCall({ abi: 'address:token0', calls: pools })
26+
const token1s = await api.multiCall({ abi: 'address:token1', calls: pools })
27+
const ownerTokens = pools.map((v, i) => [[token0s[i], token1s[i]], v])
28+
return sumTokens2({ api, ownerTokens })
29+
}

projects/helper/tokenMapping.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ const fixBalancesTokens = {
6969
[ADDRESSES.null]: { coingeckoId: "gas", decimals: 18 },
7070
'0x008cd7f573998cb841a5d82a857ed1f0ce03a653': { coingeckoId: "gas", decimals: 18 },
7171
'0xde41591ed1f8ed1484ac2cd8ca0876428de60eff': { coingeckoId: "gas", decimals: 18 },
72-
}
72+
},
73+
aura: {
74+
[ADDRESSES.null]: { coingeckoId: "aura-network", decimals: 18 },
75+
'0xDE47A655a5d9904BD3F7e1A536D8323fBD99993A': { coingeckoId: "aura-network", decimals: 18 },
76+
'0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd': { coingeckoId: "tether", decimals: 6 },
77+
},
7378
}
7479

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

0 commit comments

Comments
 (0)