select
liquidity_provider_address,
sum ( case when action = 'lp_tokens_minted' then amount
when action = 'lp_tokens_burned' then -amount end) / pow(10,decimal) as gamma_amount
from osmosis.core.fact_liquidity_provider_actions
where pool_id = '605'
and action in ('lp_tokens_minted', 'lp_tokens_burned')
group by liquidity_provider_address, decimal
--where tx_id = 'A5DCAB58986CCDE63234EB426A171C2A400364873C124828290E89BD3CDFEC27'
-- lp_tokens_minted,
-- lp_tokens_burned
-- amount / pow(10,decimal)