Query editor
/*Aave V3 PT health factor observations by PT market exposure.This query is chain-aware through asset_chain and uses generalized aave_v3_multichain tables.Configure included chains with the {{blockchains}} parameter, e.g.:ethereum,arbitrum,baseImportant exposure caveat:PT exposure is inferred from Aave Pool Supply minus Withdraw events.This is intentionally cheaper to run on Dune than reconstructing balances fromERC20/aToken Transfer events, because Transfer-event reconstruction requiresscanning much larger token transfer tables.Tradeoff:Supply - Withdraw is an approximation. It can miss aToken transfers,liquidations, migrations, or other balance-changing paths that change whoactually holds the supplied PT exposure. Do not interpret this as a perfectaToken-balance reconstruction.eMode note:eMode state is inferred from UserEModeSet events as of the getUserAccountDatacall time. The health factor returned by Aave already reflects eMode if active;these columns are only labels for grouping/filtering.Parameter suggestions:{{hf_bin_size}} = 0.01{{hf_min}} = 0.00{{hf_max}} = 3.00{{blockchains}} = ethereum,arbitrum,base*/WITH params AS (SELECTCOALESCE(TRY_CAST('{{hf_bin_size}}' AS double), 0.01) AS hf_bin_size,COALESCE(TRY_CAST('{{hf_min}}' AS double), 0.00) AS hf_min,COALESCE(TRY_CAST('{{hf_max}}' AS double), 1.50) AS hf_max,COALESCE(NULLIF('{{blockchains}}', 'default value'),'ethereum,plasma') AS blockchain_csv),chain_filter AS (SELECTLOWER(TRIM(chain_name)) AS asset_chainFROM paramsCROSS JOIN UNNEST(SPLIT(blockchain_csv, ',')) AS t(chain_name)),source_reserve_initialized AS (SELECTchain AS asset_chain,asset AS reserveFROM aave_v3_multichain.poolconfigurator_evt_reserveinitializedWHERE LOWER(chain) IN (SELECT asset_chain FROM chain_filter)),