hess2.2
    Updated 2022-12-11
    with redelage as ( select date(a.block_timestamp) as date, tx_from , b.tx_id, replace(ATTRIBUTE_VALUE,'uatom','' ) as amount
    from cosmos.core.fact_msg_attributes a join cosmos.core.fact_transactions b on a.tx_id = b.tx_id
    where MSG_TYPE = 'redelegate' and ATTRIBUTE_KEY = 'amount')
    ,
    amount as ( select date, tx_from , tx_id, amount/pow(10,6) as redelegate_amount
    from redelage )

    select date , case when date between '2022-10-30' and '2022-11-14' then 'Proposal 82'
    when date < '2022-10-30' then 'Before Proposal 82' else 'After Proposal 82' end as types,
    count(DISTINCT(tx_from)) as total_user, count(DISTINCT(tx_id)) as total_tx, sum(redelegate_amount) as total_atom,
    avg(redelegate_amount) as avg_atom
    from amount
    where date >= '2022-09-01'
    group by 1,2
    Run a query to Download Data