Skip to content

Latest commit

 

History

History
124 lines (97 loc) · 4.15 KB

File metadata and controls

124 lines (97 loc) · 4.15 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

The spec is SPEC.md.

Project Overview

This is a WAVS (WebAssembly AVS) monorepo template that integrates with Ethereum Attestation Service (EAS) for building verifiable offchain applications. The project combines:

  • Solidity contracts for blockchain interaction (EAS attestations, triggers, submissions)
  • Rust WASI components for WebAssembly execution in the WAVS runtime
  • TypeScript/JavaScript components for alternative WASI implementations
  • Foundry for Solidity development and testing
  • Docker for containerized services and deployment

Architecture

The system follows a trigger-response pattern:

  1. Trigger contracts emit events that WAVS monitors
  2. WASI components process these events and perform computations
  3. Submission contracts receive and store results from WAVS operators
  4. EAS integration enables attestation-based workflows

Key directories:

  • src/ - Solidity contracts (triggers, submissions, EAS integration)
  • docs/ - Documentation for WAVS
  • components/ - WASI components in Rust and TypeScript
  • test/ - Foundry unit tests
  • script/ - Deployment and utility scripts

Development Commands

Setup

make setup                    # Install all dependencies (npm + forge)
make check-requirements      # Verify system dependencies

Building

make build                   # Build all (Solidity + WASI components)
forge build                  # Build Solidity contracts only
make wasi-build             # Build WASI components only
WASI_BUILD_DIR=components/eas-attest make wasi-build  # Build specific component

Testing

forge test                   # Run all Solidity tests
forge test -vvv             # Run with verbose output
npm run test:unit           # Run unit tests specifically
npm run test:integration    # Run integration tests

Linting and Formatting

npm run lint:check          # Check Solidity and formatting
npm run lint:fix           # Fix linting and formatting issues
forge fmt                   # Format Solidity code
cargo fmt                   # Format Rust code

WASI Component Testing

# Test a component locally (example with Bitcoin price feed)
COIN_MARKET_CAP_ID=1 make wasi-exec

Local Development Environment

make start-all-local        # Start anvil, IPFS, WARG, telemetry services
# This creates .env from .env.example if it doesn't exist

Component Development

Rust WASI Components

Located in components/*/src/lib.rs. Components must:

  • Implement the Guest trait from bindings
  • Handle TriggerAction input and return WasmResponse
  • Use the trigger module for encoding/decoding blockchain data
  • Support both Ethereum (ABI-encoded) and CLI output destinations

TypeScript WASI Components

Located in components/*/index.ts. Similar patterns to Rust but using:

  • JavaScript/TypeScript instead of Rust
  • Same trigger/response pattern
  • Fetch API for HTTP requests

Contract Development

Key Contracts

  • WavsTrigger.sol - Emits events for WAVS to monitor
  • WavsSubmit.sol - Receives and stores computation results
  • EAS integration contracts in src/contracts/ for attestations

Testing

  • Unit tests in test/unit/
  • Use Foundry's testing framework
  • Mock external dependencies where appropriate

Deployment

The deployment process involves multiple steps coordinated through shell scripts:

  1. Deploy EigenLayer contracts (make wavs-middleware)
  2. Deploy service contracts (script/deploy-contracts.sh)
  3. Build and upload WASI components (script/upload-to-wasi-registry.sh)
  4. Configure aggregator and WAVS operator instances

Environment Variables

Key variables (see .env.example):

  • RPC_URL - Ethereum RPC endpoint
  • WAVS_ENDPOINT - WAVS service endpoint
  • Various contract addresses set during deployment

Tooling

  • Foundry - Solidity development (forge, cast, anvil)
  • Cargo - Rust toolchain for WASI components
  • Docker - Container orchestration
  • Make - Build automation and task running
  • Node.js v21+ - JavaScript runtime and npm packages