Sbhn_NPfundamental-coffee
    Updated 2025-03-16
    with price as (
    select hour::date as datee,
    avg(price) as usdprice
    from ink.price.ez_prices_hourly
    where symbol = 'WETH'
    group by 1
    )

    select
    count(distinct tx_hash) as transactions,
    count(distinct origin_from_address) as users,
    sum(ethereum.public.udf_hex_to_int(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[6]) / pow(10,18)) as amount_eth,
    sum((ethereum.public.udf_hex_to_int(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[6]) / pow(10,18))*usdprice) as amount_usd
    from ink.core.fact_event_logs
    join price on block_timestamp::date=datee
    where topic_0 in ('0x4b5824a0f21039d7160b2a57d8c140cae3ba13e4f15bcd879cc63e4964681a9e','0x0d29d7b2727600087ca17290038d4c09dc340440df666c931e739ad49594669e')
    and origin_to_address = '0x1d74317d760f2c72a94386f50e8d10f2c902b899'
    and concat('0x', right(regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}')[4],40)) != '0x1d74317d760f2c72a94386f50e8d10f2c902b899'

    Last run: about 1 month ago
    TRANSACTIONS
    USERS
    AMOUNT_ETH
    AMOUNT_USD
    1
    252297129493.2398940351512264.72082517
    1
    45B
    24s