Building on top of protocol is not always straightforward in this ecosystem. It takes time and effort for us developers to keep up with each protocol as it evolves. In this article, we will go over how we keep track of restaked assets on EigenLayer.
When EigenLayer announced that it would accept three liquid restaked tokens: wstETH, stETH, and rETH. It brings in liquid staking tokens worth over 120,000 ETH contracts in a matter of hours.
To track restaked assets on EigenLayer, we must first understand the restaking process.
The restaking of liquid staking tokens occurs when token holders engage with EigenLayer's smart contract to deposit (restake) their tokens.
Currently, there are three contracts on Ethereum network for each liquid staking token, which are as follows.
To begin, go to the stETH contract on EtherScan and look in the dropdown section for the amount of stETH held within the contract as well as its value.
Developers can use the function 'balanceOf(address)' on the stETH contract with the EigenLayer's stETH contract address
balanceOf(0x93c4b944D05dfe6df7645A86cd2206016c51564D)
Because stETH is a rebase token, we may multiply the numbers from the function call by the price of ETH to get the Total Value Locked in USD or any other currency.
Moving on to rETH, the process of tracking its restaked Total Value Locked (TVL) on EigenLayer is quite similar. To begin, you should go to the rETH contract on EtherScan. You can find important information here, such as the amount of rETH stored within the contract and its current market value.
The key function for tracking rETH is balanceOf(address), which should be used with the specific EigenLayer's rETH contract address:
balanceOf(0x1BeE69b7dFFfA4E2d53C2a2Df135C388AD25dCD2)
However, because rETH is a reward-bearing token, 1 rETH does not equal 1 ETH because the value of rETH grows over time with the rewards.
To obtain the exchange rate or ratio between rETH and ETH, use the getExchangeRate() function on the rETH contract, as shown in the screenshot below.
The ratio of 1090207675055504208 or 1.090207675055504208 shows that 1 RETH equals 1.0902 ETH.
For cbETH, the methodology remains consistent. Anyone can check the cbETH contract on EtherScan to observe the amount of cbETH in the contract and its associated value.
To accurately track the TVL of cbETH, the balanceOf(address) function is utilized with the EigenLayer's cbETH contract address:
balanceOf(0x54945180dB7943c0ed0FEE7EdaB2Bd24620256bc)
Like rETH, the nature of cbETH as a reward bearing token which requires you to get the ratio via exchangeRate() function on the cbETH's smart contract.