Query editor
withparams as (selectcast(to_unixtime(timestamp '2026-03-23 17:00') as bigint) as from_ts,cast(to_unixtime(timestamp '2026-03-30 17:00') as bigint) as to_ts),all_hooks as (selecttx_hash,block_time,casewhen bytearray_to_uint256(bytearray_substring(data, 1, 32)) = 2 then 'extra'when bytearray_to_uint256(bytearray_substring(data, 1, 32)) = 3 then 'simple'else 'other?'end as hook_type,bytearray_to_uint256(bytearray_substring(data, 1+32, 32)) as hook_id,bytearray_substring(data, 1+32*2+12, 20) as hook_addressfrom monad.logswhere contract_address = 0x3A8E1Be95467690F7C592B596e42d11b3710c633and topic0 = 0x11dbc4971b4be63393860fbfccf9c7483b30f7472a642917a19b2aace0d0c591),all_data as (selecttx_hash,contract_address as rewarder,block_time,bytearray_to_uint256(bytearray_substring(data, 1, 32)) as rewardPerSecond_u,bytearray_to_uint256(bytearray_substring(data, 1 + 32, 32)) as startTimestamp_u,bytearray_to_uint256(bytearray_substring(data, 1 + 2 * 32, 32)) as endTimestamp_ufrom monad.logswhere topic0 = 0xf0b276e9ee40b3a3d065f636ee656c9bf1c9a0c4060fb212fd0861890c107be5and contract_address in (select hook_address from all_hooks)),with_next as (selecta.*,lead(startTimestamp_u) over (partition by rewarder order by startTimestamp_u) as nextStartTimestamp_ufrom all_data a),with_rewards as (selecttx_hash,rewarder,block_time,rewardPerSecond_u,-- keep effectiveEnd as UINT256 (for least()), but we'll CAST to bigint for overlap logiccasewhen nextStartTimestamp_u is null then endTimestamp_uelse least(endTimestamp_u, nextStartTimestamp_u)end as effectiveEndTimestamp_u,startTimestamp_ufrom with_next),spent_in_window as (select