File tree Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Original file line number Diff line number Diff line change 1
1
2
2
const { get } = require ( '../helper/http' )
3
- const { toUSDTBalances } = require ( '../helper/balances' )
4
- const { PromisePool } = require ( '@supercharge/promise-pool' )
5
3
6
4
module . exports = {
7
5
misrepresentedTokens : true ,
8
6
icp : { tvl } ,
9
7
}
10
8
11
- async function tvl ( ) {
12
- let tvl = 0
13
- let pairs = await get ( 'https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pairs' )
14
- if ( typeof pairs === 'string' ) pairs = JSON . parse ( pairs . replace ( '},]' , '}]' ) )
15
-
16
- const { errors } = await PromisePool . withConcurrency ( 15 )
17
- . for ( pairs )
18
- . process ( async ( { pool_id } ) => {
19
- const res = await get ( `https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pool_tvl?poolId=${ pool_id } &limit=1` )
20
- if ( res . length > 0 && res [ 0 ] . tvlUSD < 100e6 )
21
- tvl += + res [ 0 ] . tvlUSD
22
- } )
23
-
24
- if ( errors && errors . length )
25
- throw errors [ 0 ]
26
-
27
- return toUSDTBalances ( tvl )
9
+ async function tvl ( api ) {
10
+ let { tvlUSD } = await get ( 'https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/overview' )
11
+ api . addCGToken ( 'tether' , Math . round ( tvlUSD ) )
28
12
}
You can’t perform that action at this time.
0 commit comments