SpecterTOP L2: OP
    Updated 2024-09-14
    WITH last_7_days AS (
    SELECT block_timestamp, tx_hash,
    from_address, value, tx_fee_precise, to_address
    FROM ethereum.core.fact_transactions
    WHERE to_address IN ('0x52ec2f3d7c5977a8e558c8d9c6000b615098e8fc', '0x99c9fc46f92e8a1c0dec1b1747d010903e884be1')
    AND status = 'SUCCESS'
    AND block_timestamp >= DATEADD(day, -7, CURRENT_DATE())
    ),
    overall AS (
    SELECT block_timestamp, tx_hash,
    from_address, value, tx_fee_precise
    FROM ethereum.core.fact_transactions
    WHERE to_address IN ('0x52ec2f3d7c5977a8e558c8d9c6000b615098e8fc', '0x99c9fc46f92e8a1c0dec1b1747d010903e884be1')
    AND status = 'SUCCESS'
    )

    -- Last 7 days totals
    SELECT
    'Last 7 Days' AS period,
    COUNT(DISTINCT tx_hash) AS Total_tx,
    COUNT(DISTINCT from_address) AS bridgers,
    SUM(value) AS total_value,
    SUM(tx_fee_precise) AS total_tx_fee
    FROM last_7_days

    UNION ALL

    -- Overall totals
    SELECT
    'Overall' AS period,
    COUNT(DISTINCT tx_hash) AS Total_tx,
    COUNT(DISTINCT from_address) AS bridgers,
    SUM(value) AS total_value,
    SUM(tx_fee_precise) AS total_tx_fee
    FROM overall;

    QueryRunArchived: QueryRun has been archived