freemartianجدول تعداد و نوع قلموها
    Updated 2024-05-03
    -- forked from Brush Type Supply @ https://flipsidecrypto.xyz/edit/queries/9a3d4352-4086-4542-9b05-54e15d68abb2

    with mints as (
    select
    tx_hash,
    tokenid
    from base.nft.ez_nft_transfers
    where nft_address = '0xd68fe5b53e7e1abeb5a4d0a6660667791f39263a'
    and event_type = 'mint'),

    source as (
    select
    tx_hash,
    regexp_substr_all(SUBSTR(data:input, 11, len(data:input)), '.{64}') AS segmented_data
    from base.core.fact_traces
    where tx_hash in (select tx_hash from mints)
    and type = 'CALL'),


    changes as (
    with a as (select
    tx_hash,
    regexp_substr_all(SUBSTR(input_data, 11, len(input_data)), '.{64}') AS segmented_data
    from base.core.fact_transactions
    where to_address = '0xd68fe5b53e7e1abeb5a4d0a6660667791f39263a'
    and ORIGIN_FUNCTION_SIGNATURE = '0x7e9657b7')

    select
    ethereum.public.udf_hex_to_int(segmented_data[0] :: STRING) as token_ID,
    ethereum.public.udf_hex_to_int(segmented_data[1] :: STRING) as latest_strength
    from a),

    final as (
    select
    count(tokenid) as Brush_count,
    QueryRunArchived: QueryRun has been archived