Skip to content

Commit a5dc6cc

Browse files
committed
track dragonswap v3
1 parent 19e2d10 commit a5dc6cc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

projects/dragonswap-sei-v3/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const { getConfig } = require('../helper/cache')
2+
const { get } = require('../helper/http')
3+
const { sumTokens2 } = require('../helper/unwrapLPs')
4+
5+
module.exports = {
6+
sei: { tvl },
7+
}
8+
9+
async function tvl(api) {
10+
const pools = await getConfig('dragonswap/uni-v3-pools', undefined, {
11+
fetcher: async () => {
12+
let { pools } = await get(`https://sei-api.dragonswap.app/api/v1/pools`)
13+
pools = pools.filter(i => i.type === 'V3_POOL').map(i => i.pool_address)
14+
return pools
15+
}
16+
})
17+
const token0s = await api.multiCall({ abi: 'address:token0', calls: pools })
18+
const token1s = await api.multiCall({ abi: 'address:token1', calls: pools })
19+
const ownerTokens = pools.map((v, i) => [[token0s[i], token1s[i]], v])
20+
return sumTokens2({ api, ownerTokens })
21+
}

0 commit comments

Comments
 (0)