Afonso_DiazTop users
    Updated 2024-12-31
    with

    pricet as (
    select
    hour::date as date,
    avg(price) as price_usd
    from
    flow.price.ez_prices_hourly
    where
    symbol = 'FLOW'
    group by 1
    ),

    main as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as user,
    '0x' || substring(topics[2], 30) as token_address,
    utils.udf_hex_to_int(substring(data, 67, 64))::bigint / 1e18 as amount_flow,
    'Sell' as event_name
    from flow.core_evm.fact_event_logs b
    where
    tx_status = 'SUCCESS'
    and origin_function_signature = '0xc464fe65'
    and origin_to_address = '0xfD734fA1970f2750a4E54E4f12c54e670FdA80BA'
    and lower(contract_address) = lower(origin_to_address)
    and topics[0] like '%a0fe9740%'

    union all

    select
    tx_hash,
    block_timestamp,
    origin_from_address as user,
    '0x' || substring(topics[2], 30) as token_address,
    QueryRunArchived: QueryRun has been archived