Skip to content
Dune Analytics

@johaya / New Query

SQL query results

Loading
 

SQL query

1SELECT project,
2       block_time,
3       borrower,
4       liquidator,
5       t1.symbol AS repay_token,
6       t2.symbol AS collateral_token,
7       repay_amount / 10^t1.decimals AS repay_amount,
8       repay_amount/10^t1.decimals*p1.price AS repay_amount_usd,
9       collateral_seized_amount/10^t2.decimals AS collateral_seized_amount,
10       collateral_seized_amount/10^t2.decimals*p2.price AS collateral_seized_amount_usd,
11       tx_hash
12FROM
13  (-- Aave
14 SELECT evt_tx_hash AS tx_hash,
15        'Aave' project,
16               "_user" AS borrower,
17               "_liquidator" AS liquidator,
18               evt_block_time AS block_time,
19               "_reserve" AS repay_token,
20               "_purchaseAmount" AS repay_amount,
21               "_collateral" AS collateral_token,
22               "_liquidatedCollateralAmount" AS collateral_seized_amount,
23   FROM aave."LendingPool_evt_LiquidationCall" liquidations 
24   UNION --Compound
25SELECT evt_tx_hash AS tx_hash,...