mamad-5XN3k32023-06-28 09:41 PM
    Updated 2023-06-28
    -- forked from User Statistics (Inflow) @ https://flipsidecrypto.xyz/edit/queries/0008d2f6-cb88-4230-96be-c19f20c32017

    with inflowt as (
    ---polygon
    (
    select
    --date_trunc(week,block_timestamp) as week,
    distinct from_address as user,
    count(distinct tx_hash) as txs,
    --count(distinct from_address) as user,
    sum(AMOUNT_USD) as usd_amount
    -- txs/user as tx_per_user,
    --usd_amount/user as usd_per_user
    from polygon.core.ez_token_transfers
    where to_address in (
    select address from polygon.core.dim_labels where ADDRESS_NAME ilike '%layerzero%')
    and block_timestamp >= '2023-01-01'
    group by 1

    union

    select
    distinct MATIC_FROM_ADDRESS as user,
    --date_trunc(week,block_timestamp) as week,
    count(distinct tx_hash) as txs,
    --count(distinct MATIC_FROM_ADDRESS) as user,
    sum(AMOUNT_USD) as usd_amount
    -- txs/user as tx_per_user,
    --usd_amount/user as usd_per_user
    from polygon.core.ez_matic_transfers
    where MATIC_TO_ADDRESS
    in (
    select address from polygon.core.dim_labels where ADDRESS_NAME ilike '%layerzero%')
    and block_timestamp >= '2023-01-01'
    group by 1)

    Run a query to Download Data