saeedmznSatelite Bridging Routes' Stats copy
    Updated 2024-06-03
    -- forked from Ali3N / Satelite Bridging Routes' Stats @ https://flipsidecrypto.xyz/Ali3N/q/mNx--PtpD28r/satelite-bridging-routes-stats

    with pricet as (
    select hour::date as day,
    token_address,
    symbol,
    decimals,
    avg (price) as USDPrice
    from crosschain.price.ez_prices_hourly
    where hour >= '{{Start_Date}}' and hour <= '{{End_Date}}'
    group by 1,2,3,4)

    select concat (initcap(source_chain),' => ',initcap(destination_chain)) as route,
    sum (amount*usdprice) as Volume,
    avg (amount*usdprice) as Average_Volume,
    count (distinct tx_hash) as Bridges,
    count (distinct sender) as Senders,
    count (distinct receiver) as Receivers,
    round (Bridges / Senders) as Bridges_Count_Per_Sender,
    round (Volume / Senders) as Bridges_Volume_Per_Sender
    from axelar.defi.ez_bridge_satellite t1 join pricet t2 on t1.block_timestamp::date = t2.day and t1.token_address = t2.token_address
    where block_timestamp >= '{{Start_Date}}' and block_timestamp <= '{{End_Date}}'
    group by 1
    order by 2 desc

    /*union all

    select 'Squid' as bridge,
    concat (initcap(source_chain),' => ',initcap(destination_chain)) as route,
    count (distinct tx_hash) as Bridges,
    count (distinct sender) as Senders,
    count (distinct receiver) as Receivers,
    sum (amount*usdprice) as Volume,
    avg (amount*usdprice) as Average_Volume,
    round (Bridges / Senders) as Bridges_Count_Per_Sender,
    round (Volume / Senders) as Bridges_Volume_Per_Sender
    QueryRunArchived: QueryRun has been archived