11const  ADDRESSES  =  require ( '../helper/coreAssets.json' ) 
2- const  {  sumTokensExport,  sumTokens2 }  =  require ( '../helper/unwrapLPs' ) 
2+ const  {  sumTokensExport,  sumTokens2,  unwrapSlipstreamNFT  }  =  require ( '../helper/unwrapLPs' ) 
33
44const  LBTCV  =  '0x5401b8620E5FB570064CA9114fd1e135fd77D57c'             // vault (ETH/Base/BSC) 
55const  SONIC_VAULT  =  '0x309f25d839a2fe225e80210e110C99150Db98AAF'       // vault (Sonic) 
@@ -62,14 +62,61 @@ async function tvlCurveCorn(_, _b, _cb, { api }) {
6262  return  { } 
6363} 
6464
65+ // Aerodrome Slipstream (Base) - Concentrated Liquidity NFT positions 
66+ async  function  tvlAerodrome ( _ ,  _b ,  _cb ,  {  api } )  { 
67+   const  nftAddress  =  '0x827922686190790b37229fd06084350E74485b72'   
68+   await  unwrapSlipstreamNFT ( {  api,  owner : LBTCV ,  nftAddress } ) 
69+   return  { } 
70+ } 
71+ 
72+ // Turtle Club Vault (Ethereum) - unwrap katanaLBTCv (BoringVault) to underlying assets 
73+ async  function  tvlTurtleClub ( _ ,  _b ,  _cb ,  {  api } )  { 
74+   const  katanaLBTCv  =  '0x75231079973c23e9eb6180fa3d2fc21334565ab5'   // Turtle Club BoringVault token 
75+   
76+   // Get vault share balance held by LBTCV 
77+   const  shareBalance  =  await  api . call ( { 
78+     target : katanaLBTCv , 
79+     abi : 'erc20:balanceOf' , 
80+     params : [ LBTCV ] 
81+   } ) 
82+   
83+   if  ( ! shareBalance  ||  shareBalance  ===  '0' )  return  { } 
84+   
85+   // BoringVault architecture: Vault -> Hook -> Accountant -> (base asset + rate) 
86+   const  hook  =  await  api . call ( { 
87+     target : katanaLBTCv , 
88+     abi : 'address:hook' 
89+   } ) 
90+   
91+   const  accountant  =  await  api . call ( { 
92+     target : hook , 
93+     abi : 'address:accountant' 
94+   } ) 
95+   
96+   const  [ baseAsset ,  rate ,  decimals ]  =  await  Promise . all ( [ 
97+     api . call ( {  target : accountant ,  abi : 'address:base'  } ) , 
98+     api . call ( {  target : accountant ,  abi : 'uint256:getRate'  } ) , 
99+     api . call ( {  target : accountant ,  abi : 'uint8:decimals'  } ) 
100+   ] ) 
101+   
102+   // Calculate underlying amount: shareBalance * rate / 10^decimals 
103+   const  underlyingAmount  =  BigInt ( shareBalance )  *  BigInt ( rate )  /  BigInt ( 10  **  Number ( decimals ) ) 
104+   
105+   api . add ( baseAsset ,  underlyingAmount ) 
106+   
107+   return  { } 
108+ } 
109+ 
65110// universal composer to avoid double counting 
66- function  composeChainTVL ( baseScanner ,  curveFn  =  tvlCurve )  { 
111+ function  composeChainTVL ( baseScanner ,  additionalFns  =  [ ] )  { 
67112  return  async  ( ...args )  =>  { 
68113    const  [ ,  ,  ,  {  api } ]  =  args 
69114    // 1) base scanner (owners + resolveUniV3) 
70115    if  ( baseScanner )  await  baseScanner ( ...args ) 
71-     // 2) add Curve positions 
72-     if  ( curveFn )  await  curveFn ( ...args ) 
116+     // 2) add additional TVL functions (Curve, Aerodrome, etc) 
117+     for  ( const  fn  of  additionalFns )  { 
118+       await  fn ( ...args ) 
119+     } 
73120    return  api . getBalances ( ) 
74121  } 
75122} 
@@ -78,21 +125,31 @@ module.exports = {
78125  doublecounted : true , 
79126
80127  ethereum : { 
81-     tvl : composeChainTVL ( sumTokensExport ( { 
82-       owners : [ LBTCV ] ,  
83-       fetchCoValentTokens : true , 
84-       tokenConfig : {  onlyWhitelisted : false  } , 
85-       resolveUniV3 : true , 
86-     } ) ) , 
128+     tvl : composeChainTVL ( 
129+       sumTokensExport ( { 
130+         owners : [ LBTCV ] ,  
131+         fetchCoValentTokens : true , 
132+         tokenConfig : {  
133+           onlyWhitelisted : false , 
134+           // Exclude Turtle Club vault token to avoid double counting (handled separately in tvlTurtleClub) 
135+           blacklistedTokens : [ '0x75231079973C23e9eB6180fa3D2fc21334565aB5' ] 
136+         } , 
137+         resolveUniV3 : true , 
138+       } ) , 
139+       [ tvlCurve ,  tvlTurtleClub ] 
140+     ) , 
87141  } , 
88142
89143  base : { 
90-     tvl : sumTokensExport ( { 
91-       owners : [ LBTCV ] , 
92-       fetchCoValentTokens : true , 
93-       tokenConfig : {  onlyWhitelisted : false  } , 
94-       resolveUniV3 : true , 
95-     } ) , 
144+     tvl : composeChainTVL ( 
145+       sumTokensExport ( { 
146+         owners : [ LBTCV ] , 
147+         fetchCoValentTokens : true , 
148+         tokenConfig : {  onlyWhitelisted : false  } , 
149+         resolveUniV3 : true , 
150+       } ) , 
151+       [ tvlAerodrome ] 
152+     ) , 
96153  } , 
97154
98155  bsc : { 
@@ -114,7 +171,7 @@ module.exports = {
114171          '0xecAc9C5F704e954931349Da37F60E39f515c11c1' ,  // LBTC on Corn 
115172        ] , 
116173      } ) , 
117-       tvlCurveCorn 
174+       [ tvlCurveCorn ] 
118175    ) , 
119176  } , 
120177
0 commit comments