theericstoneHolders copy
    -- forked from rmas / Holders @ https://flipsidecrypto.xyz/rmas/q/mbvXqhEWmE1r/holders

    WITH

    token_labels AS (
    SELECT symbol
    , token AS token_name
    , token_contract
    , decimals
    FROM near.core.dim_token_labels
    QUALIFY row_number() OVER (partition by token_contract order by symbol, token_name) = 1
    ),


    rainbow_bridge_token_events AS (
    WITH
    mints AS (
    SELECT fc.tx_hash
    , fc.block_timestamp
    , fc.method_name
    , 'system' AS sender_id
    , fc.args['account_id']::string AS receiver_id
    , try_cast(fc.args['amount']::string as bigint) / power(10, tl.decimals) AS amount
    , fc.receiver_id AS token_contract
    , tl.symbol
    FROM token_labels AS tl
    INNER JOIN near.core.fact_actions_events_function_call AS fc
    ON fc.receiver_id = tl.token_contract
    WHERE tl.token_contract = '{{ TokenContract }}'
    AND fc.receiver_id = '{{ TokenContract }}'
    AND fc.method_name = 'mint'
    -- Exclude failed TXs
    Run a query to Download Data