freemartian90 AAVE Price Effect on Delegates Votes
Updated 2023-05-10
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
33
34
35
36
›
⌄
-- forked from 7c5d4531-d3cd-44b0-a175-a65faf4be135
with ETH_price AS (
SELECT
hour,
price AS ETH_P
FROM ethereum.core.fact_hourly_token_prices
WHERE token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
AND hour > current_date - 90
),
average_tx_fee AS (
SELECT
date_trunc('day', block_timestamp::date) AS time,
avg(tx_fee) * avg(ETH_P) AS Average_Fee_USD
FROM ethereum.core.fact_transactions t inner JOIN ETH_price p
on p.hour::date = block_timestamp::date
GROUP BY 1),
delegatees AS (
SELECT
decoded_log:delegatee AS Delegatee,
count(distinct decoded_log:delegator) AS delegated_wallets
FROM ethereum.core.fact_decoded_event_logs
WHERE contract_address = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'
AND event_name in ('DelegateChanged')
GROUP BY delegatee
HAVING delegated_wallets > 2
),
delegate_votes AS (
SELECT
date_trunc('day', block_timestamp::date) AS time,
count(tx_hash) AS Vote_count,
Run a query to Download Data