HaisenbergTop-10-pairs-by-swap-count
    Updated 2023-10-28
    with swappair AS (
    SELECT
    concat(swap_to_mint, '-', swap_from_mint) as contracts,
    count(*) as swapcount,
    swap_from_mint,
    swap_to_mint
    FROM
    solana.defi.fact_swaps
    WHERE
    block_timestamp :: date >= '2021-01-01'
    AND succeeded = 'True'
    AND swap_program ilike '%raydium%'
    GROUP BY
    contracts,
    swap_from_mint,
    swap_to_mint
    ORDER BY
    swapcount DESC
    LIMIT
    10
    ),

    labelpair_from AS (
    select
    label as label_from,
    swapcount
    From
    swappair s
    LEFT OUTER JOIN solana.core.dim_labels b on s.swap_from_mint = b.address
    GROUP BY
    label_from,
    swapcount
    ORDER BY
    swapcount DESC
    LIMIT
    10
    Run a query to Download Data