messariGrowth in terra ecosystem - UST and anchor
Updated 2022-04-29
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
›
⌄
-- Tarik - Revised from query by darvinrio
with ust_bals as(
select * from terra.daily_balances
where currency = 'UST'
),
daily_bals as(
select date, sum(balance) as total_ust
from ust_bals
group by date
),
borrows as (
select
block_id as block,
block_timestamp as time,
tx_id,
msg_value:sender::string as sender,
msg_value:execute_msg:borrow_stable:borrow_amount / POW(10,6) as amount,
'borrow' as event,
-msg_value:execute_msg:borrow_stable:borrow_amount / POW(10,6) as vector
from terra.msgs
where
msg_value:contract = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s'
and msg_value:execute_msg:borrow_stable is not null
and tx_status='SUCCEEDED'
),
deposits as(
select
block_id as block,
block_timestamp as time,
tx_id,
msg_value:sender::string as sender,
msg_value:coins[0]:amount / POW(10,6) as amount,
'deposit' as event,
msg_value:coins[0]:amount / POW(10,6) as vector
from terra.msgs
Run a query to Download Data