MLDZMNmux4.1
    Updated 2023-10-20
    -- forked from mux4 @ https://flipsidecrypto.xyz/edit/queries/d2f15d37-ba0e-4c2e-bc50-f09c5a436974

    select
    date_trunc('week',s.block_timestamp) as date,
    a.event_name,
    count(DISTINCT s.tx_hash) as no_txn,
    count(DISTINCT a.origin_from_address) as no_users,
    sum(no_txn) over (partition by event_name order by date) as total_txn
    from avalanche.core.fact_transactions s
    left join avalanche.core.ez_decoded_event_logs a on s.tx_hash=a.tx_hash
    where s.status='SUCCESS'
    and contract_address in('0x0ba2e492e8427fad51692ee8958ebf936bee1d84')
    and EVENT_NAME in ('OpenPosition','ClosePosition','Liquidate')
    group by 1,2 having event_name is not null



    Run a query to Download Data