mondovmarket share by users on each chain
    Updated 2024-08-24
    WITH uniswap_swappers AS (
    SELECT
    COUNT(DISTINCT trader) AS uniswap_users,
    DATE_TRUNC('month', block_timestamp) AS month,
    blockchain
    FROM crosschain.defi.ez_dex_swaps
    WHERE lower(platform) LIKE 'uniswap%'
    AND block_timestamp >= '2020-01-01'
    GROUP BY month, blockchain
    ),

    blast_addresses AS (
    SELECT DISTINCT address FROM blast.core.dim_contracts WHERE lower(name) LIKE '%uniswap%'
    ),

    uniswap_blast AS (
    SELECT
    COUNT(DISTINCT from_address) AS uniswap_users,
    DATE_TRUNC('month', block_timestamp) AS month
    FROM blast.core.fact_transactions
    WHERE (to_address IN (SELECT address FROM blast_addresses) OR from_address IN (SELECT address FROM blast_addresses))
    AND status = 'SUCCESS'
    AND block_timestamp >= '2020-01-01'
    GROUP BY month
    ),

    total_users_counts AS (
    SELECT
    DATE_TRUNC('month', block_timestamp_hour) AS month,
    SUM(UNIQUE_INITIATOR_COUNT) AS user_count,
    blockchain
    FROM crosschain.stats.ez_core_metrics_hourly
    WHERE block_timestamp_hour >= '2020-01-01'
    GROUP BY month, blockchain
    ),

    QueryRunArchived: QueryRun has been archived