@@ -88,8 +88,90 @@ const apy = async function () {
8888 underlyingTokens : [ poolToken ] , // Array of underlying token addresses from a pool, eg here USDT address on ethereum
8989 poolMeta : pool . name , // A string value which can stand for any specific details of a pool position, market, fee tier, lock duration, specific strategy etc
9090 } ) ;
91+ }
92+
93+ if ( data . data . yieldBearingTokens && data . data . yieldBearingTokens . length > 0 ) {
94+ for ( const ybt of data . data . yieldBearingTokens ) {
95+ const { address, networkId, apr, vaults, assetOracleAddress } = ybt ;
96+ const chain = ( chainIdToName [ networkId ] || 'unknown' ) . toLowerCase ( ) ;
9197
98+ const [
99+ { output : tvl } ,
100+ { output : decimals } ,
101+ { output : tokenSymbol } ,
102+ { output : tokenName } ,
103+ ] = await Promise . all ( [
104+ sdk . api . abi . call ( {
105+ target : assetOracleAddress ,
106+ abi : {
107+ "inputs" : [ ] ,
108+ "name" : "totalAssetsUSD" ,
109+ "outputs" : [
110+ {
111+ "internalType" : "uint256" ,
112+ "name" : "totalValue" ,
113+ "type" : "uint256"
114+ } ,
115+ ] ,
116+ "stateMutability" : "view" ,
117+ "type" : "function"
118+ } ,
119+ chain,
120+ } ) ,
121+ sdk . api . abi . call ( {
122+ target : assetOracleAddress ,
123+ abi : {
124+ "inputs" : [ ] ,
125+ "name" : "DECIMALS" ,
126+ "outputs" : [
127+ {
128+ "internalType" : "uint256" ,
129+ "name" : "" ,
130+ "type" : "uint256"
131+ } ,
132+ ] ,
133+ "stateMutability" : "view" ,
134+ "type" : "function"
135+ } ,
136+ chain,
137+ } ) ,
138+ sdk . api . abi . call ( {
139+ target : address ,
140+ abi : 'erc20:symbol' ,
141+ chain,
142+ } ) ,
143+ sdk . api . abi . call ( {
144+ target : address ,
145+ abi : {
146+ "inputs" : [ ] ,
147+ "name" : "name" ,
148+ "outputs" : [
149+ {
150+ "internalType" : "string" ,
151+ "name" : "" ,
152+ "type" : "string"
153+ }
154+ ] ,
155+ "stateMutability" : "view" ,
156+ "type" : "function"
157+ } ,
158+ chain,
159+ } ) ,
160+ ] ) ;
161+ pools . push ( {
162+ pool : `${ address } -${ chain } ` ,
163+ chain,
164+ project : 'csigma-finance' ,
165+ symbol : tokenSymbol ,
166+ tvlUsd : ( tvl * 1.0 ) / decimals ,
167+ apyBase : apr ,
168+ rewardTokens : [ ] ,
169+ underlyingTokens : vaults ,
170+ poolMeta : tokenName ,
171+ } ) ;
172+ }
92173 }
174+
93175 return pools ;
94176}
95177module . exports = {
0 commit comments