Moetop 50 Flow Holders on January 1st , 2022
    Updated 2022-11-29
    with
    flow_out as (
    select
    EVENT_DATA:from as sender ,
    sum(EVENT_DATA:amount) as flow_amt_out
    from flow.core.fact_events
    where 1 = 1
    and EVENT_TYPE ilike 'TokensWithdrawn'
    and EVENT_CONTRACT ilike '%FlowToken'
    and sender is not null
    and EVENT_DATA:from not ilike 'null'
    and TX_SUCCEEDED = 'TRUE'
    and block_timestamp::date <= '2022-01-01'
    group by 1
    )
    , flow_in as (
    select
    EVENT_DATA:to as receiver ,
    sum(EVENT_DATA:amount) as flow_amt_in
    from flow.core.fact_events
    where 1 = 1
    and EVENT_TYPE ilike 'TokensDeposited'
    and EVENT_CONTRACT like'A.1654653399040a61.FlowToken'
    and receiver is not null
    and EVENT_DATA:to not ilike 'null'
    and TX_SUCCEEDED = 'TRUE'
    and block_timestamp::date <= '2022-01-01'
    group by 1

    )

    select
    sender as wallet_address ,
    flow_amt_in - flow_amt_out as flow_holding ,
    row_number()over(order by flow_holding desc) as rank
    Run a query to Download Data