Skip to content

[PR #28] Trait missing health_factor and liquidation_incentive query methods #74

@obchain

Description

@obchain

PR: #28 (feat/03-lending-protocol-trait)
File: crates/charon-core/src/traits.rs

Trait has 4 methods: id, fetch_positions, get_liquidation_params, build_liquidation_calldata. Missing:

  1. async fn get_health_factor(&self, borrower: Address, block: BlockNumberOrTag) -> Result<U256> — scanner 3-bucket HF classifier (PR feat(scanner): 3-bucket DashMap health-factor scanner #34) is the gating layer; cannot compute without this.
  2. fn get_close_factor(&self, market: Address) -> U256 — Venus close factor is 50% default but configurable per-market. Required for repay_amount bound check.
  3. fn get_liquidation_incentive(&self, collateral_market: Address) -> Result<U256> — per-market on Venus (e.g., 10% default, asset-specific overrides). Profit calculator (PR feat(core): gas-aware profit calculator + profit-ordered OpportunityQueue #40) needs this to estimate seized collateral before calldata build.

Impact: Scanner and profit calculator have no protocol-agnostic query surface. Either they reach into Venus-specific adapter state (breaks abstraction) or duplicate math in every crate.

Fix: Add the three methods above to the trait. Keep them narrowly typed (no struct bag) so Aave / Compound impls can map directly onto their equivalents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:rustRust crates (core / scanner / protocols / executor / cli)pr-reviewFindings from PR review processpriority:p1-coreCore MVP scope

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions