diff --git a/projects/justSwap/index.js b/projects/justSwap/index.js index f5707c182..4cf1b9a3c 100644 --- a/projects/justSwap/index.js +++ b/projects/justSwap/index.js @@ -1,14 +1,28 @@ const { getCache, setCache } = require('../helper/cache') +const { get } = require('../helper/http') const { sliceIntoChunks, sleep } = require('../helper/utils') module.exports = { misrepresentedTokens: true, isHeavyProtocol: true, + timetravel: false, tron: { - tvl, + tvl: httpTvl, }, } +async function httpTvl(api) { + const {data} = await get('https://abc.endjgfsv.link/swap/scan/liquidityall') + const latest = data.pop() + const timestamp = Date.now() - 24 * 60 * 60 * 1000 + + if (latest.time > timestamp) { + api.addUSDValue(+latest.liquidity) + } else { + throw new Error("No recent data found") + } +} + async function tvl(api) { const factories = [ 'TXk8rQSAvPvBBNtqSoY6nCfsXWCSSpTVQF', // v1