MoeLayerzero outflow 0 copy
    Updated 2023-04-29
    select * from (
    (select
    date_trunc(week,block_timestamp) as week,
    'Optimism' as network,
    count(tx_hash) as tx_count,
    count(distinct to_address) as user_count,
    sum(AMOUNT_USD) as usd_amount,
    sum(usd_amount)over( order by week rows between unbounded preceding and current row) as "cum usd_amount",
    avg(amount_usd) as avg_amount_usd,
    tx_count/user_count as tx_per_user,
    usd_amount/user_count as usd_per_user

    from optimism.core.ez_token_transfers
    where (from_address in (select address from
    Optimism.core.dim_labels
    where
    ADDRESS_NAME ilike '%layerzero%'
    ))
    group by 1

    union

    select
    date_trunc(week,block_timestamp) as week,
    'Optimism' as network,
    count(tx_hash) as tx_count,
    count(distinct ETH_to_address) as user_count,
    sum(AMOUNT_USD) as usd_amount,
    sum(usd_amount)over( order by week rows between unbounded preceding and current row) as "cum usd_amount",
    avg(amount_usd) as avg_amount_usd,
    tx_count/user_count as tx_per_user,
    usd_amount/user_count as usd_per_user

    from Optimism.core.ez_eth_transfers
    where (ETH_from_address in (select address from
    Optimism.core.dim_labels
    Run a query to Download Data