Hadisehwhat 2
    Updated 2022-07-26
    ----- this part was written with help Flipside farsi

    with t1 as ( select x.play_type , y.event_data:to as total_buyer , y.event_type , y.event_data:id as nft
    from flow.core.dim_topshot_metadata x join flow.core.fact_events y on x.nft_id = y.EVENT_DATA:id
    where tx_succeeded = 'TRUE' and event_type = 'Deposit' )
    ,
    t3 as ( select x.play_type , y.event_data:from as total_seller , y.event_type , y.event_data:id as nft_data
    from flow.core.dim_topshot_metadata x join flow.core.fact_events y on x.nft_id = y.EVENT_DATA:id
    where tx_succeeded = 'TRUE' and event_type = 'Withdraw' )
    ,
    t2 as ( select x.play_type , count(DISTINCT total_buyer) as buyer , count(DISTINCT total_seller) as seller
    from t1 x left join t3 y on x.nft = y.nft_data and total_buyer = total_seller
    group by 1)

    select play_type , buyer - seller as holders_amount
    from t2
    order by 2 desc
    Run a query to Download Data