Skip to content

Commit 0fd7bfb

Browse files
authored
Fix Icpex (DefiLlama#15350)
1 parent 24e01a7 commit 0fd7bfb

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

projects/icpex/index.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
const axios = require('axios')
12

2-
const { get } = require('../helper/http')
3-
const { toUSDTBalances } = require('../helper/balances')
3+
const url = 'https://stat.icpex.org/durable/api/pair/query/all/metadata'
4+
5+
const tvl = async (api) => {
6+
const { data } = await axios.get(url)
7+
data.data.forEach(({ locked }) => {
8+
const { total_usd } = locked
9+
if (!total_usd) return
10+
api.addUSDValue(total_usd)
11+
})
12+
}
413

514
module.exports = {
615
misrepresentedTokens: true,
716
icp: { tvl },
8-
}
9-
10-
async function tvl() {
11-
let result = await get('https://metrics.icpex.org/llama/tvl');
12-
if (result.retCode === 1 && result.retMsg === "success") {
13-
const tvl = result.data;
14-
return toUSDTBalances(tvl);
15-
} else {
16-
throw new Error(`API error! message: ${result.retMsg}`);
17-
}
18-
}
17+
}

0 commit comments

Comments
 (0)