marquSolana Mobile Seek - Chapter 2 Token Mints
    Updated 2024-09-24
    with

    mint_txs as (

    select
    block_timestamp
    , tx_id
    , account_address
    , owner
    , instruction :parsed :info :tokenAmount :amount ::int as amount
    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'
    ),

    aggregated as (

    select

    date_trunc('day', block_timestamp) as date
    , count(distinct owner) as buyers_daily
    , sum(amount) as units
    , sum(units) over (order by date) as units_cumul

    from mint_txs
    group by 1
    )
    QueryRunArchived: QueryRun has been archived