pinehearstSolana NFT - 3. Volume by Marketplace (Wash Trading % Over Time)
    Updated 2022-11-27
    WITH marketplace_label AS ( -- Get Labels for NFT Transfers
    SELECT
    program_id as program_id_label,
    marketplace as marketplace_label,
    count(distinct tx_id) as tx_Count
    FROM solana.core.fact_nft_sales
    WHERE SUCCEEDED = TRUE
    GROUP BY 1,2
    ),
    nft_sol_transfers AS ( -- Filter out Hadeswap Transfers -- spl and Sol
    SELECT
    *
    FROM solana.core.fact_transfers
    WHERE tx_id IN (
    SELECT
    distinct tx_id
    FROM solana.core.fact_nft_sales
    WHERE 1=1
    AND SUCCEEDED = TRUE
    AND program_id = 'hadeK9DLv9eA7ya5KCTqSvSvRZeJC3JgD5a9Y3CNbvu'
    AND block_id >= 151881904 -- First block for Hadeswap Transactions
    )
    ),
    NFT_TRANSFERS AS ( -- FIND NFT transfers
    SELECT
    tx_id as tx_id0,
    left(index,1) as index0, -- Indexing will be important for multiple NFT transfer
    tx_from as tx_from0, -- seller / giving the MINT
    tx_to as tx_to0, -- buyer / receiving the MINT
    amount as amount0, -- default will be 1 for NFT
    mint -- NFT address
    FROM nft_sol_transfers
    WHERE 1=1
    AND amount = 1 -- NFT amount should always be 1
    AND mint != 'So11111111111111111111111111111111111111112' -- NFT transfers, Non-SOL transfers, by default should be NFT
    ),
    Run a query to Download Data