bera-terminaltotal bgt delegate
Updated 2024-10-11
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 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 (
with database AS (
WITH tbl AS (
SELECT
QueryRunArchived: QueryRun has been archived