azerbaijanUntitled Query
    Updated 2022-10-16
    with inflow as(
    select
    block_timestamp :: date as day,
    case when day >= '2022-09-11' and day < '2022-10-11 23:00:00.000' then 'Before Mango Hack'
    when day >= '2022-10-11 23:00:00.000' then 'After Mango Hack' else null end as time,
    sum(inner_instruction : instructions[0] : parsed : info : amount / 1e9) as amount_in
    from solana.fact_events
    Where program_id = 'mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68'
    AND inner_instruction : instructions[0] : parsed : info : destination = 'AVn3JRGhifPCxjxZsU3tQuo4U4dTHizHzBDGW983tx47'
    and block_timestamp >= '2022-10-01'
    group by 1
    ),
    outflow as(
    select
    block_timestamp :: date as day,
    case when day >= '2022-09-11' and day < '2022-10-11 23:00:00.000' then 'Before Mango Hack'
    when day >= '2022-10-11 23:00:00.000' then 'After Mango Hack' else null end as time,
    sum(inner_instruction : instructions[0] : parsed : info : amount / 1e9) as amount_out
    from solana.fact_events
    Where program_id = 'mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68'
    AND inner_instruction : instructions[0] : parsed : info : source = 'AVn3JRGhifPCxjxZsU3tQuo4U4dTHizHzBDGW983tx47'
    and block_timestamp >= '2022-10-01'
    group by 1),
    final as(
    select
    a.day as day,
    amount_in as inflow,
    amount_out as outflow
    from inflow a join outflow b on a.day = b.day
    )
    select
    case when day >= '2022-09-11' and day < '2022-10-11 23:00:00.000' then 'Before Mango Hack'
    when day >= '2022-10-11 23:00:00.000' then 'After Mango Hack' else null end as time,
    avg(inflow),
    Run a query to Download Data