Skip to content

[scanner] Health-factor scanner: 3-bucket DashMap classification (healthy / near-liq / liquidatable) #10

@obchain

Description

@obchain

Context

Per-block, the scanner recomputes health factors and bucket-sorts positions. Healthy positions can be sampled less often; near-liquidation positions need pre-computed transactions ready to fire; liquidatable positions trigger the executor pipeline. DashMap gives us lock-free concurrent writes across protocol/chain tasks.

Scope

  • charon-scanner/src/scanner.rs with a HealthScanner struct
  • Three DashMap<Address, Position> buckets: healthy, near-liquidation, liquidatable
  • Configurable thresholds in [bot] section (e.g. liquidatable_threshold = 1.0, near_liquidation_threshold = 1.05)
  • Runs on every newHead from the block listener
  • Emits a per-block log line with counts per bucket
  • Pushes liquidatable positions into a channel for the executor

Acceptance criteria

  • dashmap added to workspace dependencies and charon-scanner
  • Three-bucket classification works against mocked positions
  • Thresholds read from config, not hardcoded
  • Per-block log: INFO scanner: block=N healthy=X near_liq=Y liquidatable=Z
  • No lock contention — DashMap used in place of Mutex<HashMap>

References

  • PRD section 4c (Health Factor Scanner)

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