maybeyonassol_jup_orca_sol
    Updated 2022-03-14
    with
    labels as (
    select
    address,
    address_name
    from solana.labels
    ),
    jup as (
    select
    -- swap_from_mint,
    'jupiter' as dex,
    l1.address_name as sell_token,
    -- swap_to_mint,
    l2.address_name as buy_token,
    l1.address_name || ' to ' || l2.address_name as swap_combo,
    sum(swap_from_amount) as sol_sold,
    count(distinct tx_id) as sell_transactions
    from solana.swaps
    inner join labels l1 on lower(l1.address) = lower(swap_from_mint)
    inner join labels l2 on lower(l2.address) = lower(swap_to_mint)
    where swap_to_amount > 0
    and block_timestamp >= '2022-01-01'
    and swap_program = 'jupiter aggregator v2'
    and swap_from_mint != swap_to_mint
    and (
    swap_from_mint = 'So11111111111111111111111111111111111111112'
    -- or
    -- swap_to_mint = 'So11111111111111111111111111111111111111112'
    )
    group by 1,2,3,4
    order by sol_sold desc
    limit 5
    ),
    orca as (
    select
    -- swap_from_mint,
    Run a query to Download Data