select
date_trunc('month',block_timestamp) as block_month, action, sum(event_amount) as LUNA_staked,
case when action = 'undelegate' then concat('-',LUNA_staked)
else LUNA_staked
end as Amount
from terra.staking
where tx_status = 'SUCCEEDED'
group by 1,2
order by 1 desc