Query editor
with proposal as((selectblock_time,varbinary_substring(varbinary_substring(data,33,32),13) as proposer,varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,1,32))) as proposal_id,varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,225,32))) as start_block,varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,257,32))) as end_block,varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,353,32))) as quorumVotes,regexp_extract(from_utf8(varbinary_substring(data,449)), '# (.+?)\n', 1) as title,(select max(number) from ethereum.blocks) as now_block,tx_hashfrom ethereum.logswhere contract_address=0x6f3e6272a167e8accb32072d08e0957f9c79223dand topic0=0x0cc4b35cbed68ce6ca5b3e6560894c6ccc309603ed423fa45554c837dd9a06aa)union all(selectblock_time,varbinary_substring(varbinary_substring(data,33,32),13) as proposer,varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,1,32))) as proposal_id,varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,193,32))) as end_block,varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,225,32))) as start_block,varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,289,32))) as quorumVotes,regexp_extract(from_utf8(varbinary_substring(data,385)), '# (.+?)\n', 1) as title,(select max(number) from ethereum.blocks) as now_block,tx_hashfrom ethereum.logs wherecontract_address=0x6f3e6272a167e8accb32072d08e0957f9c79223dand topic0=0x6af0134faa0f9290c1d686d55012aca80302d31d5c856e4bc7954f7613dc7f87)),proposal_time as(select min(block_time) as block_time, proposerfrom proposalgroup by 2),pre_result as(select a.block_time, a.proposer, f.name,--case when a.block_time > e.block_time then 'Regular'--else 'New' end as "type",a.proposal_id, a.title, c.voters, c.votes, c.for_votes, c.against_votes, c.abstain_votes, quorumVotes,case when state is null and now_block < start_block then 'Pending'when b.state is null and now_block < end_block then 'Active'when b.state is null and now_block > end_block andc.for_votes > least(quorumVotes*1.5, quorumVotes+c.against_votes)+0.5 and c.for_votes > c.against_votes then 'Queued'when b.state is null and now_block > end_block andc.for_votes <= least(quorumVotes*1.5, quorumVotes+c.against_votes)+0.5 and c.for_votes > c.against_votes then 'Defeated'when b.state is null and c.for_votes <= c.against_votes then 'Defeated'when b.state is null and c.for_votes < quorumVotes then 'Defeated'else b.stateend as state, d.usd_value, d.eth_valuefrom proposal aleft join query_3285837 bon a.proposal_id = b.proposal_idleft join query_3285968 con a.proposal_id = c.proposal_idleft join query_3285939 don a.proposal_id = d.proposal_id--left join proposal_time e--on a.proposer = e.proposerleft join ens.reverse_latest fon a.proposer = f.address),