Skip to content

Commit 172c390

Browse files
committed
workaround for sunswap v2
1 parent 2684992 commit 172c390

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

projects/sunswap-v2/index.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
const { getUniTVL } = require('../helper/unknownTokens.js')
1+
const { get } = require('../helper/http.js')
2+
// const { getUniTVL } = require('../helper/unknownTokens.js')
23

34
module.exports = {
45
timetravel: false,
56
misrepresentedTokens: true,
67
tron: {
7-
tvl: getUniTVL({ factory: 'TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY', useDefaultCoreAssets: true, queryBatched: 11 }),
8+
// tvl: getUniTVL({ factory: 'TKWJdrQkqHisa1X8HUdHEfREvTzw4pMAaY', useDefaultCoreAssets: true, queryBatched: 11 }),
9+
tvl: httpTvl,
810
}
911
}
12+
13+
14+
15+
async function httpTvl(api) {
16+
const { data } = await get('https://pabc.endjgfsv.link/swapv2/scan/getAllLiquidityVolume')
17+
const latest = data.pop()
18+
const timestamp = Date.now() - 24 * 60 * 60 * 1000
19+
20+
if (latest.time * 1000 > timestamp) {
21+
api.addUSDValue(+latest.liquidity)
22+
} else {
23+
throw new Error("No recent data found")
24+
}
25+
}

0 commit comments

Comments
 (0)