greyswanNFT-DEFI intersection_by protocols
    Updated 2023-03-03
    -- forked from 8c31d52a-8a88-4c90-bb28-04bb5fcc9292
    with
    unique_NFT_users as (
    select distinct
    date_trunc('month', block_timestamp) as NFT_month,
    seller as seller_purchaser
    from
    solana.core.fact_nft_sales
    where
    block_timestamp >= '2022-03-01'
    and block_timestamp <= '2023-02-28'
    UNION
    select distinct
    date_trunc('month', block_timestamp) as NFT_month,
    purchaser
    from
    solana.core.fact_nft_sales
    where
    block_timestamp >= '2022-03-01'
    and block_timestamp <= '2023-02-28'
    ),
    txs_by_NFTS as (
    select
    NFT_month,
    seller_purchaser,
    program_ID
    from
    unique_NFT_users
    left join solana.core.fact_events on seller_purchaser = signers[0]
    and NFT_month = date_trunc('month', block_timestamp)
    where
    succeeded = 'true'
    and block_timestamp >= '2022-03-01'
    and block_timestamp <= '2023-02-28'
    ),
    contract_labels as (
    Run a query to Download Data