2/5
## Solution: Depositing RETH Into Eigenlayer Let's follow these steps to deposit RETH into Eigenlayer. First, we'll move the RETH from msg.sender into this contract: ```solidity reth.transferFrom(msg.sender, address(this), rethAmount); ``` Then we will allow the Eigenlayer contract to use tokens from this contract: ```solidity reth.approve() ``` We will need to decide which contract to approve. Remember that we have to deposit into the strategy manager contract, but what is the name of the strategy manager contract that exists inside this contract? We can scroll up and view it by locating the 'StrategyManager' ```solidity IStrategyManager constant strategyManager = IStrategyManager(EIGEN_LAYER_STRATEGY_MANAGER); ``` Now, we can approve this contract: ```solidity reth.approve(address(strategyManager), rethAmount); ``` After we write this code, we can call the deposit function inside of the strategy manager. Let's navigate to the interface for the strategy manager, which is called 'IStrategyManager'. ```solidity interface IStrategyManager { function stakerDepositShares(address user, address strategy) external view returns (uint256 shares); function depositIntoStrategy( address strategy, address token, uint256 amount ) external returns (uint256 shares); } ``` Here we have the 'depositIntoStrategy' function, we can copy this function signature and then use it in our code: ```solidity StrategyManager.depositIntoStrategy{ address strategy, address token, uint256 amount } ``` These are the parameters that we will need to prepare. The address of the strategy is 'address(strategy)', and the token is 'address(reth)' ```solidity strategyManager.depositIntoStrategy{ address(strategy), address (reth), rethAmount } ``` Then, the amount of RETH we want to deposit into Eigenlayer is the rethAmount ```solidity shares = strategyManager.depositIntoStrategy{ address(strategy), address (reth), rethAmount } ``` That completes the exercise. Let's try executing the test for calling the function deposit. ```bash forge test --fork-url $FORK_URL --match-path test/exercise-eigen-layer.sol --match-test test_deposit -vvv ``` Our test passed.
Let's follow these steps to deposit RETH into Eigenlayer. First, we'll move the RETH from msg.sender into this contract:
Then we will allow the Eigenlayer contract to use tokens from this contract:
We will need to decide which contract to approve. Remember that we have to deposit into the strategy manager contract, but what is the name of the strategy manager contract that exists inside this contract?
We can scroll up and view it by locating the 'StrategyManager'
Now, we can approve this contract:
After we write this code, we can call the deposit function inside of the strategy manager. Let's navigate to the interface for the strategy manager, which is called 'IStrategyManager'.
Here we have the 'depositIntoStrategy' function, we can copy this function signature and then use it in our code:
These are the parameters that we will need to prepare. The address of the strategy is 'address(strategy)', and the token is 'address(reth)'
Then, the amount of RETH we want to deposit into Eigenlayer is the rethAmount
That completes the exercise. Let's try executing the test for calling the function deposit.
Our test passed.
A comprehensive guide to deposit RETH into the EigenLayer using a Solidity smart contract. This lesson covers how to transfer RETH from the message sender to the contract, approve the EigenLayer contract to spend the tokens, and deposit the RETH into the EigenLayer strategy manager.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Stay in the loop with the latest Rocket Pool updates and connect with over 5,000 developers in the community.
Course Overview
About the course
Rocket Pool rETH staking, yield mechanisms, trading options, and contract architecture
How to distribute rewards and calculate rETH/ETH exchange rate
How to acquire and redeem rETH
Integrating rETH into DeFi protocols like AAVE V3
How to how to create leveraged ETH positions using rETH
How to provide rETH as liquidity to Balancer and Aura
Getting the USD price of rETH using Rocket Pool NAV oracle
Re-staking with EigenLayer
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on July 8, 2025
Duration: 4min
Duration: 48min
Duration: 57min
Duration: 30min
Duration: 7min
Duration: 23min
Duration: 6min
Course Overview
About the course
Rocket Pool rETH staking, yield mechanisms, trading options, and contract architecture
How to distribute rewards and calculate rETH/ETH exchange rate
How to acquire and redeem rETH
Integrating rETH into DeFi protocols like AAVE V3
How to how to create leveraged ETH positions using rETH
How to provide rETH as liquidity to Balancer and Aura
Getting the USD price of rETH using Rocket Pool NAV oracle
Re-staking with EigenLayer
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Blockchain Financial Analyst
$100,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on July 8, 2025