HosseinTotal Wormhole Swap from Solana to Ethereum Network
    Updated 2022-12-02
    with prices as (
    select block_timestamp::date as day,
    swap_from_mint as mint,
    median (swap_to_amount/swap_from_amount) as price_usd
    from solana.fact_swaps
    where swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
    and swap_to_amount > 0
    and swap_from_amount > 0
    and succeeded = 1
    group by 1,2
    ),
    wormhole as (
    select distinct(tx_id) as tx_id
    from solana.core.fact_events
    where program_id = 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb'
    )

    select
    count(distinct tx_id) as txn_count,
    count(distinct tx_from) as users_count,
    txn_count / users_count as tx_per_user,
    sum(amount * price_usd) as volume_usd,
    volume_usd / users_count as volume_per_user,
    avg(amount * price_usd) as volume_usd_avg,
    median(amount * price_usd) as volume_usd_median
    from solana.core.fact_transfers
    join prices using (mint)
    where tx_id in (select tx_id from wormhole)
    and block_timestamp >= '2022-11-01'
    Run a query to Download Data