primo_datapolygon_nft_new_users
    Updated 2022-07-15
    select tx.dt
    , case when first_nft.from_address is not null then 'new_user_from_nft' else 'new_user_from_elsewhere' end new_user_type
    , count(distinct tx.from_address) user_ct
    from
    (
    -- First dates
    select from_address, min(date(block_timestamp)) dt
    from flipside_prod_db.polygon.transactions
    where date(block_timestamp) >= date('2021-06-01')
    and success = TRUE
    group by 1
    ) tx
    left join
    (
    -- First NFT transaction
    Select nft.from_address, min(tx.dt) first_nft_dt
    from
    (
    -- NFT Transaction
    select date(block_timestamp) dt, tx_id
    from flipside_prod_db.polygon.transactions
    where date(block_timestamp) >= date('2021-06-01')
    and to_label_type = 'nft'
    and success = TRUE
    ) tx
    inner join
    (
    -- NFT Transfer
    select tx_id, from_address
    from flipside_prod_db.polygon.udm_events
    where date(block_timestamp) >= date('2021-06-01')
    and from_address != '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'
    and to_address != '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'
    and amount_usd > 0
    ) nft
    on tx.tx_id = nft.tx_id
    Run a query to Download Data