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.
The most up to date mainnet and testnet deployment addresses can be found on our docs site.
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:
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.
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
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]
- Install solhint, then run:
solhint 'src/contracts/**/*.sol'
- Install slither, then run:
slither .
- Install surya and graphviz:
npm i -g surya
apt install graphviz
- Then, run:
surya inheritance ./src/contracts/**/*.sol | dot -Tpng > InheritanceGraph.png
surya mdreport surya_report.md ./src/contracts/**/*.sol