Elprognerd2023-04-04 04:49 AM
Updated 2023-04-04Copy Reference Fork
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
›
⌄
with tab1 as (
SELECT tx_hash
FROM arbitrum.core.fact_transactions
WHERE to_address LIKE lower('0x912CE59144191C1204E64559FE8253a0e49E6548')
)
SELECT
delegator,
event_inputs:toDelegate as Delegate
FROM arbitrum.core.fact_event_logs
LEFT outer JOIN (
SELECT
event_inputs:delegator as delegator,
--event_inputs:toDelegate as toDelegate,
max(block_timestamp) as max_delegate_time
FROM arbitrum.core.fact_event_logs
WHERE tx_hash in (SELECT * from tab1)
AND event_name LIKE 'DelegateChanged'
GROUP BY 1
)
on max_delegate_time = block_timestamp
AND delegator = event_inputs:delegator
WHERE tx_hash in (SELECT * from tab1)
AND event_name LIKE 'DelegateChanged'
AND not DELEGATOR is NULL
Run a query to Download Data