shreyash-5873Mirror aUST Collateral Withdraws v4
Updated 2022-02-09
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
›
⌄
--Withdraw from Borrow
(select
m.block_id,
m.event_attributes:"to"::string as sender,
m.tx_id,
m.event_attributes:withdraw_amount[0]:amount as uaust_collateralised,
m.event_attributes:withdraw_amount[0]:amount / pow(10, 6) as aust_collateralised,
m.event_attributes:"0_position_idx"::string as position_idx,
'Withdraw from Borrow' as position_type
from terra.msg_events m
where m.event_type = 'from_contract'
and m.event_attributes:withdraw_amount[0]:denom::string = 'terra1hzh9vpxhsk8253se0vv5jj6etdvxu3nv8z07zu'
and m.event_attributes:"0_contract_address"::string = 'terra1wfz7h3aqf4cjmjcvc6s8lxdhh7k30nkczyf0mj'
and m.event_attributes:"0_position_idx"::string is NOT NULL
Union
select
m.block_id,
m.event_attributes:"to"::string as sender,
m.tx_id,
m.event_attributes:withdraw_amount[0]:amount as uaust_collateralised,
m.event_attributes:withdraw_amount[0]:amount / pow(10, 6) as aust_collateralised,
m.event_attributes:"position_idx"::string as position_idx,
'Withdraw from Borrow' as position_type
from terra.msg_events m
where m.event_type = 'from_contract'
and m.event_attributes:withdraw_amount[0]:denom::string = 'terra1hzh9vpxhsk8253se0vv5jj6etdvxu3nv8z07zu'
and m.event_attributes:"0_contract_address"::string = 'terra1wfz7h3aqf4cjmjcvc6s8lxdhh7k30nkczyf0mj'
and m.event_attributes:"position_idx"::string is NOT NULL)
UNION
-- Withdraw Protocol Fee
select
m.block_id,
m.event_attributes:"0_from"::string as sender,
m.tx_id,
m.event_attributes:protocol_fee[0]:amount as uaust_collateralised,
m.event_attributes:protocol_fee[0]:amount / pow(10, 6) as aust_collateralised,
Run a query to Download Data