binhachonWhat Happens To Liquidated Collateral? - Swap
Updated 2022-04-12
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 bid_claimers as (
select
block_timestamp,
tx_id,
msg_value:sender::string as sender
from terra.msgs
where block_timestamp > getdate() - interval'180 days' --tx_id = '79A370D7C9A568815024B2731632C379B1CDBDEC4560A3A34DBCE9E8DC3B887F'
and msg_value:contract::string = 'terra1e25zllgag7j9xsun3me4stnye2pcg66234je3u'
and msg_value:execute_msg:claim_liquidations:collateral_token::string = 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp'
),
transactions as (
select
block_timestamp,
tx_from[0]::string as tx_from,
tx_to[0]::string as tx_to
from terra.transactions
where block_timestamp > getdate() - interval'180 days'
),
bid_transactions as (
select
distinct transactions.tx_to,
bid_claimers.tx_id
from transactions
inner join bid_claimers on (transactions.block_timestamp > bid_claimers.block_timestamp and transactions.block_timestamp < bid_claimers.block_timestamp + interval'2 hours' and tx_from = sender)
),
swap_transaction as (
select
tx_id,
tx_to
from bid_transactions
where tx_to in ('terra1tndcaqxkpc5ce9qee5ggqf430mr2z3pefe5wj6', 'terra1m6ywlgn6wrjuagcmmezzz2a029gtldhey5k552', 'terra1j66jatn3k50hjtg2xemnjm8s7y8dws9xqa5y8w')
)
select
'Swap transactions' as symbol,
count(distinct tx_id) as frequency
from swap_transaction
Run a query to Download Data