Query editor
-- Aave v3 Ethereum: Loan Health -- current snapshot of outstanding debt by health factor bucket---- METHODOLOGY: comprehensive per-user reconstruction from raw Transfer events-- (mint/burn netted per holder) against every aToken (collateral) and debt-- token (variableDebtToken + stableDebtToken) across all 67 reserves, priced-- via prices.latest. Total debt cross-validated to within 0.1% of Aave's-- reported total outstanding debt (~$8.8B).---- E-MODE HANDLING: health factor here uses each asset's STANDARD liquidation-- threshold, not Aave's Efficiency Mode (e-mode) elevated threshold for-- correlated assets. This understates true health factor for any user with-- an active e-mode category, in any bucket, not just "Underwater." Rather-- than mislabel these positions, every user with an active e-mode category-- (per pool_evt_useremodeset) is bucketed separately as "Unknown (E-Mode-- active, not modeled)" -- this is NOT a risk classification, just an honest-- "we can't confidently classify this without modeling e-mode's asset-level-- bitmap-encoded eligibility." Confirmed 891 of 907 raw-"Underwater" users-- (99.99995% of that bucket's debt) are e-mode users -- i.e. almost none of-- the original implausible $4.28B figure was real risk.---- 16 reserves with no Chainlink-compatible price feed match are excluded-- entirely (tested and confirmed immaterial: <0.1% impact on any bucket).WITH excluded_assets(asset) AS (VALUES(0xe6a934089bbee34f832060ce98848359883749b3), (0x50d2c7992b802eef16c04feadab310f31866a545),(0x917459337caac939d41d7493b3999f571d20d667), (0x14bdc3a3ae09f5518b923b69489cbcafb238e617),(0xaebf0bb9f57e89260d57f31af34eb58657d96ce0), (0x9db38d74a0d29380899ad354121dfb521adb0548),(0x3de0ff76e8b528c092d47b9dac775931cef80f49), (0x3b3fb9c57858ef816833dc91565efcd85d96f634),(0x9f56094c450763769ba0ea9fe2876070c0fd5f77), (0x59bc9fae5d62b19d4f8d07d758047acb9ee19d34),(0x9bf45ab47747f4b4dd09b3c2c73953484b4eb375), (0x619d75e3b790ebc21c289f2805bb7177a7d732e2),(0x62c6e813b9589c3631ba0cdb013acdb8544038b7), (0xbc6736d346a5ebc0debc997397912cd9b8fae10a),(0x1f84a51296691320478c98b8d77f2bbd17d34350), (0xe8483517077afa11a9b07f849cee2552f040d7b2)),reserves AS (SELECTasset, aToken, variableDebtToken, stableDebtToken,ROW_NUMBER() OVER (PARTITION BY asset ORDER BY evt_block_time DESC) AS rnFROM aave_v3_ethereum.poolconfigurator_evt_reserveinitialized),liq_thresholds AS (SELECTasset, liquidationThreshold,ROW_NUMBER() OVER (PARTITION BY asset ORDER BY evt_block_time DESC) AS rnFROM aave_v3_ethereum.poolconfigurator_evt_collateralconfigurationchanged),reserve_config AS (SELECTr.asset, r.aToken, r.variableDebtToken, r.stableDebtToken,CAST(COALESCE(l.liquidationThreshold, 0) AS DOUBLE) / 10000.0 AS liq_threshold_pctFROM reserves rLEFT JOIN liq_thresholds l ON r.asset = l.asset AND l.rn = 1WHERE r.rn = 1AND r.asset NOT IN (SELECT asset FROM excluded_assets)),collateral_tokens AS (SELECT aToken AS token_contract, asset, liq_threshold_pct, 'collateral' AS kind FROM reserve_config),debt_tokens AS (SELECT variableDebtToken AS token_contract, asset, liq_threshold_pct, 'debt' AS kind FROM reserve_config