strawbetty Earn sides of Anchor protocol on Avalanche
    Updated 2022-03-30
    with tab1 as (
    SELECT tx_id
    FROM terra.msgs
    WHERE NOT msg_value:execute_msg:process_anchor_message is NULL
    ), tab2 as (
    SELECT
    date_trunc('day', block_timestamp) as day1,
    SUM(event_attributes['0_amount'][0]['amount'] / 100000) as volume
    FROM terra.msg_events
    WHERE tx_id in (SELECT * from tab1)
    AND event_type LIKE 'transfer'
    GROUP by 1
    ), tab3 as (
    SELECT
    day1,
    volume,
    SUM(volume) OVER (ORDER BY day1) as total_volume
    FROM tab2
    )


    SELECT *
    FROM tab3
    WHERE day1 > '2022-03-01'
    Run a query to Download Data