freemartianBedrock Costs Saving
    Updated 2024-01-29
    with dates as (
    select
    timestampdiff('day', '2023-06-06 16:00:00.000', current_date) as X_days_after_bedrock,
    '2023-06-06 16:00:00.000' as Bedrock_live,
    current_date - (2*X_days_after_bedrock) as X_days_before_bedrock
    ),

    source as (
    SELECT
    avg(tx_fee) as Average_Fee,
    count(tx_hash) as Transaction_count,
    (CASE
    WHEN block_timestamp < '2023-06-06 16:00:00.000' THEN 'Before Bedrock'
    when block_timestamp > '2023-06-06 16:00:00.000' then 'After Bedrock' END
    ) AS "Label"
    FROM optimism.core.fact_transactions
    GROUP BY "Label"),

    pre_average as (
    select
    Average_Fee,
    Transaction_count as count
    from source
    where "Label" = 'Before Bedrock'),


    post_average as (
    select Average_Fee,
    Transaction_count as count
    from source
    where "Label" = 'After Bedrock'
    )

    select (pr.Average_Fee - po.Average_Fee) * po.count as ETH_Saved
    Last run: over 1 year agoAuto-refreshes every 3 hours
    ETH_SAVED
    1
    8400.455076897
    1
    18B
    162s