superflyUntitled Query
Updated 2022-09-20Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
WITH MIN AS (SELECT
DISTINCT event_inputs:addr as market_address
FROM polygon.core.fact_event_logs
WHERE origin_to_address = '0xc040f84cf7046409f92d578ef9040fe45e6ef4be'
AND event_name = 'MarketCreated'
AND block_timestamp > CURRENT_DATE - 270), MIN2 AS (
SELECT a.market_address, b.tx_count
FROM MIN as a LEFT OUTER JOIN (
SELECT origin_to_address as market_address,
COUNT(DISTINCT tx_hash) as tx_count
FROM polygon.core.fact_event_logs
WHERE origin_to_address IN (SELECT market_address FROM MIN)
AND event_name = 'AddedCommitment'
AND block_timestamp > CURRENT_DATE - 270
GROUP BY market_address) as b on a.market_address = b.market_address )
SELECT COUNT(DISTINCT market_address) AS "Total Markets",
COUNT(CASE WHEN tx_count IS NULL THEN 1 ELSE NULL END) as "Null Markets"
FROM MIN2
Run a query to Download Data