# immunefi-team/audit-comp-base-everest-contracts architecture

> Architecture diagram of the GitHub repository immunefi-team/audit-comp-base-everest-contracts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/immunefi-team/audit-comp-base-everest-contracts
- Repository: https://github.com/immunefi-team/audit-comp-base-everest-contracts

## Overview

This repository contains Base’s Solidity protocol contracts and operational scripts. A useful high-level workflow is an L1 user initiating a deposit or withdrawal, with L1 portal and proof contracts coordinating with L2 message-passing and bridge contracts; fee and configuration contracts support system operation. The graph also preserves token bridging, dispute-game verification, and deployment as distinct capabilities. Most Solidity implementation files were not sampled, so inferred protocol relationships are shown as dashed edges without evidence paths; only the repository’s overall scope is documented in the README.

Main entry points: [`src/L1/OptimismPortal2.sol`](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/OptimismPortal2.sol) (Portal), [`src/L1/proofs/DisputeGameFactory.sol`](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/DisputeGameFactory.sol) (Dispute game factory), [`src/L1/proofs/AggregateVerifier.sol`](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/AggregateVerifier.sol) (Aggregate verifier), [`scripts/deploy/SystemDeploy.s.sol`](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/scripts/deploy/SystemDeploy.s.sol) (System deployment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_l1["L1 protocol"]
  node_portal["Portal"]
  node_system_config["System config<br/>[SystemConfig.sol]"]
  node_resource_metering["Resource metering"]
  node_l1_messenger["L1 messenger"]
end

subgraph group_l2["L2 protocol"]
  node_l2_messenger["L2 messenger"]
  node_message_passer["Message passer"]
  node_fee_vaults["Fee vaults<br/>[FeeVault.sol]"]
  node_gas_oracle["Gas price oracle<br/>[GasPriceOracle.sol]"]
end

subgraph group_proofs["Proof system"]
  node_proof_factory["Dispute game factory"]
  node_anchor_registry["Anchor registry"]
  node_aggregate_verifier["Aggregate verifier"]
  node_tee_verifier["TEE verifier<br/>[TEEVerifier.sol]"]
  node_zk_verifier["ZK verifier<br/>[ZKVerifier.sol]"]
end

subgraph group_bridging["Cross-chain bridges"]
  node_l1_bridge["L1 standard bridge"]
  node_l1_erc721["L1 NFT bridge<br/>[L1ERC721Bridge.sol]"]
  node_l2_bridge["L2 standard bridge"]
  node_l2_erc721["L2 NFT bridge<br/>[L2ERC721Bridge.sol]"]
  node_mintable_tokens["Mintable tokens"]
end

subgraph group_operations["Operations"]
  node_deployment["System deployment<br/>[SystemDeploy.s.sol]"]
end

node_user(("L1 user"))

node_user -.->|"initiates deposit"| node_portal
node_portal -.->|"reads configuration"| node_system_config
node_portal -.->|"uses metering"| node_resource_metering
node_portal -.->|"checks dispute game"| node_proof_factory
node_proof_factory -.->|"uses anchor state"| node_anchor_registry
node_proof_factory -.->|"verifies proofs"| node_aggregate_verifier
node_aggregate_verifier -.->|"dispatches verification"| node_tee_verifier
node_aggregate_verifier -.->|"dispatches verification"| node_zk_verifier
node_portal -.->|"routes messages"| node_l1_messenger
node_l1_messenger -.->|"sends messages"| node_l2_messenger
node_l2_messenger -.->|"records withdrawal"| node_message_passer
node_l1_bridge -.->|"bridges tokens"| node_l2_bridge
node_l1_erc721 -.->|"bridges NFTs"| node_l2_erc721
node_l2_bridge -.->|"uses token"| node_mintable_tokens
node_gas_oracle -.->|"supports fee accounting"| node_fee_vaults
node_deployment -.->|"deploys protocol"| node_portal
node_deployment -.->|"deploys protocol"| node_system_config

click node_portal "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/OptimismPortal2.sol"
click node_system_config "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/SystemConfig.sol"
click node_resource_metering "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/ResourceMetering.sol"
click node_l1_messenger "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/L1CrossDomainMessenger.sol"
click node_l1_bridge "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/L1StandardBridge.sol"
click node_l1_erc721 "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/L1ERC721Bridge.sol"
click node_l2_messenger "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/L2CrossDomainMessenger.sol"
click node_message_passer "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/L2ToL1MessagePasser.sol"
click node_l2_bridge "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/L2StandardBridge.sol"
click node_l2_erc721 "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/L2ERC721Bridge.sol"
click node_mintable_tokens "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/universal/OptimismMintableERC20.sol"
click node_proof_factory "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/DisputeGameFactory.sol"
click node_anchor_registry "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/AnchorStateRegistry.sol"
click node_aggregate_verifier "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/AggregateVerifier.sol"
click node_tee_verifier "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/tee/TEEVerifier.sol"
click node_zk_verifier "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/zk/ZKVerifier.sol"
click node_fee_vaults "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/FeeVault.sol"
click node_gas_oracle "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/GasPriceOracle.sol"
click node_deployment "https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/scripts/deploy/SystemDeploy.s.sol"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_portal,node_system_config,node_resource_metering,node_l1_messenger,node_user toneBlue
class node_l2_messenger,node_message_passer,node_fee_vaults,node_gas_oracle toneAmber
class node_proof_factory,node_anchor_registry,node_aggregate_verifier,node_tee_verifier,node_zk_verifier toneMint
class node_l1_bridge,node_l1_erc721,node_l2_bridge,node_l2_erc721,node_mintable_tokens toneRose
class node_deployment toneIndigo
```

## Components

### L1 protocol

- [Portal](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/OptimismPortal2.sol): `src/L1/OptimismPortal2.sol`
- [System config](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/SystemConfig.sol): `src/L1/SystemConfig.sol`
- [Resource metering](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/ResourceMetering.sol): `src/L1/ResourceMetering.sol`
- [L1 messenger](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/L1CrossDomainMessenger.sol): `src/L1/L1CrossDomainMessenger.sol`

### L2 protocol

- [L2 messenger](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/L2CrossDomainMessenger.sol): `src/L2/L2CrossDomainMessenger.sol`
- [Message passer](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/L2ToL1MessagePasser.sol): `src/L2/L2ToL1MessagePasser.sol`
- [Fee vaults](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/FeeVault.sol): `src/L2/FeeVault.sol`
- [Gas price oracle](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/GasPriceOracle.sol): `src/L2/GasPriceOracle.sol`

### Proof system

- [Dispute game factory](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/DisputeGameFactory.sol): `src/L1/proofs/DisputeGameFactory.sol`
- [Anchor registry](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/AnchorStateRegistry.sol): `src/L1/proofs/AnchorStateRegistry.sol`
- [Aggregate verifier](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/AggregateVerifier.sol): `src/L1/proofs/AggregateVerifier.sol`
- [TEE verifier](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/tee/TEEVerifier.sol): `src/L1/proofs/tee/TEEVerifier.sol`
- [ZK verifier](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/proofs/zk/ZKVerifier.sol): `src/L1/proofs/zk/ZKVerifier.sol`

### Cross-chain bridges

- [L1 standard bridge](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/L1StandardBridge.sol): `src/L1/L1StandardBridge.sol`
- [L1 NFT bridge](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L1/L1ERC721Bridge.sol): `src/L1/L1ERC721Bridge.sol`
- [L2 standard bridge](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/L2StandardBridge.sol): `src/L2/L2StandardBridge.sol`
- [L2 NFT bridge](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/L2/L2ERC721Bridge.sol): `src/L2/L2ERC721Bridge.sol`
- [Mintable tokens](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/src/universal/OptimismMintableERC20.sol): `src/universal/OptimismMintableERC20.sol`

### Operations

- [System deployment](https://github.com/immunefi-team/audit-comp-base-everest-contracts/blob/audit-competition/scripts/deploy/SystemDeploy.s.sol): `scripts/deploy/SystemDeploy.s.sol`

### Other components

- **L1 user**

## Connections

- L1 user → Portal: initiates deposit
- Portal → System config: reads configuration
- Portal → Resource metering: uses metering
- Portal → Dispute game factory: checks dispute game
- Dispute game factory → Anchor registry: uses anchor state
- Dispute game factory → Aggregate verifier: verifies proofs
- Aggregate verifier → TEE verifier: dispatches verification
- Aggregate verifier → ZK verifier: dispatches verification
- Portal → L1 messenger: routes messages
- L1 messenger → L2 messenger: sends messages
- L2 messenger → Message passer: records withdrawal
- L1 standard bridge → L2 standard bridge: bridges tokens
- L1 NFT bridge → L2 NFT bridge: bridges NFTs
- L2 standard bridge → Mintable tokens: uses token
- Gas price oracle → Fee vaults: supports fee accounting
- System deployment → Portal: deploys protocol
- System deployment → System config: deploys protocol
