2844Folks Finance Liquidation-2
Updated 2022-07-14
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
›
⌄
with Liquidation as (
select
case
when APP_ID = 686498781 then 'ALGO'
when APP_ID = 686500029 then 'USDC'
when APP_ID = 686500844 then 'USDT'
when APP_ID = 686501760 then 'goBTC'
when APP_ID = 694405065 then 'goETH'
when APP_ID = 694464549 then 'gALGO3'
when APP_ID = 743679535 then 'gALGO3/ALGO TMP1.1'
when APP_ID = 743685742 then 'gALGO3/ALGO PLP'
end as asset_name,
tx_group_id
from flipside_prod_db.algorand.application_call_transaction
where APP_ID in (686498781,686500029,686500844,686501760,694405065,694464549,743679535,743685742)
and TRY_BASE64_DECODE_STRING(tx_message :txn :apaa [0] :: STRING) = 'l'
group by 1,2 having asset_name is not NULL
),
liquidators_profit as (
SELECT ASSET_NAME,sum (amount), avg (amount)
from flipside_prod_db.algorand.transfers t join Liquidation d
on d.tx_group_id = t.tx_group_id
where RECEIVER= 'EKHIMQJGZABULP552FKGYHDNMTQGIM3QWB6CKHTW6M2TQFKV427UARQBBM'
group by 1
)
select 'liquidators_profit' || asset_name as type ,* from liquidators_profit
Run a query to Download Data