0-MIDDaily Liquidity Flow on Solana Defi by Defi Projecs
    Updated 2022-11-22
    with task1 as (
    with act1 as (
    with tab1 as (
    select ADDRESS,LABEL
    from solana.core.dim_labels
    where LABEL_TYPE='defi' or LABEL_TYPE='dex'
    union all
    select 'srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX'as address
    ,'openbook'as label
    ),
    tab2 as (
    select BLOCK_TIMESTAMP::date as date
    ,PROGRAM_ID
    , TX_ID
    , INSTRUCTION:accounts[1] as users
    from solana.core.fact_events
    where SUCCEEDED='TRUE'
    group by 1,2,3,4)
    select date
    ,LABEL
    ,TX_ID
    ,case
    when date>='2022-11-07' then 'After Ftx Chaos'
    else 'Before Ftx Chaos' end as chaos_time
    from tab1
    left join tab2
    on tab1.ADDRESS=tab2.PROGRAM_ID
    where chaos_time is not null
    and date>=current_date-27
    group by 1,2,3),
    act2 as (
    select TX_ID,AMOUNT,MINT
    from solana.core.fact_transfers)
    select date
    ,LABEL
    ,chaos_time
    Run a query to Download Data