SELECT
delegator_address ,
sum(CASE when action = 'delegate' then amount/pow(10,decimal) end) as amount_delegated,
sum(CASE when action = 'undelegate' then amount/pow(10,decimal) end) as amount_undelegated,
amount_delegated - amount_undelegated as osmo_staked
FROM osmosis.gov.fact_staking
WHERE currency = 'uosmo'
AND block_timestamp::date <= '2023-12-19'
AND TX_SUCCEEDED
GROUP BY 1
having osmo_staked >= 10