File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
projects/dragonswap-sei-v3 Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments