File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ const axios = require ( 'axios' ) ;
2+
3+ const chains = {
4+ sui : 'https://api.flowx.finance/flowx-be/api/explore-stats/top-pools' ,
5+ } ;
6+
7+ const apy = async ( chain ) => {
8+ if ( chain === 'sui' ) {
9+ let pools = ( await axios . get ( chains [ chain ] ) ) . data . data . filter (
10+ ( it ) => it . protocolVersion == 'V3'
11+ ) ;
12+ return pools
13+ . map ( ( p ) => {
14+ return {
15+ pool : p . poolId ,
16+ chain : chain ,
17+ project : 'flowx-v3' ,
18+ symbol : `${ p . coinX . symbol } /${ p . coinY . symbol } ` ,
19+ underlyingTokens : [ p . coinX . coinType , p . coinY . coinType ] ,
20+ rewardTokens : p . stats . combinedApr ?. rewardTokens ?. map ( ( it ) => it . type ) ,
21+ tvlUsd : Number ( p . stats . totalLiquidityInUSD ) ,
22+ apyBase : Number ( p . stats . combinedApr . lpRewardsApr ) ,
23+ apyReward : Number ( p . stats . combinedApr . farmApr ) ,
24+ volumeUsd1d : Number ( p ?. stats . volume24H ) ,
25+ poolMeta : `${ Number ( p . feeRate ) * 100 } %` ,
26+ url : `https://flowx.finance/explore/pools/${ p . poolId } ` ,
27+ } ;
28+ } )
29+ . filter ( ( i ) => i . tvlUsd <= 1e8 ) ;
30+ }
31+ } ;
32+
33+ const main = async ( ) => {
34+ const pools = await Promise . all (
35+ Object . keys ( chains ) . map ( ( chain ) => apy ( chain ) )
36+ ) ;
37+
38+ return pools . flat ( ) ;
39+ } ;
40+
41+ module . exports = {
42+ apy : main ,
43+ } ;
You can’t perform that action at this time.
0 commit comments