0xHaM-dPower Users Among $NEKO Top Holders
    Updated 2024-08-15
    -- forked from MoDeFi / $NEKO Top Holders @ https://flipsidecrypto.xyz/MoDeFi/q/6SCIsaEuQ7E-/neko-top-holders

    with succeeded_txs as (
    select tx_hash as tx
    from near.core.fact_transactions
    where tx_succeeded=true
    ),

    price as (
    select
    value[0]::string as hour,
    value[1]::float as price
    from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/queries/8f8bb378-76ea-43d4-8afe-432aaa76a585/latest-run')
    as response), lateral FLATTEN (input => response:data:result:rows)),

    date_start as (
    with dates AS (
    SELECT CAST('2023-10-28' AS DATE) AS start_date
    UNION ALL
    SELECT DATEADD(day, 1, start_date)
    FROM dates
    WHERE start_date < CURRENT_DATE())
    SELECT date_trunc(day, start_date) AS start_date
    FROM dates),

    ----------------------- ft transfers -----------------------
    --$neko token transfers
    neko_transfers as (
    select block_id, block_timestamp,
    event_json:data[0]:old_owner_id::string as from_address,
    event_json:data[0]:new_owner_id::string as to_address,
    event_json:data[0]:amount as amount_raw,
    event_json:data[0]:amount/pow(10,decimals) as amount,
    event, tx_hash, event_json as log
    from (
    select block_id, block_timestamp, try_parse_json(replace(l.value::string, 'EVENT_JSON:', '')) as event_json,
    QueryRunArchived: QueryRun has been archived