5/5
## EigenLayer Undelegate If you decide to withdraw your staked assets from EigenLayer, it takes two steps: 1. Undelegate 2. Withdraw By calling the function `undelegate`, you will undelegate from the current operator and it will also automatically queue a withdrawal. The contract that we will need to call is the `DelegationManager`. Let's check the interface for `IDelegationManager`. Inside here, there is a function called `undelegate` and it takes in a single input, the address of the staker. We will call: ```solidity delegationManager.undelegate(); ``` The address of the staker, this contract was the contract that called into EigenLayer. So this contract is the staker: ```solidity address(this); ``` Going back to the `IDelegationManager` interface, you can see when we call the function `undelegate`, it returns an array of `bytes32` called `withdrawalRoot`. Let's assign this to the variable here: ```solidity withdrawalRoot = delegationManager.undelegate(address(this)); ``` We're not sure what this `withdrawalRoot` is used for. In our exercises, we won't be needing this. Here is the test command: ```bash forge test --fork-url $FORK_URL --match-path test/exercise-eigen-layer.sol --match-test test_undelegate -vvv ``` The file to test is `exercise-eigen-layer.sol`, the function to call is `test_undelegate`. Our test passed!
If you decide to withdraw your staked assets from EigenLayer, it takes two steps:
Undelegate
Withdraw
By calling the function undelegate
, you will undelegate from the current operator and it will also automatically queue a withdrawal. The contract that we will need to call is the DelegationManager
. Let's check the interface for IDelegationManager
. Inside here, there is a function called undelegate
and it takes in a single input, the address of the staker.
We will call:
The address of the staker, this contract was the contract that called into EigenLayer.
So this contract is the staker:
Going back to the IDelegationManager
interface, you can see when we call the function undelegate
, it returns an array of bytes32
called withdrawalRoot
. Let's assign this to the variable here:
We're not sure what this withdrawalRoot
is used for. In our exercises, we won't be needing this. Here is the test command:
The file to test is exercise-eigen-layer.sol
, the function to call is test_undelegate
. Our test passed!
A step-by-step guide to understanding how to undelegate and withdraw your assets from EigenLayer. The lesson covers how to write your code, utilizing DelegationManager, undelegate, and withdrawalRoot to trigger a queued withdrawal request.
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