Sbhn_NPReddit NFT Sales State
    Updated 2022-10-30
    --credit : 0xHaM☰d
    WITH mint_tx as (
    SELECT
    block_timestamp,
    tx_hash,
    EVENT_INPUTS,
    CONTRACT_ADDRESS,
    EVENT_INPUTS:"_id"::string as token_Id,
    EVENT_INPUTS:"_to"::string as to_address,
    ROW_NUMBER() OVER (PARTITION BY to_address ORDER BY block_timestamp ASC) as rank
    FROM polygon.core.FACT_EVENT_LOGS
    WHERE 1=1
    and event_name = 'TransferSingle'
    and ORIGIN_FUNCTION_SIGNATURE IN ('0x669f5a51', '0x5a86c41a')
    and EVENT_INPUTS:"_from" = '0x0000000000000000000000000000000000000000'
    and TX_STATUS = 'SUCCESS'
    QUALIFY rank = 1 -- Only look at the first mint tx, ignore 2nd onwards
    )
    SELECT
    'Minter Wallets' as status,
    COUNT(DISTINCT to_address) as Minter_Cnt
    FROM mint_tx

    UNION

    SELECT
    'Mint Count' as status,
    COUNT(DISTINCT tx_hash) as Mint_Cnt
    FROM mint_tx

    UNION

    SELECT
    'Secondary Market Sallers' as status,
    COUNT(DISTINCT EVENT_INPUTS:"_from") as Sallers_Cnt
    FROM polygon.core.FACT_EVENT_LOGS
    Run a query to Download Data