John_GaltAverage AMPS to yLuna Ratio for yLuna Groups
    Updated 2022-07-07
    with table1 as (select ----***this query includes addresses that have had up to two unpledging events, but not three or more***
    tx_id,
    block_timestamp as date,
    event_attributes:boost_amount / pow(10, 6) as total_boosted
    from terra.msg_events
    where event_index = 3
    and event_attributes:action = 'activate_boost'
    and event_attributes:contract_address= 'terra1ns5nsvtdxu53dwdthy3yxs6x3w2hf3fclhzllc'
    ),

    table2 as (select
    tx_id,
    event_attributes:sender as amper_address
    from terra.msg_events
    where date(block_timestamp) > '2022-02-01'
    and event_index = 2
    ),

    allboost as (select --this is all boosting events, manual and auto, by address and date
    table1.date, table2.amper_address, table1.total_boosted
    from table1
    inner join table2 on table1.tx_id = table2.tx_id
    union all
    select
    block_timestamp as date,
    event_attributes:"0_from" as amper_address,
    event_attributes:boost_amount / pow(10, 6) as total_boosted
    from terra.msg_events
    where event_index = 3
    and event_attributes:"1_action" = 'yluna_farming_bond'
    and event_attributes:"0_contract_address" = 'terra17wkadg0tah554r35x6wvff0y5s7ve8npcjfuhz'
    and event_attributes:"1_contract_address" = 'terra1ns5nsvtdxu53dwdthy3yxs6x3w2hf3fclhzllc'
    union all
    Run a query to Download Data