misaghlbTerradash Part 2: Staking and Supply
    Updated 2022-12-08
    select
    sum(case when action in ('Delegate') then amount end) as staked_amount,
    sum(case when action in ('Undelegate') then amount end) as unstaked_amount,
    sum(case when action in ('Delegate') then amount when action in ('Undelegate') then amount * -1 end) as net_staked,
    127475474 as circulating_supply,
    (net_staked / circulating_supply * 100) as circulating_supply_to_staked
    from terra.core.ez_staking
    where tx_succeeded = 'TRUE'
    and action in ('Delegate', 'Undelegate')
    Run a query to Download Data