# ithacaxyz/account architecture

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

- Interactive diagram: https://gitdiagram.com/ithacaxyz/account
- Repository: https://github.com/ithacaxyz/account

## Overview

Based on our analysis of the file tree and the README, this project is a smart contract-based account system for decentralized applications – in effect, it’s a crypto wallet/account abstraction system built using modern EVM standards. Its purpose is to offer an “all-in-one” delegation contract based on EIP-7702, with a rich feature set to provide secure login, call batching, gas sponsorship, fine-grained access control, session keys, and more. It also integrates with external projects like Porto and is geared towards seamless cross-chain interactions.

##### Main Components
- Feature Modules: Break down the features mentioned – such as Secure Login (using WebAuthn/Passkeys), Call Batching, Gas Sponsorship, Access Control, Session Keys, etc. Treat each as a logical module or capability within the contract.
- External Integration Services: Identify external integrations and standards such as:
– Identity Verification services (using ZK Passport or similar techniques)
– Recovery options (multi-path recovery via social/email/OAuth providers)
– Cross-chain functionality (ERC7683 for gas management across chains)
- Development & Testing Infrastructure: Include toolchain components like:
– The smart contract source code (located in the “src” directory)
– Dependency libraries (located in “lib” – which includes forge-std and solady, key libraries for Solidity/Foundry-based development)
– Testing suites (in the “test” folder, including utilities and mocks)
– Deployment scripts and configuration (e.g., foundry.toml, deployments.md, and files in the “script” directory)
- Versioning & Documentation: Display supporting elements such as the .changeset directory (for version management), README, changelog, and documentation in “docs”.

##### Relationships and Interactions
- User Interaction: Show how external users (or frontends built on top of the system) interact with the “Account/Delegation Contract” via transactions that invoke various features (login, batch calls, etc.).
- Toolchain & Infrastructure: Illustrate the development flow from source (in “src”) through testing (in “test”) and deployment (via scripts and Foundry config files). Indicate that libraries (in “lib”) provide foundational support.

##### Architectural Patterns and Design Principles
- Modularity: Emphasize separation of concerns by splitting features into individual modules. This mirrors the code structure (modular directories for testing, preparation scripts, and version management).
- Standardization: Note the use of Ethereum standards (EIP-7702 for delegation, ERC7683 for gas handling, etc.) that guide component interactions.
- Extensibility: Illustrate how the design accommodates future integration (e.g., additional recovery or cross-chain functionalities) by using plugin-like interfaces or modular contract design.

##### Relevant Technologies, Frameworks, and Libraries
- Solidity/Foundry for smart contract development (indicated by the foundry.toml, use of forge-std, solady, etc.)
- GitHub Actions workflows for continuous integration and deployment (referenced in .github/workflows)
- JavaScript preparation scripts (in “prep” for version updates) that support the smart contract lifecycle.
- Documentation and versioning tools (e.g., .changeset and docs)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% On-Chain Architecture
    user["User/DApp"]:::external

    subgraph "On-Chain Architecture"
        account["Account/Delegation Contract"]:::onchain
        subgraph "Feature Modules"
            feature1["Secure Login"]:::onchain
            feature2["Call Batching"]:::onchain
            feature3["Gas Sponsorship"]:::onchain
            feature4["Access Control"]:::onchain
            feature5["Session Keys"]:::onchain
        end
    end

    %% External Integration Services
    subgraph "External Integration Services"
        ext1["Identity Verification"]:::external
        ext2["Recovery Options"]:::external
        ext3["Cross-Chain Functionality"]:::external
        ext4["Porto Integration"]:::external
    end

    %% Off-Chain Infrastructure
    subgraph "Off-Chain Infrastructure"
        subgraph "Development & Sources"
            dev1["Smart Contract Source"]:::infra
            dev2["Foundry Config"]:::infra
            dev3["Libraries"]:::infra
        end
        test1["Testing Suites & Mocks"]:::infra
        testUtils["Test Utils"]:::infra
        deploy["Deployment Scripts & Configuration"]:::infra
        prep["Preparation Scripts"]:::infra
    end

    %% Versioning & Documentation
    subgraph "Versioning & Documentation"
        ver1[".changeset"]:::docs
        ver2["CHANGELOG.md"]:::docs
        ver3["README.md"]:::docs
        ver4["Docs"]:::docs
    end

    %% CI/CD Pipeline
    cicd["CI/CD Pipeline"]:::cicd

    %% Connections
    user --> account
    account -->|"uses"| feature1
    account -->|"uses"| feature2
    account -->|"uses"| feature3
    account -->|"uses"| feature4
    account -->|"uses"| feature5

    account -->|"integrates"| ext1
    account -->|"integrates"| ext2
    account -->|"integrates"| ext3
    account -->|"integrates"| ext4

    dev2 --> dev1
    dev3 --> dev1
    dev1 --> account

    dev1 --> test1
    dev1 --> deploy
    prep --> deploy
    cicd --> deploy

    test1 --> testUtils

    %% Click Events
    click account "https://github.com/ithacaxyz/account/tree/main/src"
    click feature1 "https://github.com/ithacaxyz/account/tree/main/src"
    click feature2 "https://github.com/ithacaxyz/account/tree/main/src"
    click feature3 "https://github.com/ithacaxyz/account/tree/main/src"
    click feature4 "https://github.com/ithacaxyz/account/tree/main/src"
    click feature5 "https://github.com/ithacaxyz/account/tree/main/src"

    click ext1 "https://github.com/ithacaxyz/account/tree/main/docs"
    click ext2 "https://github.com/ithacaxyz/account/tree/main/docs"
    click ext3 "https://github.com/ithacaxyz/account/tree/main/docs"
    click ext4 "https://github.com/ithacaxyz/account/tree/main/docs"

    click dev1 "https://github.com/ithacaxyz/account/tree/main/src"
    click dev2 "https://github.com/ithacaxyz/account/blob/main/foundry.toml"
    click dev3 "https://github.com/ithacaxyz/account/tree/main/lib"
    click test1 "https://github.com/ithacaxyz/account/tree/main/test"
    click testUtils "https://github.com/ithacaxyz/account/tree/main/test/utils"

    click deploy "https://github.com/ithacaxyz/account/tree/main/script"
    click prep "https://github.com/ithacaxyz/account/tree/main/prep"

    click ver1 "https://github.com/ithacaxyz/account/blob/main/.changeset"
    click ver2 "https://github.com/ithacaxyz/account/blob/main/CHANGELOG.md"
    click ver3 "https://github.com/ithacaxyz/account/blob/main/README.md"
    click ver4 "https://github.com/ithacaxyz/account/tree/main/docs"

    click cicd "https://github.com/ithacaxyz/account/tree/main/.github/workflows"

    %% Styles
    classDef onchain fill:#87CEFA,stroke:#1E90FF,stroke-width:2px;
    classDef external fill:#FFDAB9,stroke:#FF8C00,stroke-width:2px;
    classDef infra fill:#90EE90,stroke:#228B22,stroke-width:2px;
    classDef docs fill:#F0E68C,stroke:#DAA520,stroke-width:2px;
    classDef cicd fill:#FFB6C1,stroke:#FF69B4,stroke-width:2px;
```
