How defiaudit0x/smart-contract-auditor works
Smart Contract Auditor accepts contract code through web/API and CLI entry points, routes requests to audit modes, and combines multi-pass LLM analysis with deterministic scans and verification to produce findings and reports. Its documented capabilities also include multi-language analysis, streaming, diff audits, gas profiling, SBOM and SARIF output, and persistent learned knowledge. The graph uses README statements and SOURCE INDEX references; unsampled implementation details are represented only where those sources support the relationship.
Main entry points: orchestrator.py Analysis dispatch · pipeline.py LLM pipeline · audit_service.py Audit service · pre_scan.py Parallel pre-scan
Components 24
User interfaces
- Web interface
web_ui.py - REST API
api_routes.py - CLI
main.py
Audit orchestration
- Audit service
audit_service.py - Analysis dispatch
orchestrator.py
Analysis engines
- LLM pipeline
agents/pipeline.py - Parallel pre-scan
agents/pre_scan.py - Model clients
agents/llm_client.py - Static analysis
static_analysis - Language analyzers
analyzers - Multi-model audit
multiaudit.py - Hierarchical audit
hierarchical_audit.py - Diff audit
diff_audit.py - Gas profiling
gas_profiler.py
Verification and reports
- Finding validation
agents/validation.py - Audit gate
gate_validator.py - CVSS scoring
cvss_scorer.py - Report formats
sarif_export.py - SBOM generation
sbom.py
Learning and knowledge
- Pattern learner
agents/pattern_learner.py - Knowledge retrieval
knowledge_base/rag.py - Knowledge database
knowledge_base/db.py
Other components
- Auditor user
- LLM provider
Connections 33
- Auditor user → Web interface: submits code
- Auditor user → REST API: submits code
- Auditor user → CLI: runs audit
- REST API → Analysis dispatch: routes analysis
api_routes.py - Web interface → Analysis dispatch: dispatches analysis
- CLI → Audit service: runs audit
main.py - Audit service → Multi-model audit: runs multi-audit
audit_service.py - Audit service → Hierarchical audit: runs hierarchical
audit_service.py - Audit service → Diff audit: runs diff audit
audit_service.py - Analysis dispatch → LLM pipeline: dispatches audit
orchestrator.py - Analysis dispatch → Multi-model audit: dispatches mode
orchestrator.py - Analysis dispatch → Hierarchical audit: dispatches mode
orchestrator.py - Analysis dispatch → Static analysis: dispatches analysis
orchestrator.py - Analysis dispatch → Gas profiling: dispatches analysis
orchestrator.py - LLM pipeline → Parallel pre-scan: runs pre-scan
agents/pipeline.py - LLM pipeline → Finding validation: validates findings
agents/pipeline.py - LLM pipeline → Model clients: requests analysis
agents/pipeline.py - Model clients → LLM provider: sends prompts
agents/llm_client.py - Parallel pre-scan → Pattern learner: loads learned patterns
agents/pre_scan.py - Parallel pre-scan → SBOM generation: runs scan
agents/pre_scan.py - Finding validation → CVSS scoring: scores findings
agents/validation.py - Finding validation → Audit gate: applies gate
- LLM pipeline → Knowledge retrieval: retrieves context
agents/pipeline.py - Pattern learner → Model clients: mines candidates
agents/pattern_learner.py - Knowledge retrieval → Knowledge database: queries patterns
knowledge_base/rag.py - Pattern learner → Knowledge database: stores patterns
- Audit service → Report formats: exports reports
- Auditor user → Diff audit: compares versions
- Auditor user → Gas profiling: requests profiling
- Auditor user → SBOM generation: requests SBOM
- Auditor user → Report formats: requests SARIF
- Auditor user → LLM provider: configures provider
- LLM pipeline → Language analyzers: analyzes contracts
agents/pipeline.py