commanderjoseph-761gwXTop Validators copy
Updated 2024-10-24
999
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 Mrfti / Top Validators @ https://flipsidecrypto.xyz/Mrfti/q/R6uR9wZ6G51z/top-validators
-- forked from Top Validators @ https://flipsidecrypto.xyz/studio/queries/30d0d8fb-f7ea-4649-8b39-b023341e450b
with alldata AS
(
(
with undelegation_database as (
with database AS
(
WITH tbl AS
(
SELECT *
FROM berachain.testnet.fact_event_logs
where
ORIGIN_TO_ADDRESS ='0xbda130737bdd9618301681329bf2e46a016ff9ad'
and CONTRACT_ADDRESS ='0xbda130737bdd9618301681329bf2e46a016ff9ad'
and ORIGIN_FUNCTION_SIGNATURE='0xe1f63d2e'
and TX_SUCCEEDED = 'TRUE'
)
SELECT
block_timestamp,
tx_hash,
'0x' || SUBSTR(PARSE_JSON(TOPICS)[1]::string, -40) AS user_wallet,
'0x' || SUBSTR(PARSE_JSON(TOPICS)[2]::string, -40) AS validator_address,
utils.udf_hex_to_int(DATA)/pow (10,18) AS undelegated_amount
FROM tbl
)
SELECT validator_address, sum (undelegated_amount) as "total undelegation"
from database
GROUP by 1
order by 2 desc
),
delegation_database AS
QueryRunArchived: QueryRun has been archived