Sbhn_NPsquid comp 2 copy
    Updated 2023-04-22
    -- forked from adriaparcerisas / squid comp 2 @ https://flipsidecrypto.xyz/adriaparcerisas/q/axelar-crosschains-4-2-WNGEW7

    with
    squid as (
    SELECT
    block_timestamp,tx_hash,
    source_chain,sender,destination_chain,
    token_symbol,amount
    from axelar.core.ez_squid
    ),
    total as (
    select 'Squid' as bridge, * from squid
    ),
    prices as (
    select
    trunc(recorded_hour,'day') as day,
    symbol,
    avg(price) as price_usd
    from osmosis.core.ez_prices
    group by 1,2
    ),
    final_squid as (
    SELECT
    trunc(block_timestamp,'{{Date}}') as date,
    bridge,
    count(distinct tx_hash) as transactions,
    count(distinct sender) as active_users,
    sum(amount*price_usd) as volume
    from total x
    join prices y on trunc(x.block_timestamp,'day')=y.day
    and token_symbol=symbol
    where amount*price_usd<1e6
    group by 1,2
    ),
    Run a query to Download Data