cypherOp delegates
Updated 2023-07-01
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
›
⌄
WITH op_claims as (select
date_trunc('day', block_timestamp) as day,
tx_hash,
to_address as claimer,
raw_amount/1e18 as amount
from optimism.core.fact_token_transfers
where contract_address = lower('0x4200000000000000000000000000000000000042') --OP token
and from_address = lower('0xfedfaf1a10335448b7fa0268f56d2b44dbd357de') --claim contract
),
total_claimed as (select
distinct(claimer) as unique_claimer,
sum(amount) as total_claimed
from op_claims
group by unique_claimer),
delegations as (select
block_timestamp,
tx_hash,
origin_from_address as delegater,
event_inputs:newBalance as new_balance,
event_inputs:previousBalance as old_balance,
(new_balance - old_balance)/1e18 as delegated_amount
from optimism.core.fact_event_logs
where event_name = 'DelegateVotesChanged'
and block_timestamp > '2022-05-31 23:45:00'
and delegated_amount >= 0),
claimer_delegations as (select * from delegations
where delegater in (select unique_claimer from total_claimed)),
total_delegations as (select delegater, sum(delegated_amount) as total_delegated
from claimer_delegations
group by delegater),
Run a query to Download Data