RayyykGMX users and transactions 1
    Updated 2022-09-17
    with table_1 as (select min(block_timestamp) as first_tx,
    origin_from_address as wallet
    from arbitrum.core.fact_event_logs
    where tx_status = 'SUCCESS'
    and contract_address = '0xabbc5f99639c9b6bcb58544ddf04efa6802f4064'
    group by 2
    having first_tx >= current_date - 30),

    table_2 as (select date_trunc('day', first_tx) as day,
    count(distinct(wallet)) as new_wallet_count,
    sum(new_wallet_count) over (order by day) as cumu_new_wallet
    from table_1
    group by 1),

    table_3 as (select date_trunc('day', block_timestamp) as day,
    count(distinct(tx_hash)) as tx_count,
    sum(tx_count) over (order by day) as cumu_tx_count
    from arbitrum.core.fact_event_logs a
    join table_1 b on a.origin_from_address = b.wallet
    where tx_status = 'SUCCESS'
    and contract_address = '0xabbc5f99639c9b6bcb58544ddf04efa6802f4064'
    and block_timestamp >= current_date - 30
    group by 1),

    table_4 as (select ifnull(a.day, b.day) as date,
    new_wallet_count,
    cumu_new_wallet,
    tx_count,
    cumu_tx_count,
    tx_count/new_wallet_count as avg_tx_count
    from table_2 a
    join table_3 b on a.day = b.day)

    select *, (select avg(avg_tx_count) from table_4) as avg_tx
    from table_4
    order by 1 desc
    Run a query to Download Data