libruaryListingCompleted_reference_v2
    Updated 2024-10-05
    WITH ListingEventsV2 AS (
    SELECT
    'A.3cdbb3d569211ff3.NFTStorefrontV2' AS contract_address, -- Contract address
    tx_id, -- Transaction ID
    block_timestamp, -- Timestamp of the block
    block_height, -- Block height
    tx_succeeded, -- Transaction success flag
    event_index, -- Event index
    event_contract, -- Contract address of the event
    event_data:listingResourceID::STRING AS listing_id, -- Listing ID
    event_data:nftID::STRING AS nft_id, -- NFT ID
    event_data:salePrice::FLOAT AS sale_price, -- Sale price
    event_data:buyer::STRING AS buyer, -- Buyer address
    event_data:storefrontAddress::STRING AS seller, -- Seller address
    event_data:commissionAmount::FLOAT AS commission_amount, -- Commission amount
    event_data:commissionReceiver::STRING AS commission_receiver, -- Commission receiver
    event_data:salePaymentVaultType::STRING AS payment_type, -- Payment vault type (DapperUtilityCoin)
    event_data:purchased::BOOLEAN AS is_purchased -- Whether the listing was purchased
    FROM
    flow.core.fact_events
    WHERE
    event_contract = 'A.3cdbb3d569211ff3.NFTStorefrontV2'
    AND event_type = 'ListingCompleted'
    AND event_data:nftType = 'A.0b2a3299cc857e29.TopShot.NFT' -- Only include TopShot NFTs
    AND block_timestamp >= DATEADD(day, -30, CURRENT_DATE) -- Limit to the last 30 days
    )

    -- Select the last 200 sales where `is_purchased = TRUE`
    SELECT
    contract_address, -- Contract address
    tx_id,
    block_timestamp,
    block_height,
    tx_succeeded,
    event_index,
    listing_id,
    QueryRunArchived: QueryRun has been archived