strawbettyNet LUNA deposited and borrowed in Mars protocol during time
Updated 2022-07-07
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 deposit_luna as (
select
block_timestamp::date as date,
case
when msg_value:execute_msg:deposit_native:denom = 'uluna' then 'LUNA'
end as asset,
sum(msg_value:coins[0]:amount/1e6) as total_deposit_amount,
count(distinct msg_value:sender) as unique_depositors_count,
count(tx_id) as total_deposit_txs_count
from terra.msgs
where msg_value:contract = 'terra19dtgj9j5j7kyf3pmejqv8vzfpxtejaypgzkz5u'
and msg_value:execute_msg:deposit_native:denom = 'uluna'
and TX_STATUS = 'SUCCEEDED'
group by 1,2
), borrow_luna as (
select
block_timestamp::date as date,
case
when msg_value:execute_msg:borrow:asset:native:denom = 'uluna' then 'LUNA'
end as asset,
sum(msg_value:execute_msg:borrow:amount/1e6) as total_borrow_amount,
count(distinct msg_value:sender) as unique_borrowers_count,
count(tx_id) as total_borrow_txs_count
from terra.msgs
where msg_value:contract = 'terra19dtgj9j5j7kyf3pmejqv8vzfpxtejaypgzkz5u'
and msg_value:execute_msg:borrow:asset:native:denom = 'uluna'
and TX_STATUS = 'SUCCEEDED'
group by 1,2
)
SELECT
d.date,
d.asset,
total_deposit_amount,
total_borrow_amount,
total_deposit_amount-total_borrow_amount as net_LUNA,
Run a query to Download Data