/eigenlayer-contracts

Primary LanguageSolidityOtherNOASSERTION

EigenLayer

EigenLayer is a set of smart contracts deployed on Ethereum that enable restaking of assets to secure new services. This repo contains the EigenLayer core contracts, whose currently-supported assets include beacon chain ETH and several liquid staking tokens (LSTs). Users use these contracts to deposit and withdraw these assets, as well as delegate them to operators providing services to AVSs.

Getting Started

Branching

The main branches we use are:

  • dev (default): The most up-to-date branch, containing the work-in-progress code for upcoming releases
  • testnet-holesky: Our current testnet deployment
  • mainnet: Our current mainnet deloyment

Documentation

Basics

To get a basic understanding of EigenLayer, check out You Could've Invented EigenLayer. Note that some of the document's content describes features that do not exist yet (like the Slasher). To understand more about how restakers and operators interact with EigenLayer, check out these guides:

Deep Dive

The most up-to-date and technical documentation can be found in /docs. If you're a shadowy super coder, this is a great place to get an overview of the contracts before diving into the code.

To get an idea of how users interact with these contracts, check out our integration tests: /src/test/integration.

Building and Running Tests

This repository uses Foundry. See the Foundry docs for more info on installation and usage. If you already have foundry, you can build this project and run tests with these commands:

foundryup

forge build
forge test

Running Fork Tests

We have a few fork tests against ETH mainnet. Passing these requires the environment variable RPC_MAINNET to be set. See .env.example for an example. Once you've set up your environment, forge test should show these fork tests passing.

Additionally, to run all tests in a forked environment, install yq. Then, set up your environment using this script to read from config.yml:

source source-env.sh [goerli|local]

Then run the tests:

forge test --fork-url [RPC_URL]

Running Static Analysis

  1. Install solhint, then run:

solhint 'src/contracts/**/*.sol'

  1. Install slither, then run:

slither .

Generate Inheritance and Control-Flow Graphs

  1. Install surya and graphviz:
npm i -g surya

apt install graphviz
  1. Then, run:
surya inheritance ./src/contracts/**/*.sol | dot -Tpng > InheritanceGraph.png

surya mdreport surya_report.md ./src/contracts/**/*.sol

Deployments

Current Mainnet Deployment

The current mainnet deployment is our M1 release, and is from a much older version of this repo. You can view the deployed contract addresses below, or check out the code itself on the mainnet branch.

Name Solidity Proxy Implementation Notes
StrategyManager StrategyManager 0x8586...075A 0x5d25...42Fb Proxy: OpenZeppelin TUP@4.7.1
Strategy: cbETH StrategyBaseTVLLimits 0x5494...56bc 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: stETH StrategyBaseTVLLimits 0x93c4...564D 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: rETH StrategyBaseTVLLimits 0x1BeE...dCD2 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: ETHx StrategyBaseTVLLimits 0x9d7e...011d 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: ankrETH StrategyBaseTVLLimits 0x1376...58ff 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: OETH StrategyBaseTVLLimits 0xa4C6...d059 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: osETH StrategyBaseTVLLimits 0x57ba...4c02 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: swETH StrategyBaseTVLLimits 0x0Fe4...96d6 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: wBETH StrategyBaseTVLLimits 0x7CA9...2184 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: sfrxETH StrategyBaseTVLLimits 0x8CA7...28b6 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: lsETH StrategyBaseTVLLimits 0xAe60...4473 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
Strategy: mETH StrategyBaseTVLLimits 0x298a...6dd2 0xdfdA...46d3 Proxy: OpenZeppelin TUP@4.7.1
EigenPodManager EigenPodManager 0x91E6...A338 0xEB86...e111 Proxy: OpenZeppelin TUP@4.7.1
EigenPod (beacon) EigenPod 0x5a2a...9073 0x5c86...9dA7 - Beacon: OpenZeppelin BeaconProxy@4.7.1
- Deployed pods use UpgradableBeacon@4.7.1
DelayedWithdrawalRouter DelayedWithdrawalRouter 0x7Fe7...23D8 0x44Bc...E2AF Proxy: OpenZeppelin TUP@4.7.1
DelegationManager DelegationManager 0x3905...f37A 0xf97E...75e4 Proxy: OpenZeppelin TUP@4.7.1
Slasher Slasher 0xD921...c3Cd 0xef31...d6d8 Proxy: OpenZeppelin TUP@4.7.1
PauserRegistry PauserRegistry - 0x0c43...7060
Pauser Multisig GnosisSafe@1.3.0 0x5050...2390 0xd9db...9552 Proxy: GnosisSafeProxy@1.3.0
Community Multisig GnosisSafe@1.3.0 0xFEA4...c598 0xd9db...9552 Proxy: GnosisSafeProxy@1.3.0
Executor Multisig GnosisSafe@1.3.0 0x369e...9111 0xd9db...9552 Proxy: GnosisSafeProxy@1.3.0
Operations Multisig GnosisSafe@1.3.0 0xBE16...3e90 0xd9db...9552 Proxy: GnosisSafeProxy@1.3.0
Timelock Compound: Timelock.sol - 0xA6Db...0EAF
Proxy Admin OpenZeppelin ProxyAdmin@4.7.1 - 0x8b95...2444

Current Testnet Deployment

The current testnet deployment is on holesky, and is from our M2 beta release. You can view the deployed contract addresses below, or check out the code itself on the testnet-holesky branch.

Name Solidity Proxy Implementation Notes
StrategyManager StrategyManager 0xdfB5...D5b6 0x59f7...3a18 Proxy: OpenZeppelin TUP@4.7.1
Strategy: stETH StrategyBaseTVLLimits 0x7D70...63d3 0xFb83...3305 Proxy: OpenZeppelin TUP@4.7.1
Strategy: rETH StrategyBaseTVLLimits 0x3A8f...c4E0 0xFb83...3305 Proxy: OpenZeppelin TUP@4.7.1
Strategy: WETH StrategyBaseTVLLimits 0x8052...FaF9 0xFb83...3305 Proxy: OpenZeppelin TUP@4.7.1
EigenPodManager EigenPodManager 0x3077...e315 0x5265...4a7B Proxy: OpenZeppelin TUP@4.7.1
EigenLayerBeaconOracle succinctlabs/EigenLayerBeaconOracle.sol - 0x4C11...8f25
EigenPod (beacon) EigenPod 0x7261...832D 0xa6AF...bE18 - Beacon: OpenZeppelin BeaconProxy@4.7.1
- Deployed pods use UpgradableBeacon@4.7.1
DelayedWithdrawalRouter DelayedWithdrawalRouter 0x642c...FA32 0xcE8b...3407 Proxy: OpenZeppelin TUP@4.7.1
DelegationManager DelegationManager 0xA441...48e7 0x83f8...0D76 Proxy: OpenZeppelin TUP@4.7.1
AVSDirectory AVSDirectory 0x0557...FeBf 0xEF5B...3e3a Proxy: OpenZeppelin TUP@4.7.1
Slasher Slasher 0xcAe7...6e7C 0x9971...345A Proxy: OpenZeppelin TUP@4.7.1
PauserRegistry PauserRegistry - 0x85Ef...2F06
Timelock Compound: Timelock.sol - 0xcF19...0A7D
Proxy Admin OpenZeppelin ProxyAdmin@4.7.1 - 0xDB02...A6cf