SniperTotal Weekly Withdraw/Borrow on Aave Protocol(Last 1 Month)
Updated 2022-09-18
999
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 withdraw_aave as(select date_trunc('day',block_timestamp) as day,
-- 'Withdraw' as type,
-- count(DISTINCT tx_hash) as total_tx,
-- count(DISTINCT from_address) as unique_users ,
sum(amount_usd) as total_volume
from ethereum.core.ez_token_transfers
where origin_from_address = from_address and tx_hash in (select tx_hash from ethereum.core.fact_event_logs
where ORIGIN_TO_ADDRESS = '0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9'
and event_name = 'Withdraw' and
event_inputs:token::string = lower('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2')
UNION
select tx_hash from ethereum.core.fact_event_logs
where contract_address = '0x398ec7346dcd622edc5ae82352f02be94c62d119' and
event_name = 'RedeemUnderlying' and
event_inputs:_reserve::string = lower('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2')
)
and block_timestamp::date >= CURRENT_DATE - 30
group by 1
),
borrow_aave as (
select
date_trunc('day',block_timestamp) as day,
-- 'Borrow' as type,
-- count(DISTINCT tx_hash) as total_tx,
-- count(DISTINCT from_address) as unique_users ,
sum(amount_usd) as total_volume
from ethereum.core.ez_token_transfers
where origin_from_address = to_address and tx_hash in (select tx_hash from ethereum.core.fact_event_logs
where contract_address = '0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9' and
event_name = 'Borrow'
and event_inputs:reserve::string = lower('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2')
)
and block_timestamp::date >= CURRENT_DATE - 30
group by 1
),
Run a query to Download Data