CryptoIcicleUser Behavior (redux) - Transactions
    Updated 2022-10-24
    -- How is user behavior different on Optimism compared to L1?

    -- Pay by Quality Your score determines your final payout.
    -- Grand Prize 75 USDC (A score of 11 or 12 earns you a Grand Prize title)
    -- Payout 50 USDC
    -- Score Multiplier0-7 : 0% 8 : 50% 9 : 75% 10 : 100% 11 : 125% 12 : 150%
    -- Payout Network Ethereum
    -- Level Beginner
    -- Difficulty Medium
    -- How is user behavior different on Optimism compared to L1?
    -- Specifically, create a comparison between swaps and transactions on ETH mainnet vs Optimism, looking for things like daily swap volume,
    -- daily active users, and average volume swapped (use a single DEX for your comparison, either Uniswap or Sushiswap).
    -- L2 is far cheaper, but by how much? What are the average fees for a swap on Optimism compared to ETH Mainnet?
    -- BONUS: Post your dashboard on Twitter and tag @flipsidecrypto and any relevant accounts!

    with eth_price as (
    select
    date_trunc('day', hour) as date,
    avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH' and hour >= CURRENT_DATE - {{n_days}}
    group by date
    ),
    op as (
    select
    date_trunc('{{date_range}}',block_timestamp) as date,
    'optimism' as type,
    count(distinct tx_hash) as n_txns,
    count(distinct from_address) as n_users,
    sum(((t.gas_price/1e9) * (t.gas_used)) * (price)) as gas_used_usd
    from optimism.core.fact_transactions t
    join eth_price p on t.block_timestamp::date = p.date
    where block_timestamp >= CURRENT_DATE - {{n_days}}
    group by 1,2
    ),
    eth as (
    Run a query to Download Data