adriaparcerisaslava core naka: staked by validator share
Updated 2024-12-05
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
›
⌄
--select distinct msg_type, count(*) --distinct tx_log[0]:events[0]:attributes[0]:value as type, count(*) as counts
--from lava.core.fact_msg_attributes
--where tx_succeeded='TRUE'
--limit 10
--group by 1 order by 2 desc
with
lava_osmosis_stakes1 as (
SELECT
x.block_timestamp,
x.tx_id,
y.attribute_value as validator,
case when REGEXP_SUBSTR(x.attribute_value,'i.*') is not null then REGEXP_SUBSTR(x.attribute_value,'i.*')
else REGEXP_SUBSTR(x.attribute_value,'u.*') end as attribute_name,
avg(REPLACE(x.attribute_value, attribute_name, '')::decimal/pow(10,6)*(-1)) as staked
FROM lava.core.fact_msg_attributes x
join lava.core.fact_msg_attributes y on x.tx_id=y.tx_id
where x.msg_type='unbond' and x.attribute_key='amount' and y.msg_type='unbond' and y.attribute_key='validator' --and x.block_timestamp>='2024-07-30 17:00:000'
group by 1,2,3,4
having staked is not null and attribute_name is not null and staked>-1e9
),
lava_osmosis_stakes2 as (
SELECT
ifnull(x.block_timestamp,y.block_timestamp),
x.tx_id,
y.attribute_value as validator,
case when REGEXP_SUBSTR(x.attribute_value,'i.*') is not null then REGEXP_SUBSTR(x.attribute_value,'i.*')
else REGEXP_SUBSTR(x.attribute_value,'u.*') end as attribute_name,
avg(REPLACE(x.attribute_value, attribute_name, '')::decimal/pow(10,6)) as staked
FROM lava.core.fact_msg_attributes x
join lava.core.fact_msg_attributes y on x.tx_id=y.tx_id
where x.msg_type='delegate' and x.attribute_key='amount' and y.msg_type='delegate' and y.attribute_key='validator' --and x.block_timestamp>='2024-07-30 17:00:000'
group by 1,2,3,4
having staked is not null and attribute_name is not null and staked<1e9
QueryRunArchived: QueryRun has been archived