with proposaltx as (
select tx_id
from cosmos.core.fact_msg_attributes
where ATTRIBUTE_KEY= 'proposal_id'
and ATTRIBUTE_VALUE= '82'
and tx_succeeded = 'TRUE'),
voter as (
select block_timestamp,
tx_id,
attribute_value as Voter
from cosmos.core.fact_msg_attributes
where ATTRIBUTE_KEY= 'spender'
and tx_id in (select tx_id from proposaltx)
and tx_succeeded = 'TRUE'),
voteoption as (
select block_timestamp,
tx_id,
try_parse_json (attribute_value) as data,
data:option as vote_option,
case when vote_option = '1' then 'Yes'
when vote_option = '2' then 'Abstain'
when vote_option = '3' then 'No'
when vote_option = '4' then 'No With Veto'
end as vote_type
from cosmos.core.fact_msg_attributes
where ATTRIBUTE_KEY= 'option'
and data:option is not null
and tx_id in (select tx_id from proposaltx)
and tx_succeeded = 'TRUE'),
mergetable as (
select t2.block_timestamp,
t1.tx_id,
Voter,