MoeLayerzero outflow 2
    Updated 2023-04-29
    select
    sum(tx_count) as all_txns ,
    sum(user_count) as all_users ,
    sum(usd_amount) as all_usd_amount,
    all_usd_amount/all_txns as avg_usd_amount


    from (
    (select
    date_trunc(week,block_timestamp) as week,
    count(tx_hash) as tx_count,
    count(distinct to_address) as user_count,
    sum(AMOUNT_USD) as usd_amount,
    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,
    count(tx_hash) as tx_count,
    count(distinct ETH_to_address) as user_count,
    sum(AMOUNT_USD) as usd_amount,
    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
    Run a query to Download Data