SalehPolygon NFT-daily
    Updated 2022-07-15
    with lst_nft as (
    select
    address
    -- LABEL_SUBTYPE
    from polygon.core.dim_labels
    where LABEL_TYPE='nft'
    and (label_subtype = 'token_contract' or label_subtype = 'general_contract')

    )
    -- ,lst_tx as (
    -- select
    -- tx_hash
    -- ,origin_to_address
    -- from polygon.core.fact_event_logs
    -- where TX_STATUS='SUCCESS'
    -- and CONTRACT_ADDRESS in (select address from lst_nft)
    -- and EVENT_NAME='Transfer'
    -- )
    select
    block_timestamp::date as date
    ,count(DISTINCT tx_id) as tx_count
    ,count(DISTINCT TO_ADDRESS) as buyers
    ,sum( AMOUNT_USD) as amount_in_usd
    ,sum(amount_in_usd) over (order by date) as growth_amount
    ,sum(tx_count) over (order by date) as growth_tx_count
    ,sum(buyers) over (order by date) as growth_buyers
    from flipside_prod_db.polygon.udm_events u
    join lst_nft on lst_nft.address = u.CONTRACT_ADDRESS
    where EVENT_NAME='transfer'
    and AMOUNT_USD>0
    and TO_ADDRESS not in ('0x0000000000000000000000000000000000000000' ,'0x00000000000b69ec332f49b7c4d2b101f93c3bed'
    ,'0x00000000000b69ec332f49b7c4d2b101f93c3bed','0x00000000000b186ebef1ac9a27c7eb16687ac2a9'
    ,'0x000000000000000000000000000000000000dead','0x0000000000000000000000000000000000000001')
    -- where tx_hash in (select tx_hash from lst_tx)
    group by 1
    order by 1

    Run a query to Download Data