🚧 The Slasher contract is under active development and its interface expected to change. We recommend writing slashing logic without integrating with the Slasher at this point in time. 🚧
EigenLayer is a set of smart contracts deployed on Ethereum that enable restaking of assets to secure new services.
We recommend starting with the technical documentation to get an overview of the contracts before diving into the code.
For deployment addresses on both mainnet and Goerli, see Deployments below.
foundryup
forge install
This repository uses Foundry as a smart contract development toolchain.
See the Foundry Docs for more info on installation and usage.
You will notice that we also have hardhat installed in this repo. This is only used to generate natspec docgen. This is our workaround until foundry finishes implementing the forge doc
command.
To generate the docs, run npx hardhat docgen
(you may need to run npm install
first).
Prior to running tests, you should set up your environment. At present this repository contains fork tests against ETH mainnet; your environment will use an RPC_MAINNET
key to run these tests. See the .env.example
file for an example -- two simple options are to copy the LlamaNodes RPC url to your env
or use your own infura API key in the provided format. If you don't set the RPC_MAINNET
key then the test cases will default to LlamaNodes RPC url when fork testing.
The main command to run tests is:
forge test -vv
Environment config is contained in config.yml. Before running the following commands, install yq. Then set up the environment with this script:
source source-env.sh [CHAIN]
For example, on goerli: source source-env.sh goerli
. Currently options for [CHAIN]
are goerli
, local
. Then to run the actual tests:
forge test --fork-url [RPC_URL]
solhint 'src/contracts/**/*.sol'
slither .
First install surya
then run
surya inheritance ./src/contracts/**/*.sol | dot -Tpng > InheritanceGraph.png
and/or
surya graph ./src/contracts/middleware/*.sol | dot -Tpng > MiddlewareControlFlowGraph.png
and/or
surya mdreport surya_report.md ./src/contracts/**/*.sol