File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 11const ADDRESSES = require ( '../helper/coreAssets.json' )
22const { get } = require ( '../helper/http' )
3- const token = ADDRESSES . ethereum . cbETH
3+ const BigNumber = require ( 'bignumber.js' )
4+
5+ const ETH = ADDRESSES . null
46
57module . exports = {
68 timetravel : false ,
79 ethereum : {
810 tvl : async ( ) => {
911 const data = await get ( "https://api.exchange.coinbase.com/wrapped-assets/CBETH" )
10- // Convert cbETH supply to underlying ETH using the conversion rate
11- const underlyingETH = data . circulating_supply * data . conversion_rate
12+ // Convert circulating cbETH to the amount of underlying ETH backing the wrapper
13+ const circulatingSupply = new BigNumber ( data . circulating_supply || 0 )
14+ const conversionRate = new BigNumber ( data . conversion_rate || 0 )
15+ const underlyingETH = circulatingSupply . times ( conversionRate )
16+
1217 return {
13- [ token ] : underlyingETH * 1e18
18+ [ ETH ] : underlyingETH . shiftedBy ( 18 ) . toFixed ( 0 ) ,
1419 }
1520 }
1621 }
You can’t perform that action at this time.
0 commit comments