Sbhn_NP2024-07-24 10:43 AM
    Updated 2024-10-17
    with price as (
    select hour::date as datee,
    avg(price) as usdprice
    from kaia.price.ez_prices_hourly
    where symbol = 'WKLAY'
    group by 1
    )

    select date_trunc('day',block_timestamp) as date,
    count(DISTINCT tx_hash) as swaps,
    count(DISTINCT origin_from_address) as trader,
    sum(abs(utils.udf_hex_to_int('s2c',regexp_substr_all(substr(data,3,len(data)),'.{64}')[0])/pow(10,18))*usdprice) as amount
    from kaia.core.fact_event_logs
    left join price on block_timestamp::date=datee
    where topics[0] = '0x19b47279256b2a23a1665c810c8d55a1758940ee09377d4f8d26497a3577dc83'
    and contract_address = '0xb64ba987ed3bd9808dbcc19ee3c2a3c79a977e66'
    and block_timestamp::date >= current_date-30
    group by 1
    QueryRunArchived: QueryRun has been archived