Skip to content

Commit fe0c7b8

Browse files
committed
update icpswap
1 parent 85309c3 commit fe0c7b8

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

projects/icpswap/index.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11

22
const { get } = require('../helper/http')
3-
const { toUSDTBalances } = require('../helper/balances')
4-
const { PromisePool } = require('@supercharge/promise-pool')
53

64
module.exports = {
75
misrepresentedTokens: true,
86
icp: { tvl },
97
}
108

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))
2812
}

0 commit comments

Comments
 (0)