Sbhn_NPpurring-violet
    Updated 2025-04-09
    with price as (
    select hour::date as datee,
    symbol,
    avg(price) as usdprice
    from crosschain.price.ez_prices_hourly
    where symbol in ('UBTC','EZETH','PZETH')
    group by 1,2
    )

    select date_trunc('month',block_timestamp) as date,
    case when contract_address = '0xa166219df110bda97b91e65d4bb4aae4159978b9' then 'EZETH'
    when contract_address = '0x982abbb04f91acc47ad0cb0a11f29d50c5007934' then 'PZETH'
    when contract_address = '0xfa3198ecf05303a6d96e57a45e6c815055d255b1' then 'UBTC' end as token,
    count(distinct concat('0x', right(topic_2,40))) as receivers,
    sum(ethereum.public.udf_hex_to_int(substr(data,3,len(data))) / pow(10,18)) as amount,
    sum((ethereum.public.udf_hex_to_int(substr(data,3,len(data))) / pow(10,18))*usdprice) as amount_usd
    from swell.core.fact_event_logs
    join price on block_timestamp::date =datee and symbol=token
    where topic_0 = '0xba20947a325f450d232530e5f5fce293e7963499d5309a07cee84a269f2f15a6'
    and contract_address in ('0xfa3198ecf05303a6d96e57a45e6c815055d255b1','0x982abbb04f91acc47ad0cb0a11f29d50c5007934','0xa166219df110bda97b91e65d4bb4aae4159978b9')
    and origin_to_address = '0x3a464f746d23ab22155710f44db16dca53e0775e'
    group by 1,2


    Last run: 14 days ago
    DATE
    TOKEN
    RECEIVERS
    AMOUNT
    AMOUNT_USD
    1
    2024-12-01 00:00:00.000PZETH311105.4583862264737463.51788744
    2
    2024-12-01 00:00:00.000UBTC143600.10390953959182537.5812148
    3
    2025-02-01 00:00:00.000EZETH443708.026857331983107.09322251
    4
    2025-01-01 00:00:00.000PZETH1777.113583656307393.205570033
    5
    2025-04-01 00:00:00.000PZETH10.0542116.91963025
    6
    2024-12-01 00:00:00.000EZETH8462915.62326235710201567.8772934
    7
    2025-02-01 00:00:00.000PZETH161393.6711640884977683.76006549
    8
    2025-03-01 00:00:00.000PZETH713.70820655235877.609440591
    9
    2025-04-01 00:00:00.000UBTC80.000681116108256.076581799
    10
    2025-03-01 00:00:00.000UBTC1110.017920258461536.925155626
    11
    2025-04-01 00:00:00.000EZETH213.0090461995761.78955954
    12
    2025-01-01 00:00:00.000UBTC57250.3507444044739165.10074191
    13
    2025-01-01 00:00:00.000EZETH2740697.6260699072364636.60821027
    14
    2025-02-01 00:00:00.000UBTC1580.048623747734706.327159408
    15
    2025-03-01 00:00:00.000EZETH370116.663689137247416.55104502
    15
    1KB
    6s