-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add dexalot tvl adapter * refactor tvl via sumTokens2 for avax,arb+base to helper file * add adapter for dexalot bridge * minor refactor * minor refactor --------- Co-authored-by: g1nt0ki <[email protected]>
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { exportDexalotTVL } = require("../dexalot/helper"); | ||
|
||
module.exports = exportDexalotTVL("Portfolio") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,7 @@ | |
"defichain_evm", | ||
"defiverse", | ||
"degen", | ||
"dexalot", | ||
"dexit", | ||
"dfs", | ||
"dfk", | ||
|