theericstoneborrowed ust destinations
Updated 2022-04-27
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 rbs as (
select
block_timestamp,
action_log:borrower::string as address,
'borrow' as action_type,
'anchor' as project_label,
action_log:borrow_amount/pow(10,6) as amount
from silver_terra.event_actions
where block_timestamp > current_date - {{daysago}}
and action_method = 'borrow_stable'
and action_contract_address = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s'
),
borrowers as (
select distinct address from rbs
),
actions as (
select
block_timestamp,
sender as address,
current_action as action_type,
coalesce(recipient_label,'unlabeled transfer') as project_label,
-1 * amount as amount
from terra.transfer_events
where block_timestamp > current_date - {{daysago}}
and currency = 'UST'
and sender IN (select address from borrowers)
and initial_action <> 'borrow_stable'
and current_action <> 'borrow_stable'
),
allactions as (
select * from rbs
union
select * from actions
),
cbs as (
select * from (
Run a query to Download Data