Sbhn_NPvisible-emerald
    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 ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '223' then 'B2 Network'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '1' then 'Ethereum'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '48900' then 'Zircuit'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '42161' then 'Arbitrum'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '34443' then 'Mode'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '59144' then 'Linea'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '10' then 'Optimism'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '8453' then 'Base'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '81457' then 'Blast'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '1329' then 'Sei'
    when ethereum.public.udf_hex_to_int(substr(topic_1,3,len(topic_1))) = '56' then 'BSC'
    else 'Other' end as source_chain,
    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=case when contract_address = '0xa166219df110bda97b91e65d4bb4aae4159978b9' then 'EZETH'
    when contract_address = '0x982abbb04f91acc47ad0cb0a11f29d50c5007934' then 'PZETH'
    when contract_address = '0xfa3198ecf05303a6d96e57a45e6c815055d255b1' then 'UBTC' end
    where topic_0 = '0xba20947a325f450d232530e5f5fce293e7963499d5309a07cee84a269f2f15a6'
    and contract_address in ('0xfa3198ecf05303a6d96e57a45e6c815055d255b1','0x982abbb04f91acc47ad0cb0a11f29d50c5007934','0xa166219df110bda97b91e65d4bb4aae4159978b9')
    and origin_to_address = '0x3a464f746d23ab22155710f44db16dca53e0775e'
    group by 1,2

    Last run: 12 days ago
    DATE
    SOURCE_CHAIN
    RECEIVERS
    AMOUNT
    AMOUNT_USD
    1
    2025-03-01 00:00:00.000Linea355.86278439712399.702802739
    2
    2025-02-01 00:00:00.000B2 Network1370.031563456293050.058175745
    3
    2025-04-01 00:00:00.000Optimism30.031458.991873381
    4
    2025-01-01 00:00:00.000Optimism913177.262122073601024.620560048
    5
    2024-12-01 00:00:00.000Blast3364.482906469225104.202189202
    6
    2025-03-01 00:00:00.000Blast78.30400061216552.022439905
    7
    2025-01-01 00:00:00.000Arbitrum38985.149907705293685.326871421
    8
    2025-01-01 00:00:00.000B2 Network49750.2107051214725576.82745372
    9
    2025-03-01 00:00:00.000BSC192.9125110736017.84545242
    10
    2025-02-01 00:00:00.000Optimism5833.807995735104827.874203744
    11
    2025-04-01 00:00:00.000Mode40.65367242561281.742406135
    12
    2025-02-01 00:00:00.000Ethereum27640.1750294671921674.03150752
    13
    2025-01-01 00:00:00.000BSC607.01888172824138.38358085
    14
    2025-01-01 00:00:00.000Sei7021.39677958472634.678929181
    15
    2025-02-01 00:00:00.000Linea367.73658295821842.242584163
    16
    2025-02-01 00:00:00.000Blast1246.806019192132863.515092964
    17
    2024-12-01 00:00:00.000Optimism166155.906546862563667.624150667
    18
    2025-04-01 00:00:00.000B2 Network50.000505111641.694015312
    19
    2025-04-01 00:00:00.000Zircuit20.05421116.938396787
    20
    2025-04-01 00:00:00.000BSC10.000010.0187665369
    58
    4KB
    34s