# morpho-org/morpho-blue-bundlers architecture

> Architecture diagram of the GitHub repository morpho-org/morpho-blue-bundlers, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/morpho-org/morpho-blue-bundlers
- Repository: https://github.com/morpho-org/morpho-blue-bundlers

## Overview

##### Main Components

a) Core Components:
- Morpho Blue Protocol (external dependency)
- Base Bundler (abstract foundation)
- Chain-specific Bundlers (Ethereum, Goerli, Sepolia)
- Domain-specific Bundlers
- MetaMorpho Integration
- External Protocols Integration (Aave, Compound)

b) Supporting Components:
- Libraries and Utilities
- Testing Infrastructure
- Configuration Management
- Security Components (Permit handlers)

##### Specific Elements

a) Component Representations:
- Use rectangles for concrete implementations
- Use hexagons for external protocols

b) Connection Types:
- Double lines for main data flow

##### Technical Details

- Optimization settings (80,000 runs for EthereumBundlerV2)
- Interface connections
- Library dependencies
- Configuration management flow

##### Notes Section

A notes section indicating:
- Deployment considerations
- Chain-specific variations
- Security audit coverage
- License information (GPL-2.0-or-later)

Remember to emphasize the modular nature of the system, showing how different bundlers can be composed and how the chain-specific implementations maintain consistency while accommodating local requirements.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External["External Protocols"]
        MB["Morpho Blue Protocol"]:::external
        MM["MetaMorpho"]:::external
        AV2["Aave V2"]:::external
        CV2["Compound V2"]:::external
        CV3["Compound V3"]:::external
        URD["Universal Rewards Distributor"]:::external
    end

    subgraph Core["Core Components"]
        BB["Base Bundler"]:::core
        CI["Core Interfaces"]:::core
        LIB["Libraries"]:::core
    end

    subgraph Chain["Chain-specific Implementation"]
        direction TB
        ETH["Ethereum Bundler"]:::chain
        GOR["Goerli Bundler"]:::chain
        SEP["Sepolia Bundler"]:::chain
    end

    subgraph Config["Configuration"]
        BC["Base Config"]:::config
        EC["Ethereum Config"]:::config
    end

    subgraph Migration["Migration Components"]
        direction TB
        MB2["Migration Bundler V2"]:::migration
        AMB["Aave Migration"]:::migration
        CMB["Compound Migration"]:::migration
    end

    subgraph Testing["Testing Infrastructure"]
        MT["Main Tests"]:::test
        FT["Fork Tests"]:::test
        MGT["Migration Tests"]:::test
    end

    %% Relationships
    MB --> BB
    BB --> ETH
    BB --> GOR
    BB --> SEP
    BB --> CI
    BB --> LIB

    ETH --> MB2
    MB2 --> AMB
    MB2 --> CMB
    AMB --> AV2
    CMB --> CV2
    CMB --> CV3

    BC --> BB
    EC --> ETH

    MM --> BB
    URD --> BB

    %% Styles
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px
    classDef core fill:#4169E1,stroke:#333,stroke-width:2px
    classDef chain fill:#32CD32,stroke:#333,stroke-width:2px
    classDef config fill:#A9A9A9,stroke:#333,stroke-width:2px
    classDef migration fill:#9370DB,stroke:#333,stroke-width:2px
    classDef test fill:#F08080,stroke:#333,stroke-width:2px

    %% Click Events
    click ETH "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/src/ethereum"
    click GOR "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/src/goerli"
    click SEP "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/src/sepolia"
    click CI "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/src/interfaces"
    click LIB "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/src/libraries"
    click MB2 "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/src/migration"
    click AMB "https://github.com/morpho-org/morpho-blue-bundlers/blob/main/certora/confs/AaveV2MigrationBundlerV2.conf"
    click CMB "https://github.com/morpho-org/morpho-blue-bundlers/blob/main/certora/confs/CompoundV2MigrationBundlerV2.conf"
    click BC "https://github.com/morpho-org/morpho-blue-bundlers/blob/main/config/base.json"
    click EC "https://github.com/morpho-org/morpho-blue-bundlers/blob/main/config/ethereum.json"
    click MT "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/test/"
    click FT "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/test/fork"
    click MGT "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/test/fork/migration"
    click MM "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/lib/metamorpho"
    click MB "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/lib/morpho-blue"
    click URD "https://github.com/morpho-org/morpho-blue-bundlers/tree/main/lib/universal-rewards-distributor"
```
