piperSolana Mobile Seek - Chapter 2 Unique minting addresses
    Updated 2024-10-22
    -- forked from marqu / Solana Mobile Seek - Chapter 2 Token Mints @ https://flipsidecrypto.xyz/marqu/q/hjig9FZnt3tk/solana-mobile-seek---chapter-2-token-mints

    -- modified to my needs to get the amount of unique minting addresses

    select
    --, account_address
    --,
    COUNT(DISTINCT(owner)) AS unique_minting_addresses
    from solana.core.fact_events
    left join solana.core.fact_token_account_owners ta_owners
    on fact_events.instruction :parsed :info :account = ta_owners.account_address
    and fact_events.block_id >= ta_owners.start_block_id
    and iff(ta_owners.end_block_id is null, TRUE, fact_events.block_id <= ta_owners.end_block_id)
    where succeeded
    and program_id = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'
    and event_type = 'mintToChecked'
    and instruction :parsed :info :mint = '2DMMamkkxQ6zDMBtkFp8KH7FoWzBMBA1CGTYwom4QH6Z'
    and block_timestamp > '2024-02-02'

    Last run: 3 months ago
    UNIQUE_MINTING_ADDRESSES
    1
    147952
    1
    10B
    114s