File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ const { exportDexalotTVL } = require ( "../dexalot/helper" ) ;
2
+
3
+ module . exports = exportDexalotTVL ( "Portfolio" )
Original file line number Diff line number Diff line change
1
+ const { sumTokens2 } = require ( '../helper/unwrapLPs' )
2
+ const { get } = require ( "../helper/http" ) ;
3
+
4
+ const dexalotTradingAPI = "https://api.dexalot.com/privapi/trading"
5
+
6
+ // [chain]: env
7
+ const supportedChains = {
8
+ "arbitrum" : "production-multi-arb" ,
9
+ "avax" : "production-multi-avax" ,
10
+ "base" : "production-multi-base"
11
+ }
12
+
13
+ function getTVL ( env , contractName ) {
14
+ return async ( api ) => {
15
+ const contract = await get ( `${ dexalotTradingAPI } /deployment?contracttype=${ contractName } &env=${ env } ` )
16
+ const allTokens = await get ( `${ dexalotTradingAPI } /tokens` )
17
+ const tokens = allTokens . filter ( ( t ) => ! t . isvirtual && t . env === env ) . map ( ( t ) => t . address )
18
+ return sumTokens2 ( { api, owner : contract [ 0 ] . address , tokens } )
19
+ }
20
+ }
21
+
22
+ // Returns TVL for each supported chain (excludes Dexalot chain)
23
+ function exportDexalotTVL ( contractName ) {
24
+ const res = { }
25
+ for ( const [ chain , env ] of Object . entries ( supportedChains ) ) {
26
+ res [ chain ] = { tvl : getTVL ( env , contractName ) }
27
+ }
28
+ return res
29
+ }
30
+
31
+ module . exports = {
32
+ exportDexalotTVL
33
+ }
Original file line number Diff line number Diff line change
1
+ const { get } = require ( "../helper/http" ) ;
2
+ const { exportDexalotTVL } = require ( "./helper" ) ;
3
+
4
+ const dexalotAPI = "https://api.dexalot.com"
5
+
6
+ async function getDexalotChainLockedOrders ( _ ) {
7
+ const lockedTokens = await get ( `${ dexalotAPI } /api/stats/orderstvl` )
8
+ const res = { }
9
+ for ( const { coingecko_id, amount} of lockedTokens ) {
10
+ // Ignore counting tokens without coingecko_id
11
+ if ( coingecko_id == null ) {
12
+ continue
13
+ }
14
+ res [ coingecko_id ] = amount
15
+ }
16
+ return res
17
+ }
18
+
19
+ module . exports = {
20
+ 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." ,
21
+ dexalot : {
22
+ tvl : getDexalotChainLockedOrders ,
23
+ } ,
24
+ ...exportDexalotTVL ( "MainnetRFQ" )
25
+ }
Original file line number Diff line number Diff line change 81
81
" defichain_evm" ,
82
82
" defiverse" ,
83
83
" degen" ,
84
+ " dexalot" ,
84
85
" dexit" ,
85
86
" dfs" ,
86
87
" dfk" ,
You can’t perform that action at this time.
0 commit comments