mamad-5XN3k3Aptos L0 2
    Updated 2025-01-14
    -- forked from 0xham-d / in total @ https://flipsidecrypto.xyz/0xham-d/q/ugfze9yitufw/in-total

    with pricet as (
    select
    hour::date as p_date,
    symbol,
    avg(price) as usd_price
    from crosschain.price.ez_prices_hourly
    where blockchain = 'ethereum'
    group by 1 ,2
    )

    select
    date_trunc('day',block_timestamp) as date,
    --direction, --inbound/outbound
    count(distinct tx_hash) as txs,
    count(distinct receiver) as receivers,
    count(distinct sender) as senders,
    --count(distinct source_chain_name) as sources,
    --count(distinct destination_chain_name) as destinations,
    --token_address,
    --count(distinct b.symbol) as tokens
    --(amount_unadj/pow(10, decimals)) as amount
    round(sum((amount_unadj/pow(10, decimals))*usd_price),0) as amount_usd
    from aptos.defi.fact_bridge_activity a
    join aptos.core.dim_tokens b using(token_address)
    join pricet c on block_timestamp::date = p_date::date and lower(b.symbol) = lower(c.symbol)
    where platform = 'layerzero'
    and block_timestamp::date >= '2024-01-01'
    group by 1
    order by 1 asc



    Last run: about 2 months ago
    DATE
    TXS
    RECEIVERS
    SENDERS
    AMOUNT_USD
    1
    2024-01-01 00:00:00.00021821855779777786
    2
    2024-01-02 00:00:00.000243220807821589965
    3
    2024-01-03 00:00:00.000219918417061087129
    4
    2024-01-04 00:00:00.000291922768272095214
    5
    2024-01-05 00:00:00.00024631940677888756
    6
    2024-01-06 00:00:00.000256721006883598008
    7
    2024-01-07 00:00:00.000321027128341091971
    8
    2024-01-08 00:00:00.000380431888611153548
    9
    2024-01-09 00:00:00.00030652523757616686
    10
    2024-01-10 00:00:00.000297523947571138679
    11
    2024-01-11 00:00:00.000294725227471243600
    12
    2024-01-12 00:00:00.000251821476993604914
    13
    2024-01-13 00:00:00.000247822057282329964
    14
    2024-01-14 00:00:00.000314326159774052185
    15
    2024-01-15 00:00:00.0003933306411236127699
    16
    2024-01-16 00:00:00.000351627578174947941
    17
    2024-01-17 00:00:00.000541727368502444912
    18
    2024-01-18 00:00:00.000289024876721105240
    19
    2024-01-19 00:00:00.000297623208622039046
    20
    2024-01-20 00:00:00.000342428679971260558
    ...
    380
    18KB
    39s