This directory contains a variety of examples demonstrating the capabilities of the Soroban Debugger, including sample contracts, plugins, and specialized test cases.
- Auth Example: Demonstrates common authentication pitfalls (
*_buggyfunctions) and their secure counterparts. Perfect for seeing how unauthorized access attempts appear in debugger traces. - Multisig Wallet: A complex example showing M-of-N authorization patterns and proposal execution.
- DEX: A simple decentralized exchange showing reserve management and price calculations through storage updates.
- Escrow: Demonstrates time-locked state transitions (Pending -> Released/Refunded) and event emission.
- Simple Token: Standard token implementation showing balance tracking and allowance management.
- Multisig proposals: Shows how a contract can propose and eventually execute calls to other "target" contracts.
- Voting: Demonstrates coordination between users and centralized state.
- Unbounded Iteration Test: A standalone example showing how the
SecurityAnalyzerdetects gas-exhaustion loops and storage-write pressure with confidence scores.
- Example Logger Plugin: A full implementation of a debugger plugin. Demonstrates how to hook into execution events, add custom CLI commands, and manage plugin state.
- Mock Usage: Shows how to use the
soroban-debug-mockcrate to pre-populate contract storage from JSON snapshots for unit testing.
| I want to... | Use this Example |
|---|---|
| Debug auth failures | contracts/auth-example |
| Visualize storage changes | contracts/dex or contracts/escrow |
| Detect gas loops/vulnerabilities | test_unbounded_iteration.rs |
| Extend the debugger CLI | plugins/example_logger |
| Pre-populate state for tests | mock-usage |
| Replay a specific transaction | Use trace_a.json or trace_b.json with the --replay flag |
*.json(Snapshots & Traces): Sample ledger states (snapshot.json) and execution traces (trace_a.json) that can be loaded directly into the debugger.batch_args.json: Demonstrates how to run the debugger in batch mode for CI or automated auditing.analyzer-suppressions.toml: Example configuration for filtering security analyzer findings.