File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
src/adaptors/marginfi-lst Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ const axios = require ( 'axios' ) ;
2+ const { getTotalSupply } = require ( '../utils' ) ;
3+
4+ const LST_MINT = 'LSTxxxnJzKDFSLr4dUkPcmCf5VyryEqzPLz5j4bpxFp' ;
5+ const priceKey = `solana:${ LST_MINT } ` ;
6+ const SOL = 'So11111111111111111111111111111111111111112' ;
7+
8+ const apy = async ( ) => {
9+ const [ totalSupply , priceRes , apyRes ] = await Promise . all ( [
10+ getTotalSupply ( LST_MINT ) ,
11+ axios . get ( `https://coins.llama.fi/prices/current/${ priceKey } ` ) ,
12+ axios . get (
13+ `https://extra-api.sanctum.so/v1/apy/latest?lst=${ LST_MINT } `
14+ ) ,
15+ ] ) ;
16+
17+ const currentPrice = priceRes . data . coins [ priceKey ] ?. price ;
18+ if ( ! currentPrice ) throw new Error ( 'Unable to fetch LST price' ) ;
19+
20+ const apyRaw = apyRes ?. data ?. apys ?. [ LST_MINT ] ;
21+ if ( ! Number . isFinite ( apyRaw ) )
22+ throw new Error ( `Unable to fetch APY for ${ LST_MINT } ` ) ;
23+ const apyBase = apyRaw * 100 ;
24+
25+ return [
26+ {
27+ pool : LST_MINT ,
28+ chain : 'Solana' ,
29+ project : 'marginfi-lst' ,
30+ symbol : 'LST' ,
31+ tvlUsd : totalSupply * currentPrice ,
32+ apyBase,
33+ underlyingTokens : [ SOL ] ,
34+ token : LST_MINT ,
35+ poolMeta : '0% rewards fee' ,
36+ } ,
37+ ] ;
38+ } ;
39+
40+ module . exports = {
41+ timetravel : false ,
42+ apy,
43+ url : 'https://app.marginfi.com/stake' ,
44+ } ;
You can’t perform that action at this time.
0 commit comments