Sandeshkaito yap leaderboard copy
    Updated 2025-01-11
    -- credits to 0xdatawolf for suggesting we use schema id to be sure only kaito attestaions are included.
    -- and sam for suggesting to use traces table, this will allow us to identify the attestation irrespective of who signs it.
    EXPLAIN
    WITH kaito_write_txn as
    (
    select tx_hash from base.core.fact_traces
    where 1=1
    and block_timestamp >= '2025-01-05'
    and to_address='0xbeb5fc579115071764c7423a4f12edde41f106ed'
    and substr(input,0,10)='0x44adc90e'
    and type='DELEGATECALL'
    and trace_status='SUCCESS'
    and tx_status='SUCCESS'
    )
    ,temp AS (
    SELECT
    tx_hash, block_timestamp,
    regexp_substr_all(SUBSTR(input, 11), '.{64}') AS segmented,
    concat('0x', segmented[3]) AS schema,
    utils.udf_hex_to_int(segmented[5]) AS records,
    ARRAY_SLICE(segmented, 6 + utils.udf_hex_to_int(segmented[5]), 1000) AS data_array
    FROM base.core.fact_traces
    WHERE tx_hash in (select tx_hash from kaito_write_txn)
    and block_timestamp >= '2025-01-05'
    and to_address='0xbeb5fc579115071764c7423a4f12edde41f106ed'
    and substr(input,0,10)='0x44adc90e'
    and type='DELEGATECALL'
    and trace_status='SUCCESS'
    and tx_status='SUCCESS'
    AND schema='0xcb66276cf243e78fad68dd5e633f7bb56814b49ac9a91256615340591577a0e8'
    )

    select * from temp


    QueryRunArchived: QueryRun has been archived