How propeller-heads/tycho-simulation works
Project type and purpose
• This is an open-source simulation tool (a Rust crate with Python bindings) designed to move slow on-chain computations off chain and simulate token-exchange protocols (Uniswap V2/V3, Balancer V2, Curve, etc.).
• Core logic lives in Rust (src/…), and there is a Python wheel wrapper (tycho_simulation_py/) plus CLI/example entry points (examples/).
File structure
• Top level:
• Cargo.toml / src/… → Rust library (“tycho-simulation”)
• examples/quickstart & price_printer → Rust binary examples & simple UIs
• tests/ → integration tests and protocol snapshots
• tycho_simulation_py/ → Python package + Rust/PyO3 shim + Dockerfile
• Key Rust modules:
• evm/ → general EVM simulation engine (decoder, engine_db backends, traces, tycho_models)
• evm/protocol/… → built-in protocol implementations (Uniswap V2–V4, CPMM, Ekubo) & VM-based adapters
• protocol/ → native ProtocolSim trait and state implementations
• utils.rs, serde_helpers.rs → shared utilities
• Build & CI:
• .github/workflows/*.yaml → CI pipelines (lint, tests, release)
• rust-toolchain.toml, clippy.toml, rustfmt.toml → formatting & lint config
• release.config.js → wheel packaging
README for insights
• Describes “move on-chain computations off-chain” via a ProtocolSim trait
• Two extension points: native protocols (in src/protocol) and VM protocols (in src/evm/protocol/vm + bytecode assets)
• Quickstart and full docs referenced