misaghlbTerradash Part 2: Staking and Supply
    Updated 2022-12-08
    select
    date_trunc('week', block_timestamp) as date,
    case when action in ('Delegate') then 'Stake'
    when action in ('Undelegate') then 'Unstake'
    when action in ('Redelegate') then 'Redelegate'
    end as type,
    count(distinct tx_id) as tx_count,
    count(distinct DELEGATOR_ADDRESS) as wallets,
    count(distinct VALIDATOR_ADDRESS) as validators,
    sum(amount) as vol,
    avg(amount) as avg_vol,
    sum(tx_count) over(partition by type order by date) as cumu_tx_count,
    sum(vol) over(partition by type order by date) as cumu_vol
    from terra.core.ez_staking
    where tx_succeeded = 'TRUE'
    group by date, type
    Run a query to Download Data