Query editor
/* I want to list all Merkl pools for a network with their token pairI need:- to fetch the pools from the new distributions- check if they are still active, and add a tag- check token0 and token1 symbols -> taking too long, leaving aside for now*/with json_table AS (selectdate_trunc('day', evt_block_time) as date,distribution as parsed_jsonfrom merkl_{{chain}}.DistributionCreator_evt_NewDistribution),merkl_pools as (selectdate,json_extract_scalar(parsed_json, '$.epochStart') AS startDate,json_extract_scalar(parsed_json, '$.numEpoch') AS duration,json_extract_scalar(parsed_json, '$.uniV3Pool') AS poolFROM json_table),live_distributions as (selectpool,casewhen date_add('hour', cast(duration as bigint), from_unixtime(cast(startDate as double))) > now() then 'live'when date_add('hour', cast(duration as bigint), from_unixtime(cast(startDate as double))) < now() then 'ended'end as statusfrom merkl_pools as pgroup by 1, 2order by 2 desc)select * from live_distributions