@@ -8,6 +8,7 @@ const LLAMAPAY_ROUTER_ORACLE_NAME = 'LlamaPayRouterOracle'
8
8
const GEARBOX_TOKEN_PREFIX = 'Farming of'
9
9
const ARRAKIS_TOKEN_PREFIX = 'Arrakis Vault V2'
10
10
const ESXAI_POSITION_ORACLE_NAME = 'EsXai Position Oracle'
11
+ const SYMBIOTIC_TOKEN_PREFIX = 'Symbiotic Vault'
11
12
12
13
const config = {
13
14
polygon : {
@@ -190,6 +191,7 @@ Object.keys(config).forEach(chain => {
190
191
const arrakisVaults = [ ]
191
192
const xaiPositionVaults = [ ]
192
193
const esXaiVaults = [ ]
194
+ const symbioticVaults = [ ]
193
195
194
196
for ( let i = 0 ; i < vaults . length ; ++ i ) {
195
197
const vault = vaults [ i ]
@@ -222,6 +224,10 @@ Object.keys(config).forEach(chain => {
222
224
xaiPositionVaults . push ( vault )
223
225
continue
224
226
}
227
+ if ( assetName . startsWith ( SYMBIOTIC_TOKEN_PREFIX ) ) {
228
+ symbioticVaults . push ( [ vault , assetInfo . asset ] )
229
+ continue
230
+ }
225
231
}
226
232
227
233
@@ -256,7 +262,8 @@ Object.keys(config).forEach(chain => {
256
262
processLlamaPayTvl ( llamapayRouters , api ) ,
257
263
processGearboxTvl ( gearboxFarmingPools , api ) ,
258
264
processArrakisTvl ( arrakisVaults , api , ARRAKIS_HELPER ) ,
259
- processXaiTvl ( xaiPositionVaults , api , ESXAI_POOL_FACTORY , XAI )
265
+ processXaiTvl ( xaiPositionVaults , api , ESXAI_POOL_FACTORY , XAI ) ,
266
+ processSymbioticTvl ( symbioticVaults , api )
260
267
] )
261
268
262
269
Object . keys ( erc4626UnderylingMap ) . forEach ( ( erc4626Asset , i ) => erc4626UnderylingMap [ erc4626Asset ] = underlyingTokens [ i ] )
@@ -409,6 +416,18 @@ async function processAaveTvl(aaveVaults, api, AAVE_POOL, AAVE_POOL_DATA_PROVIDE
409
416
410
417
}
411
418
419
+ async function processSymbioticTvl ( symbioticVaults , api ) {
420
+ if ( symbioticVaults . length === 0 ) return
421
+
422
+ const collaterals = await api . multiCall ( { abi : abi . collateral , calls : symbioticVaults . map ( x => ( { target : x [ 1 ] } ) ) } )
423
+
424
+ const balances = await api . multiCall ( { abi : 'erc20:balanceOf' , calls : symbioticVaults . map ( x => ( { target : x [ 1 ] , params : [ x [ 0 ] ] } ) ) } )
425
+
426
+ collaterals . forEach ( ( collateral , i ) => {
427
+ api . addToken ( collateral , balances [ i ] )
428
+ } )
429
+ }
430
+
412
431
const abi = {
413
432
"collateralBalanceOf" : "function collateralBalanceOf(address account, address asset) view returns (uint128)" ,
414
433
"getReserveData" : "function getReserveData(address asset) view returns (((uint256 data) configuration, uint128 liquidityIndex, uint128 currentLiquidityRate, uint128 variableBorrowIndex, uint128 currentVariableBorrowRate, uint128 currentStableBorrowRate, uint40 lastUpdateTimestamp, uint16 id, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint128 accruedToTreasury, uint128 unbacked, uint128 isolationModeTotalDebt))" ,
@@ -438,5 +457,6 @@ const abi = {
438
457
"getPoolIndicesOfUser" : "function getPoolIndicesOfUser(address user) returns (address[])" ,
439
458
"esXaiStakeBucket" : "function esXaiStakeBucket() returns (address)" ,
440
459
"getStakedAmounts" : "function getStakedAmounts(address) returns (uint256)" ,
441
- "withdrawableDividendOf" : "function withdrawableDividendOf(address) returns (uint256)"
460
+ "withdrawableDividendOf" : "function withdrawableDividendOf(address) returns (uint256)" ,
461
+ "collateral" : "function collateral() returns (address)"
442
462
}
0 commit comments