John_GaltPrism Total Staking Revenue Per Day in UST
    Updated 2022-07-07
    with table1 as (select
    date(block_timestamp) as date,
    sum(event_attributes:"1_amount") / pow(10, 6) as in_yluna_farm --into yluna farm
    from terra.msg_events
    where event_attributes:"1_to" = 'terra1p7jp8vlt57cf8qwazjg58qngwvarmszsamzaru'
    and event_attributes:"1_action" = 'yluna_farming_bond'
    and event_index = 3
    group by 1
    ),

    table2 as (select
    date(block_timestamp) as date,
    sum(event_attributes:"1_amount") / pow(10, 6) as in_regular_staking -- into regular staking
    from terra.msg_events
    where event_attributes:"1_contract_address" = 'terra1p7jp8vlt57cf8qwazjg58qngwvarmszsamzaru'
    and event_attributes:"1_action" = 'bond'
    and event_index = 3
    group by 1
    ),
    table3 as (select
    date(block_timestamp) as date,
    sum(event_attributes:"0_amount") / pow(10, 6) as out_yluna_farm -- out of yluna farm staking
    from terra.msg_events
    where event_attributes:"0_from" = 'terra1p7jp8vlt57cf8qwazjg58qngwvarmszsamzaru'
    and event_attributes:"0_action" = 'yluna_farming_unbond'
    and event_index = 3
    group by 1
    ),

    table4 as (select
    date(block_timestamp) as date,
    sum(event_attributes:"0_amount") / pow(10, 6) as out_regular_staking --gone out of regular staking
    from terra.msg_events
    where event_attributes:"from" = 'terra1p7jp8vlt57cf8qwazjg58qngwvarmszsamzaru'
    and event_attributes:"0_action" = 'unbond'
    Run a query to Download Data