Query editor
-- Total Resolutions (Resolution Oracle, BSC)-- total_resolutions : BSC on-chain ResolutionSubmitted count + Cournot pred_resolution API total-- last_7d_resolutions: same two sources over the last 7 complete UTC days-- The current (incomplete) UTC day is excluded for both sources.WITH api AS (SELECT json_parse(http_get('https://interface.cournot.ai/cournot/dune/pred_resolution')) AS body),api_items AS (SELECT itemFROM apiCROSS JOIN UNNEST(CAST(json_extract(body, '$.data.items') AS array(json))) AS t(item)),api_daily AS (SELECT CAST(json_extract_scalar(item, '$.date') AS date) AS day,SUM(CAST(json_extract_scalar(item, '$.count') AS bigint)) AS resolutionsFROM api_itemsGROUP BY 1),onchain AS (SELECT COUNT(*) AS total_resolutions,COUNT_IF(block_date >= current_date - INTERVAL '7' DAY) AS last_7d_resolutionsFROM bnb.logsWHERE contract_address = 0xa436704ada3289540a7616a7c8e85d42e6fd795cAND topic0 = 0x5d17d746feb73650cce8729b4ab6408ca2adbd5913ec687face4d86ea8c485efAND block_date >= date '2026-04-01'AND block_date < current_date)SELECT o.total_resolutions+ COALESCE((SELECT SUM(resolutions) FROM api_daily WHERE day < current_date), 0) AS total_resolutions,o.last_7d_resolutions+ COALESCE((SELECT SUM(resolutions) FROM api_dailyWHERE day >= current_date - INTERVAL '7' DAY AND day < current_date), 0) AS last_7d_resolutionsFROM onchain o