negin-khComparing new users for GMX vs. GNS
    Updated 2022-11-06
    with table_1 as (select min(block_timestamp) as first_purchase,
    origin_from_address
    from arbitrum.core.fact_event_logs --GMX
    where tx_status = 'SUCCESS'
    and event_name = 'Transfer'
    and event_inputs:value is not null
    and origin_to_address in ('0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba','0xb87a436b93ffe9d75c5cfa7bacfff96430b09868')
    group by 2),

    table_2 as (select min(block_timestamp) as first_purchase,
    origin_from_address
    from polygon.core.fact_event_logs --GNS
    where tx_status= 'SUCCESS'
    and contract_address = '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063'
    and origin_to_address in ('0xd8d177efc926a18ee455da6f5f6a6cfcee5f8f58','0x65187fec6ecc4774c1f632c7503466d5b4353db1','0xf8a140db8b05bec52c7e86d0d40d72f8e54fe559')
    and origin_from_address = event_inputs:from
    group by 2)

    select date_trunc('day', first_purchase) as day,
    'GMX Protocol' as network,
    count(distinct(origin_from_address)) as new_users,
    sum(new_users) over (order by day) as cumu_new_users
    from table_1
    group by 1
    union
    select date_trunc('day', first_purchase) as day,
    'GNS Network' as network,
    count(distinct(origin_from_address)) as new_users,
    sum(new_users) over (order by day) as cumu_new_users
    from table_2
    group by 1
    order by 1 desc
    Run a query to Download Data