diff --git a/projects/dexalot-bridge/index.js b/projects/dexalot-bridge/index.js new file mode 100644 index 000000000000..a68684be3d0d --- /dev/null +++ b/projects/dexalot-bridge/index.js @@ -0,0 +1,3 @@ +const { exportDexalotTVL } = require("../dexalot/helper"); + +module.exports = exportDexalotTVL("Portfolio") \ No newline at end of file diff --git a/projects/dexalot/helper.js b/projects/dexalot/helper.js new file mode 100644 index 000000000000..99d791be706f --- /dev/null +++ b/projects/dexalot/helper.js @@ -0,0 +1,33 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { get } = require("../helper/http"); + +const dexalotTradingAPI = "https://api.dexalot.com/privapi/trading" + +// [chain]: env +const supportedChains = { + "arbitrum": "production-multi-arb", + "avax": "production-multi-avax", + "base": "production-multi-base" +} + +function getTVL(env, contractName) { + return async (api) => { + const contract = await get(`${dexalotTradingAPI}/deployment?contracttype=${contractName}&env=${env}`) + const allTokens = await get(`${dexalotTradingAPI}/tokens`) + const tokens = allTokens.filter((t) => !t.isvirtual && t.env === env).map((t) => t.address) + return sumTokens2({ api, owner: contract[0].address, tokens }) + } +} + +// Returns TVL for each supported chain (excludes Dexalot chain) +function exportDexalotTVL(contractName) { + const res = {} + for (const [chain, env] of Object.entries(supportedChains)) { + res[chain] = {tvl: getTVL(env, contractName)} + } + return res +} + +module.exports = { + exportDexalotTVL +} \ No newline at end of file diff --git a/projects/dexalot/index.js b/projects/dexalot/index.js new file mode 100644 index 000000000000..c08832f46583 --- /dev/null +++ b/projects/dexalot/index.js @@ -0,0 +1,25 @@ +const { get } = require("../helper/http"); +const { exportDexalotTVL } = require("./helper"); + +const dexalotAPI = "https://api.dexalot.com" + +async function getDexalotChainLockedOrders(_) { + const lockedTokens = await get(`${dexalotAPI}/api/stats/orderstvl`) + const res = {} + for (const {coingecko_id, amount} of lockedTokens) { + // Ignore counting tokens without coingecko_id + if (coingecko_id == null) { + continue + } + res[coingecko_id] = amount + } + return res +} + +module.exports = { + methodology: "Dexalot TVL is comprised of the token balances locked in the MainnetRFQ (swap) contracts and the value locked in open orders on the Dexalot chain.", + dexalot: { + tvl: getDexalotChainLockedOrders, + }, + ...exportDexalotTVL("MainnetRFQ") +} \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index 623870f0cbde..ded34e3f96b1 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -81,6 +81,7 @@ "defichain_evm", "defiverse", "degen", + "dexalot", "dexit", "dfs", "dfk",