Meireth+ Delegations copy
Updated 2023-06-20
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 hyUSD Delegations @ https://flipsidecrypto.xyz/edit/queries/2696558f-72ec-442a-87d0-f57843ab447f
-- forked from eUSD Delegations @ https://flipsidecrypto.xyz/edit/queries/409ca944-2e06-45ae-b0d9-56634d62a0b2
-- forked from Delegations @ https://flipsidecrypto.xyz/edit/queries/74af9882-c047-49da-9b98-2d22e8fe8c00
with dates as (
select
date_day
from ethereum.core.dim_dates
where date_day between '{{start_date}}' and current_date()
),
distinct_delegates as (
SELECT
DISTINCT(DECODED_LOG:delegate::string ) as delegate
FROM ethereum.core.ez_decoded_event_logs
WHERE CONTRACT_ADDRESS = lower('0xffa151Ad0A0e2e40F39f9e5E9F87cF9E45e819dd')
AND EVENT_NAME = 'DelegateVotesChanged'
),
dates_x_delegates as (
select
date_day,
delegate
from dates
cross join distinct_delegates
),
delegation_balance as (
SELECT
DECODED_LOG:delegate::string as delegate,
DECODED_LOG:newBalance::int / pow(10,18) as new_balance,
DECODED_LOG:previousBalance::int / power(10,18) as previous_balance,
BLOCK_TIMESTAMP,
block_timestamp::date as balance_date
Run a query to Download Data