0-MIDMonthly Distribution of Flow Balance by Flow Holders
    Updated 2022-11-29
    with act1 as (
    with tab1 as (
    select
    EVENT_DATA:to as user
    ,sum (EVENT_DATA:amount) as Deposit_Volume
    from flow.core.fact_events
    where EVENT_CONTRACT = 'A.1654653399040a61.FlowToken'
    and EVENT_TYPE = 'TokensDeposited'
    and TX_SUCCEEDED = 'TRUE'
    and BLOCK_TIMESTAMP<='2022-01-01'
    group by 1),
    tab2 as (
    select
    EVENT_DATA:from as user,
    sum (EVENT_DATA:amount) as Withdraw_Volume
    from flow.core.fact_events
    where EVENT_CONTRACT='A.1654653399040a61.FlowToken'
    and EVENT_TYPE='TokensWithdrawn'
    and TX_SUCCEEDED = 'TRUE'
    and BLOCK_TIMESTAMP<='2022-01-01'
    group by 1)
    select tab2.user
    ,sum (deposit_volume - withdraw_volume) as flow_Balance
    from tab1
    full outer join tab2
    on tab1.user = tab2.user
    where tab2.user<>'null'
    group by 1),
    -----------------------------------------------------------
    act2 as (
    with tab1 as (
    select
    EVENT_DATA:to as user
    ,sum (EVENT_DATA:amount) as Deposit_Volume
    from flow.core.fact_events
    where EVENT_CONTRACT = 'A.1654653399040a61.FlowToken'
    Run a query to Download Data