saeedmzn$FLOW Centralized Exchange(CEX) Flows -Distribution based on inflow
    Updated 2025-01-26
    -- forked from $FLOW Centralized Exchange(CEX) Flows -Distribution based on outflow @ https://flipsidecrypto.xyz/studio/queries/c8fd86bb-1785-43e6-a0b9-c4d907984947

    with CEXes as (
    select ADDRESS ,LABEL PROJECT_NAME
    from flow.core.dim_labels
    where LABEL_TYPE = 'cex'
    ) ,
    Transfer_from_CEXes_tx as (
    select BLOCK_TIMESTAMP ::date date ,
    TX_ID tx_hash ,
    RECIPIENT user,
    SENDER,
    amount ,
    PROJECT_NAME CEX
    from flow.core.ez_token_transfers join CEXes on SENDER = ADDRESS
    where BLOCK_TIMESTAMP ::date >= current_date - 180
    and TOKEN_CONTRACT = 'A.1654653399040a61.FlowToken'
    ) ,
    Transfer_to_CEXes_tx as (
    select BLOCK_TIMESTAMP ::date date ,
    tx_id tx_hash ,
    RECIPIENT,
    SENDER user ,
    amount ,
    PROJECT_NAME CEX
    from flow.core.ez_token_transfers join CEXes on RECIPIENT = ADDRESS
    where BLOCK_TIMESTAMP ::date >= current_date - 180
    and TOKEN_CONTRACT = 'A.1654653399040a61.FlowToken'
    ),
    all_ as (
    select 'Outflow' flow , * from Transfer_from_CEXes_tx
    UNION
    select 'Inflow' flow , * from Transfer_to_CEXes_tx
    )
    select
    case when amount < 1 then 'Less than 1 $FLOW'
    QueryRunArchived: QueryRun has been archived