Query editor
-- Video-specific events only: the shared AI Provider also serves non-video oracle calls.-- Cohort by request date; settled state observed at query time. No fixed-fee assumption.-- requesters are consumer CONTRACTS, not human users. Funding fees are not swap volume.WITH raw AS (SELECT *,varbinary_to_uint256(topic1) request_id,varbinary_substring(topic2,13,20) requesterFROM bnb.logs WHERE block_date>=DATE '2026-10-01'AND contract_address=0xaee3a7ca6fe6b53f6c32a3e8407ec5a9df8b7e39AND topic0 IN (keccak(to_utf8('FlapAIProviderVideoRequested(uint256,address,string,uint8,string[],uint256)')),keccak(to_utf8('FlapAIProviderVideoFulfilled(uint256,address,string,string,uint32,uint64,uint256)')),keccak(to_utf8('FlapAIProviderVideoFailed(uint256,address,uint8,string)')))), requests AS (SELECT request_id,requester,min(block_time) requested_at,max(CAST(varbinary_to_uint256(varbinary_substring(data,97,32)) AS double)/1e18) fee_bnbFROM raw WHERE topic0=keccak(to_utf8('FlapAIProviderVideoRequested(uint256,address,string,uint8,string[],uint256)')) GROUP BY 1,2), settlements AS (SELECT request_id,requester,min(block_time) settled_at,max(CASE WHEN topic0=keccak(to_utf8('FlapAIProviderVideoFulfilled(uint256,address,string,string,uint32,uint64,uint256)')) THEN 1 ELSE 0 END) fulfilled,max(CASE WHEN topic0=keccak(to_utf8('FlapAIProviderVideoFulfilled(uint256,address,string,string,uint32,uint64,uint256)')) THEN CAST(varbinary_to_uint256(varbinary_substring(data,65,32)) AS double)/1000 END) duration_secondsFROM raw WHERE topic0<>keccak(to_utf8('FlapAIProviderVideoRequested(uint256,address,string,uint8,string[],uint256)')) GROUP BY 1,2), live_vaults AS (SELECT DISTINCT varbinary_substring(topic2,13,20) vault FROM bnb.logsWHERE block_date>=DATE '2026-10-01' AND contract_address=0x90497450f2a706f1951b5bdda52b4e5d16f34c06AND topic0=keccak(to_utf8('FlapTaxVaultTokenCreated(address,address,address)'))AND varbinary_substring(topic3,13,20)=0x89a800a8fbb3538f8ddb76c95034d23c249bf9d9), enriched AS (SELECT r.*,CAST(r.requested_at AS date) day,s.settled_at,s.fulfilled,s.duration_seconds,CASE WHEN l.vault IS NOT NULL THEN 'LiveMeme' ELSE 'Other video consumers' END consumer_typeFROM requests r LEFT JOIN settlements s ON r.request_id=s.request_id AND r.requester=s.requesterLEFT JOIN live_vaults l ON r.requester=l.vault)SELECT consumer_type,CASE WHEN grouping(day)=1 THEN 'total' ELSE 'daily' END row_type,day,count(*) requests,count_if(fulfilled=1) fulfilled,count_if(fulfilled=0) failed,count_if(settled_at IS NULL) pending,count(DISTINCT requester) requesting_contracts,sum(fee_bnb) fee_bnb,sum(duration_seconds) video_seconds,CAST(count_if(fulfilled=1) AS double)/nullif(count_if(settled_at IS NOT NULL),0) settled_success_rate,approx_percentile(date_diff('second',requested_at,settled_at),0.5) median_settlement_seconds,CAST(current_timestamp AS timestamp) as_of_utcFROM enriched GROUP BY GROUPING SETS ((consumer_type),(consumer_type,day)) ORDER BY row_type,consumer_type,day