ZookTHL Locks copy
Updated 2024-12-12
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
›
⌄
-- forked from Antonidas / THL Locks @ https://flipsidecrypto.xyz/Antonidas/q/yuU1fgfgQXPC/thl-locks
with latest_epoch_table as (
SELECT
event_data:epoch as latest_epoch,
event_data:locked_amount as locked_amount,
event_data:locked_epochs as locked_epochs,
event_data:unlockable_epoch as unlockable_epoch
from aptos.core.fact_events
where 1=1
and event_type = '0x167f411fc5a678fb40d86e0af646fa8f62458b686ad8996215248447037af40c::vetoken::VeTokenLockEvent<0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615::thl_coin::THL>'
order by block_timestamp desc
limit 1
), raws as (
SELECT
block_timestamp,
event_data:epoch as epoch,
event_data:locked_amount / pow(10,8) as locked_amount ,
event_data:locked_epochs as locked_epochs,
event_data:unlockable_epoch as unlockable_epoch
from aptos.core.fact_events
where 1=1
and event_type = '0x167f411fc5a678fb40d86e0af646fa8f62458b686ad8996215248447037af40c::vetoken::VeTokenLockEvent<0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615::thl_coin::THL>'
and event_data:unlockable_epoch > (select latest_epoch from latest_epoch_table)
)
select
sum(locked_amount) as lockedTHL
from raws
QueryRunArchived: QueryRun has been archived