Abolfazl_771025Flashloan & repay
Updated 2023-03-03
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
›
⌄
with flashloan as (select
date_trunc('week',block_timestamp) as date,
'Flashloan' as action,
b.symbol,
count(DISTINCT tx_hash) as tx_count,
count(DISTINCT BORROWER) as user_count,
sum(AMOUNT_LOANED * price) as action_volume
from ethereum.maker.ez_flash_loans a join ethereum.core.fact_hourly_token_prices b on a.block_timestamp::date=b.hour::date and token_address = TOKEN_LOANED
where TX_STATUS = 'SUCCESS'
and block_timestamp >= '2022-01-01'
group by 1,2,3
), repay as (select
date_trunc('week',block_timestamp) as date,
'Repay' as action,
b.symbol,
count(DISTINCT tx_hash) as tx_count,
count(DISTINCT PAYER) as user_count,
sum(AMOUNT_PAID * price) as action_volume
from ethereum.maker.ez_repayments a join ethereum.core.fact_hourly_token_prices b on a.block_timestamp::date=b.hour::date and token_address = TOKEN_PAID
where TX_STATUS = 'SUCCESS'
and block_timestamp >= '2022-01-01'
group by 1,2,3)
select
*
from flashloan
union
select
*
from repay
Run a query to Download Data