John_GaltCurrent AMPS Generated per Day
Updated 2022-05-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
›
⌄
with table1 as (select
date(block_timestamp) as date,
sum(event_attributes:amount) / pow(10, 6) as xprism_pledged
from terra.msg_events
where event_index = 3
and event_attributes:action = 'send'
and event_attributes:"1_contract_address" = 'terra1pa4amk66q8punljptzmmftf6ylq3ezyzx6kl9m'
group by 1
order by date
),
table2 as (select
date(block_timestamp) as date,
sum(event_attributes:unbond) / pow(10, 6) as xprism_unpledged
from terra.msg_events
where event_index = 3
and event_attributes:"0_contract_address" = 'terra1pa4amk66q8punljptzmmftf6ylq3ezyzx6kl9m'
and (event_attributes:action = 'transfer' or event_attributes:"0_action" = 'transfer')
group by 1
order by date
),
final as (select table1.date, table1.xprism_pledged, table2.xprism_unpledged,
table1.xprism_pledged - COALESCE(table2.xPrism_unpledged, 0) as daily_net_pledge,
sum(daily_net_pledge) over (order by table1.date) as total_net_pledge
from table1
left outer join table2 on table1.date = table2.date
order by date
)
select total_net_pledge * 0.5 as AMPS_Generated_per_Day
from final
where date = current_date
Run a query to Download Data