Skip to content

Feature: Solidity compilation and watch mode #7

Description

@roninjin10

Overview

Add Solidity compilation support to Chop, enabling users to compile .sol files directly within the CLI.

Motivation

  • Eliminate need for external Solidity tooling
  • Streamline contract testing workflow
  • Enable hot-reload development workflow

Features to Implement

1. Compiler Integration

  • Integrate Guillotine's foundry-wrapper (from primitives repo)
  • Add compile command for single-file compilation
  • Support both inline source and file input
  • Multiple output formats (JSON, hex, combined)
  • Optimizer control and EVM version targeting
  • Error/warning collection and display

2. Watch Mode

  • Add --watch flag to monitor .sol files
  • Use fsnotify for file system monitoring
  • Auto-recompile on changes
  • Auto-deploy on successful compilation

3. TUI Integration

  • Add "Compiler" tab (8th tab) with:
    • File selector for .sol files in current directory
    • Compile button with progress indicator
    • Display compilation errors/warnings
    • Show generated bytecode and ABI
    • "Deploy" button to deploy compiled contract

Implementation Notes

  • Follow patterns from TEVM CLI (tevm-monorepo/cli/src/commands/compile.tsx)
  • Follow patterns from Guillotine CLI (guillotine/apps/cli/commands/compile.go)
  • Ensure thread-safe compilation when watch mode is active

Dependencies

  • foundry-wrapper from evmts/primitives
  • fsnotify for watch mode

Related

  • Builds on server infrastructure from Phase 1
  • May integrate with forking support for testing against mainnet state

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions