Query editor
with price_ron as (selectdate_trunc('day', timestamp) as day,max(price) as pricefrom prices.daywhere blockchain = 'ronin' and contract_address in (0xe514d9deb7966c8be0ca922de8a064264ea6bcd4) -- RONand timestamp < current_dateand timestamp >= current_date - interval '{{days}}' dayGROUP BY 1),price_eth as (selectdate_trunc('day', timestamp) as day,pricefrom prices.daywhere blockchain = 'ethereum' and contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- ETHand timestamp < current_dateand timestamp >= current_date - interval '{{days}}' day),prices as (selectron.day,ron.price as price_ron,eth.price as price_eth,ron.price/eth.price as ron_per_ethfrom price_ron roninner join price_eth eth on ron.day = eth.day)selectblock_date as day,'ronin' as origin_key,--count(*) FILTER (WHERE gas_price > 0) as txcount,count(*) as txcount,count(*) as txcount_plain,count(*) as txcount_comparison,SUM(gas_used) / (24 * 60 * 60) AS gas_per_second,--COUNT(distinct "from") AS daa,SUM((gas_used * (gas_price / 1e18) + coalesce(l1_fee / 1e18, 0)) * ron_per_eth) AS fees_paid_eth,approx_percentile((gas_used * (gas_price / 1e18) + coalesce(l1_fee / 1e18, 0)) * ron_per_eth, 0.5) FILTER (WHERE gas_price > 0) as txcosts_median_ethfrom ronin.transactions tleft join prices p on t.block_date = p.daywhere block_date < current_dateand block_date >= current_date - interval '{{days}}' daygroup by 1