AMLBotnew users activity stats copy
    Updated 2023-11-14
    -- forked from new users activity stats @ https://flipsidecrypto.xyz/edit/queries/ae8f3f18-e557-451a-96f8-98c1a963b7e8

    with optimism_users_first_activity as(
    select
    wallet,
    'Optimism' blockchain,
    min(week) first_activity_week
    from
    (
    (select
    date_trunc(week,block_timestamp) as week,
    'Optimism' blockchain,
    'Inflow to L0' type,
    tx_hash,
    from_address wallet
    from optimism.core.ez_token_transfers
    where
    (to_address in (select address from
    Optimism.core.dim_labels
    where ADDRESS_NAME ilike '%layerzero%')
    --and date_trunc(week,block_timestamp) >= current_date - {{days_back}}
    )
    )
    union all
    (select
    date_trunc(week,block_timestamp) week,
    'Optimism' blockchain,
    'Inflow to L0' type,
    tx_hash,
    ETH_from_address wallet
    from Optimism.core.ez_eth_transfers
    where
    (
    Run a query to Download Data