0xHaM-d$UWON Top Holders Type
    Updated 2024-06-09
    -- forked from Power Users Among $UWON Top Holders @ https://flipsidecrypto.xyz/edit/queries/ac87daf5-1f35-4777-b851-b7511b777cc3

    -- forked from MoDeFi / $UWON Top Holders @ https://flipsidecrypto.xyz/MoDeFi/q/wVpTxNNQF4Xs/uwon-top-holders

    with panicked_txs as (
    select tx_hash
    from near.core.fact_receipts
    where STATUS_VALUE:Failure is not null
    and block_timestamp::date>'2024-02-25'
    group by 1),

    succeeded_txs as (
    select tx_hash as tx
    from near.core.fact_transactions
    where tx_succeeded=true
    and block_timestamp::date>'2024-02-25'
    and tx_hash not in (select tx_hash from panicked_txs)),

    price as (
    select
    value[0]::string as hour,
    value[1]::float as price
    from (select livequery.live.udf_api('https://flipsidecrypto.xyz/api/queries/25a3446f-6edd-4e73-a282-563319ed1940/latest-run')
    as response), lateral FLATTEN (input => response:data:result:rows)),

    ----------------------- ft transfers -----------------------
    --$UWON token transfers
    uwon_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