# layr-labs/eigenlayer-contracts architecture

> Architecture diagram of the GitHub repository layr-labs/eigenlayer-contracts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/layr-labs/eigenlayer-contracts
- Repository: https://github.com/layr-labs/eigenlayer-contracts

## Overview

##### Major Functional Areas
- Core Smart Contracts – These are in the “src/contracts” folder (under the “core” subdirectory) and include key contracts like DelegationManager, StrategyManager, AVSDirectory, Slasher, and RewardsCoordinator. They implement the main protocol logic.
- Pods and Operator Management – Under “src/contracts/pods” (and related dependencies in “docs” and “certora”) are contracts like EigenPod and EigenPodManager. These deal with operator services and help manage restaking for service providers.
- Token Components – Located in “src/contracts/token” and with corresponding Go bindings in “pkg/bindings”, contracts like Eigen and BackingEigen manage the native tokens.
- Permissions & Governance – The “permissions” subdirectory and multisig and timelock contracts (the multisig items in the README and also PermissionController related contracts) should be considered distinct components within the governance/control layer.
- Supporting Tools & Infrastructure – The file tree includes a host of deployment scripts (in “script”), Docker and devcontainer configurations, Foundry configuration (foundry.toml and Makefile), as well as automated testing and static analysis tools. Although these are not part of the on-chain runtime architecture, they are crucial for the development and deployment pipelines.

##### Architectural Patterns and Technologies
- Integration with external services: The protocol references interactions with the beacon chain (for Beacon Chain ETH) and Layer-2 or off-chain testing environments (as seen in the “script” folder and fork tests).
- That the build and testing setup is powered by Foundry (commands like “forge build” and “forge test”), and there are multiple configuration files (Dockerfile, Makefile, foundry.toml, etc.) that support project automation.

##### Additional Elements
- Each component (e.g., “DelegationManager”, “StrategyManager”, etc.) should have clear labels.
- Deployment and testing infrastructure (DevContainer, Docker, Foundry, CI workflows) as a side note to capture the overall development ecosystem.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    U("User"):::user

    %% Core Protocol Contracts
    subgraph "Core Protocol Contracts"
        DM("DelegationManager"):::core
        SM("StrategyManager"):::core
        AVS("AVSDirectory"):::core
        SLS("Slasher"):::core
        RC("RewardsCoordinator"):::core
        AM("AllocationManager"):::core
    end

    %% Strategy & Proxy Patterns
    subgraph "Strategy & Proxy Patterns"
        SB("StrategyBase_Contract"):::strategy
        SBb("StrategyBase_Binding"):::strategy
        SF("StrategyFactory_Contract"):::strategy
        SFb("StrategyFactory_Binding"):::strategy
        TUP("TransparentUpgradeableProxy"):::proxy
        BP("BeaconProxy"):::proxy
        UB("UpgradeableBeacon"):::proxy
    end

    %% Pods and Operator Management
    subgraph "Pods and Operator Management"
        EP("EigenPod"):::pods
        EPM("EigenPodManager"):::pods
        DWR("DelayedWithdrawalRouter"):::pods
    end

    %% Token Components
    subgraph "Token Components"
        E("Eigen"):::token
        BE("BackingEigen"):::token
    end

    %% Permissions & Governance
    subgraph "Permissions & Governance"
        PC("PermissionController"):::governance
        PR("PauserRegistry"):::governance
        MS("Multisig"):::governance
        TL("Timelock"):::governance
    end

    %% Supporting Tools & Infrastructure
    subgraph "Supporting Tools & Infrastructure"
        DS("DeploymentScripts"):::infra
        DC("DevConfig"):::infra
        TA("TestingAnalysis"):::infra
    end

    %% Relationships
    U -->|"deposits_to"| DM
    DM -->|"calls_to"| SM
    DM -->|"reports_to"| RC
    SM -->|"selects_strategy"| SF
    SF -->|"deploys_via_proxy"| TUP
    TUP -->|"delegates_to"| SB
    BP -->|"delegates_to"_| UB
    SM -->|"uses_strategy"| SB
    SM -->|"uses_strategy"| SF
    RC -->|"rewards"| E
    RC -->|"rewards"| BE
    DM -->|"invokes_ops"| EPM
    EPM -->|"manages"| EP
    EPM -->|"routes_withdrawals"| DWR
    PC -->|"controls"| DM
    PC -->|"controls"| SM
    PR -->|"supports"| PC
    MS -->|"governs"| PC
    TL -->|"enforces"| PC

    %% Infrastructure interactions (development tools assist core and strategy layers)
    DS --- DM
    DS --- SF
    DC --- DS
    TA --- DS

    %% Styles
    classDef user fill:#ffcccb,stroke:#333,stroke-width:2px;
    classDef core fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef strategy fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef proxy fill:#98fb98,stroke:#333,stroke-width:2px;
    classDef pods fill:#ffdead,stroke:#333,stroke-width:2px;
    classDef token fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef governance fill:#f08080,stroke:#333,stroke-width:2px;
    classDef infra fill:#d3d3d3,stroke:#333,stroke-width:2px;

    %% Click Events
    click DM "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/core"
    click SM "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/core"
    click AVS "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/core"
    click SLS "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/core"
    click RC "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/core"
    click AM "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/core"

    click SB "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/strategies"
    click SBb "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/pkg/bindings/StrategyBase"
    click SF "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/strategies"
    click SFb "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/pkg/bindings/StrategyFactory"
    click TUP "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/script/deploy"
    click BP "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/script/deploy"
    click UB "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/script/deploy"

    click EP "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/pods"
    click EPM "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/pods"
    click DWR "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/pods"

    click E "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/token"
    click BE "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/token"

    click PC "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/permissions"
    click PR "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/permissions"
    click MS "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/permissions"
    click TL "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/contracts/permissions"

    click DS "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/script/deploy"
    click DC "https://github.com/layr-labs/eigenlayer-contracts/blob/dev/.devcontainer"
    click TA "https://github.com/layr-labs/eigenlayer-contracts/tree/dev/src/test"
```
