staderRevenue distribution
    Updated 2022-07-07
    with liquid as (
    select
    case
    when event_attributes:"1_amount"[0]:amount is not null then 'liquid_staking'
    end as stream,
    sum(event_attributes:"1_amount"[0]:amount::float/pow(10,6)) as rev
    from terra.msg_events
    where
    event_type in ('coin_received')
    and tx_status in ('SUCCEEDED')
    and event_attributes:"1_receiver"::string in ('terra1dykk536s6yvtek4hjyst6tflu5r7jf4ycvy4r5')
    and date(block_timestamp) >= date('2021-11-20')
    --and date(block_timestamp) >= current_date - INTERVAL '30 days'
    and tx_id in (
    select tx_id from terra.msgs
    where
    msg_value:execute_msg:reinvest is not null
    and tx_status in ('SUCCEEDED')
    )
    group by 1
    ),

    plus as (
    select
    case
    when event_attributes:"1_amount"[0]:amount is not null then 'stake_plus'
    end as stream,
    sum(event_attributes:"1_amount"[0]:amount::float/pow(10,6)) as rev
    from terra.msg_events
    where
    event_type in ('coin_received')
    and tx_status in ('SUCCEEDED')
    and event_attributes:"1_receiver"::string in ('terra16xcytyuaatus8xlgl7fxascvshhn9h8cfq6p08')
    and date(block_timestamp) >= date('2022-02-16')
    --and date(block_timestamp) >= current_date - INTERVAL '30 days'
    and tx_id in (
    Run a query to Download Data