Skip to content

[core] Define Position, LiquidationOpportunity, FlashLoanSource, SwapRoute types #3

@obchain

Description

@obchain

Context

Normalized data shapes used across every layer. Every lending protocol (Venus now, Aave / Compound / Morpho later) reduces to the same Position type after the adapter layer, so scanner and executor stay protocol-agnostic.

Scope

  • Position — borrower, collateral/debt tokens and amounts, health factor, liquidation bonus
  • LiquidationOpportunity — a profitable, ready-to-execute liquidation
  • FlashLoanSource — enum: BalancerV2 (0%), AaveV3 (0.05%), UniswapV3 (pool fee)
  • SwapRoute — planned collateral → debt DEX swap with slippage protection
  • ProtocolId — enum naming the protocol (Venus for v1)
  • LiquidationParams — protocol-specific call parameters (Venus variant for v1)
  • All types derive Serialize / Deserialize for config + logging

Acceptance criteria

  • All six types defined in charon-core/src/types.rs
  • Address and U256 from alloy::primitives used correctly
  • All types derive Debug, Clone, Serialize, Deserialize
  • charon-core compiles with alloy + serde as dependencies

References

  • Delivered in commit 2371853
  • PRD section 3a (Core Types)

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:rustRust crates (core / scanner / protocols / executor / cli)priority:p1-coreCore MVP scopestatus:readyScoped and ready to pick uptype:featureNew capability or deliverable

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions