flyingfishSolana Token Supply copy
    Updated 2025-03-22
    -- forked from Solana Token Supply @ https://flipsidecrypto.xyz/edit/queries/c34dc6b8-9ec5-4d94-82e3-bdd5c34ed025
    --4tARAT4ssRYhrENCTxxZrmjL741eE2G23Q1zLPDW2ipf
    --7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj
    with token_details as (
    select
    token_address
    , name
    , symbol
    , iff(decimals is not null, decimals, {{token_decimals}}) as token_decimals
    from solana.price.ez_asset_metadata --solana.core.dim_tokens
    where token_address = '{{token_address}}'
    )

    , first_mint as (
    select min(block_timestamp)::date as first_mint_date
    from solana.defi.fact_token_mint_actions
    where mint = '{{token_address}}'
    )

    , dates as (
    SELECT
    DISTINCT date
    FROM (
    SELECT
    case
    when '{{time_granularity}}' = 'day' then date_day
    when '{{time_granularity}}' = 'week' then iso_week_start_date
    when '{{time_granularity}}' = 'month' then month_start_date
    end as date
    FROM ethereum.core.dim_dates
    WHERE date_day BETWEEN (select first_mint_date from first_mint) AND current_date()
    )
    )

    , token_mints AS (
    SELECT
    QueryRunArchived: QueryRun has been archived