MLDZMNflow.12
    Updated 2022-08-14
    with tb1 as (SELECT
    *
    FROM Ethereum.core.dim_labels where label_type = 'cex' and label_subtype = 'hot_wallet'
    ),
    tb2 as (select
    block_timestamp,
    TX_TO as u1,
    tx_id
    from solana.core.fact_transfers
    where TX_FROM in (select ADDRESS from tb1)
    and BLOCK_TIMESTAMP>=CURRENT_DATE-180
    ),

    tb3 as (select
    s.block_timestamp,
    s.TX_TO as u2,
    s.tx_id
    from solana.core.fact_transfers s join tb2 b on s.TX_FROM=b.u1
    where s.block_timestamp>b.block_timestamp
    and s.BLOCK_TIMESTAMP>=CURRENT_DATE-180
    )

    select
    Label as token_out,
    count(distinct tx_id) as no_swap,
    count(distinct SWAPPER) as no_swapper
    from solana.core.fact_swaps s left outer join solana.core.dim_labels b on s.SWAP_TO_MINT=b.address
    where tx_id in (select tx_id from tb3)
    and token_out is not null
    group by 1
    order by 3 desc limit 10





    Run a query to Download Data