connorhAAVE Proposal Target Addresses
Updated 2022-09-30
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
›
⌄
-- Proposal targets
WITH targets AS (
SELECT
DISTINCT
proposal_id,
LOWER(t.value::string) AS target
FROM aave.proposals,
lateral flatten(input => targets) t
),v AS (
SELECT
proposal_id,
voter,
voting_power,
support
FROM aave.votes
)
SELECT
target AS target_contract,
LISTAGG(DISTINCT targets.proposal_id,', ') AS involved_proposals,
COUNT(DISTINCT targets.proposal_id) AS n_proposals,
COUNT(DISTINCT voter) AS n_voters,
SUM(voting_power) AS total_voting_power,
SUM(CASE WHEN LOWER(support) <> 'true' THEN 1 ELSE 0 END) AS voters_against,
SUM(CASE WHEN LOWER(support) = 'true' THEN 1 ELSE 0 END) AS voters_for
FROM
targets
LEFT JOIN
v
ON targets.proposal_id = v.proposal_id
GROUP BY 1
ORDER BY n_proposals DESC
Run a query to Download Data