From c9ed6a9cafdeeca8b3c9dbe33b48b8096eb443fe Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 31 Oct 2025 13:08:25 +0700 Subject: [PATCH] Add DipCoin Perp TVL Adapter for SUI --- projects/dipcoin-perp/index.js | 29 +++++++++++++++++++++++++++++ projects/dipcoin/index.js | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 projects/dipcoin-perp/index.js diff --git a/projects/dipcoin-perp/index.js b/projects/dipcoin-perp/index.js new file mode 100644 index 00000000000..b77354a0ba2 --- /dev/null +++ b/projects/dipcoin-perp/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const BigNumber = require("bignumber.js") +const { getConfig } = require('../helper/cache'); + +async function suiTvl(api) { + const symbols = (await getConfig('dipcoin-perp/symbols', 'https://gray-api.dipcoin.io/api/perp-market-api/list'))?.data?.map(i => i.symbol) + if (!Array.isArray(symbols) || symbols.length === 0) return; + const volumes = await Promise.all(symbols.map(async (symbol) => { + const ticker = await getConfig(`dipcoin-perp/symbol-volume-${symbol}`, `https://gray-api.dipcoin.io/api/perp-market-api/ticker?symbol=${symbol}`); + const volumeValue = ticker?.data?.volume24h || 0; + + return BigNumber(volumeValue); + })); + const sum = volumes.reduce((acc, volume) => acc.plus(volume), BigNumber(0)).div(1e12).toFixed(0); + + api.add(ADDRESSES.sui.USDC, sum); +} + +module.exports = { + sui: { + tvl: suiTvl + }, + hallmarks: [ + ['2025-10-15', "Launched the Perpetual Mainnet (v1.0)."], + ['2025-10-16', "Listed perpetual contracts for BTC, ETH, and SUI."], + ['2025-10-29', "Upgraded to Mainnet v1.1, introducing Take Profit/Stop Loss and margin management features."], + ['2025-10-31', "Listed perpetual contracts for SOL, BNB, and XRP."], + ], +} diff --git a/projects/dipcoin/index.js b/projects/dipcoin/index.js index cc39b1b0b27..b74b70fe839 100644 --- a/projects/dipcoin/index.js +++ b/projects/dipcoin/index.js @@ -14,7 +14,7 @@ async function suiTvl(api) { module.exports = { hallmarks: [ - [1747699200, "Spot Launch"], + ['2025-05-20', "Spot Launch"], ], sui: { tvl: suiTvl