File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
src/adaptors/bluefin-spot Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ const axios = require ( 'axios' ) ;
2+
3+ const apyDataUrl = 'https://swap.api.sui-prod.bluefin.io/api/v1/pools/apy/stats' ;
4+
5+ const apy = async ( ) => {
6+ const response = await axios . get ( apyDataUrl ) ;
7+ const pools = response . data . data ;
8+
9+ return pools
10+ . map ( ( p ) => {
11+ const stats = p . apyStats [ 0 ] ;
12+ const apyBase = Number ( stats . aprFee ) ;
13+ const apyReward = Number ( stats . aprRewards ) ;
14+ // Extract reward token addresses from rewards array
15+ const rewardTokens = p . rewards ?. map ( ( reward ) => reward . symbol ) || [ ] ;
16+ return {
17+ pool : p . pool ,
18+ chain : 'Sui' ,
19+ project : 'bluefin-spot' ,
20+ symbol : `${ p . coinA . symbol } -${ p . coinB . symbol } ` ,
21+ underlyingTokens : [ p . coinA . coinType , p . coinB . coinType ] ,
22+ rewardTokens,
23+ tvlUsd : Number ( stats . tvlUsd ) ,
24+ apyBase,
25+ apyReward : apyReward > 0 ? apyReward : 0 ,
26+ poolMeta : `(${ Number ( p . feeRate ) } %)` ,
27+ url : `https://trade.bluefin.io/deposit/${ p . pool } ` ,
28+ } ;
29+ } )
30+ . filter ( ( i ) => i . tvlUsd >= 1e4 ) // show pools with at least $10,000 TVL
31+ . sort ( ( a , b ) => b . tvlUsd - a . tvlUsd ) ;
32+ } ;
33+
34+ module . exports = {
35+ apy,
36+ } ;
You can’t perform that action at this time.
0 commit comments