Query editor
WITH input_table AS (SELECT *FROM base.logsWHERE contract_address = FROM_HEX('EF4364Fe4487353dF46eb7c811D4FAc78b856c7F')AND topic0 = FROM_HEX('fcf126c1f493c32232d9dcb63912c67395f3a7c44fb2f0a72e65440881d21684')AND topic2 = FROM_HEX('0000000000000000000000000B6a786ECB21a4f668548b09CaCf8deC4c0956fD')),decoded_events AS (SELECT *FROM TABLE (decode_evm_event (abi => '{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"jobId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"PaymentReleased","type":"event"}',input => TABLE(input_table)))),daily AS (SELECTblock_date,COUNT(*) AS daily_count,SUM(CAST(amount AS BIGINT)) AS daily_sum_amountFROM decoded_eventsGROUP BY block_date),daily_with_cumsum AS (SELECTblock_date,daily_count,CAST((daily_sum_amount/1e6) AS double) AS daily_sum_amount,CAST((SUM(daily_sum_amount) OVER (ORDER BY block_date)/1e6) AS double) AS cumulative_sum_amountFROM daily)SELECTblock_date,daily_count,daily_sum_amount,cumulative_sum_amount,-- total values (same for every row if you SELECT them here)(SELECT COUNT(*) FROM decoded_events) AS total_count,(SELECT SUM(CAST(amount AS BIGINT)) FROM decoded_events)/1e6 AS total_sum_amountFROM daily_with_cumsumORDER BY block_date;