Skip to content

[executor] End-to-end pipeline wiring: scanner → profit calc → router → tx builder #16

@obchain

Description

@obchain

Context

The first time everything hangs together. listen subcommand of the CLI should:

  1. Spawn the block listener
  2. Feed blocks into the health scanner
  3. Promote liquidatable positions through the profit calculator
  4. Route through the flash-loan router
  5. Hand off to the tx builder + simulator

This is the moment we can see "would liquidate X for $Y profit" appear in the logs end-to-end, even without a deployed contract or signer.

Scope

  • Wire all crates together in charon-cli/src/main.rs under the listen subcommand
  • ProfitCalculator: gross = collateral × bonus_bps / 10000, net = gross - gas - flash_fee - slippage_estimate
  • Drop opportunities below bot.min_profit_usd from config
  • Each stage logs what it consumed and what it emitted
  • No signing / no broadcast — pipeline ends at the simulation gate

Acceptance criteria

  • cargo run -- --config config/default.toml listen runs the full pipeline
  • For each block: scanner → profit calc → router → tx builder logs are visible in order
  • Unprofitable opportunities are dropped with a DEBUG log
  • Profitable opportunities log the full encoded tx (hex) and the simulation result
  • Runs 5+ minutes against BSC mainnet without panicking

References

  • PRD section 2b (Hot-Path Sequence)
  • PRD Diagram 02 (End-to-End Hot Path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:rustRust crates (core / scanner / protocols / executor / cli)priority:p0-blockerBlocks the critical pathstatus:readyScoped and ready to pick uptype:featureNew capability or deliverable

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions