JonasoFlow Rewards (2)
Updated 2024-09-19
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
P as( select date(hour) as date, max(price) as price from flow.price.ez_prices_hourly where symbol = 'FLOW' group by 1),
X as( select block_timestamp, event_data as data, event_contract as contract, event_type as type from flow.core.fact_events where tx_succeeded = 'True'),
A as(
select date_trunc('day',block_timestamp) as time,
sum(data:amount) as balance
from X
where lower(contract) = 'a.a45ead1cf1ca9eda.flowrewards'
and type = 'Locked'
group by 1),
B as(
select a.time, case when balance is null then 0 else balance end as balance
from (select date as time from P where date between (select min(time) from A) and (select max(time) from A)) as a
left join A as b on a.time = b.time )
select a.*,
sum(balance) over(order by time) as balance_flow,
sum(balance) over(order by time)*price as balance_usd,
'(Δ) FLOW change' as A,
'(Σ) FLOW all' as B,
'Total value locked' as tvl
from B as a
join P as b on a.time = b.date
order by 1 desc
QueryRunArchived: QueryRun has been archived