Elprognerd8 - staking 2023
    Updated 2023-01-08
    select
    --date_trunc('day', block_timestamp),
    case when action='Delegate' then 'Stake'
    when action ='Undelegate' then 'Unstake'
    END as type,
    COUNT(DISTINCT DELEGATOR_ADDRESS) as "Number of Delegators",
    count(tx_id) as "Count",
    sum(AMOUNT) as "Volume"
    from terra.core.ez_staking
    where block_timestamp >= '2023-01-01'--current_date - INTERVAL '60 days'
    and TX_SUCCEEDED='True'
    and ACTION in ('Delegate', 'Undelegate')
    group by 1
    --order by 1
    Run a query to Download Data