damidezSegmenting Users by Bridge Size
    Updated 2024-08-23
    WITH Ethprice AS (
    SELECT price
    FROM ethereum.price.ez_prices_hourly
    WHERE token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
    AND hour = current_date()
    ),

    UserDeposits AS (
    SELECT
    'ethereum' AS chain,
    from_address AS user,
    SUM(value * (SELECT price FROM Ethprice)) AS total_deposits_usd,
    COUNT(DISTINCT tx_hash) AS deposit_count
    FROM ethereum.core.fact_transactions
    WHERE to_address = '0xfdf7c22ca4704dfef46e7e5ef53dca1d5a9f8e12'
    AND block_timestamp >= '2024-05-24'
    AND status = 'SUCCESS'
    GROUP BY user

    UNION ALL

    SELECT
    'optimism' AS chain,
    from_address AS user,
    SUM(value * (SELECT price FROM Ethprice)) AS total_deposits_usd,
    COUNT(DISTINCT tx_hash) AS deposit_count
    FROM optimism.core.fact_transactions
    WHERE to_address = '0xfdf7c22ca4704dfef46e7e5ef53dca1d5a9f8e12'
    AND block_timestamp >= '2024-05-24'
    AND status = 'SUCCESS'
    GROUP BY user

    UNION ALL

    SELECT
    'base' AS chain,
    QueryRunArchived: QueryRun has been archived