Skip to content

[flashloan] AaveFlashLoan.available_liquidity ignores paused and frozen reserve flags #137

@obchain

Description

@obchain

Refs #39

File: crates/charon-flashloan/src/aave.rs — available_liquidity()

Problem

The adapter reads the aToken underlying ERC-20 balance to report available liquidity. Aave V3 reserves carry two binary flags that block flash loans regardless of balance:

  • paused (bit 60 of configuration word): emergency mode, flashLoanSimple reverts immediately
  • frozen (bit 57): no new borrows or flash loans; repayments only

Neither is checked. A paused reserve will report non-zero liquidity, pass the router coverage check, and only fail at the eth_call simulation gate. CLAUDE.md requires all off-chain gates to run before simulation — this gate is defective and passes infeasible routes through.

Impact: Every liquidation routed through a paused Aave reserve fails at simulation, wasting RPC round-trips and widening the liquidation window for competitors.

Fix

Call IPoolDataProvider.getReserveConfigurationData(asset) and check the paused and frozen bits before returning liquidity. Return zero (or FlashLoanError::ReservePaused) when either bit is set. Aave V3 DataTypes.ReserveConfigurationMap encodes paused at bit 60 and frozen at bit 57.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayer:rustRust crates (core / scanner / protocols / executor / cli)priority:p1-coreCore MVP scope

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions