kaibladeDaily AAVE Withdrawals V1
Updated 2023-04-13
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 raw_data AS (SELECT *
FROM ethereum.core.fact_event_logs
WHERE event_inputs:_reserve = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'
AND contract_address ='0x398ec7346dcd622edc5ae82352f02be94c62d119'
AND event_name ='RedeemUnderlying'
AND block_timestamp BETWEEN '2020-11-17 14:30:03.000' AND '2022-06-15 20:17:02.000'
ORDER BY block_timestamp DESC)
,
raw_data2 AS
(SELECT *
FROM flipside_prod_db.aave.withdraws
WHERE symbol ILIKE '%aave%'
AND aave_version = 'Aave V1'
)
,
missing_withdrawals AS
(SELECT *
FROM raw_data2
WHERE tx_id NOT IN (SELECT tx_hash FROM raw_data)
)
,
combined_withdrawals AS
(
SELECT block_timestamp, event_inputs:_amount/POWER(10,18) AS amount_withdrawn
FROM ethereum.core.fact_event_logs
WHERE event_inputs:_reserve = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'
AND contract_address ='0x398ec7346dcd622edc5ae82352f02be94c62d119'
AND event_name ='RedeemUnderlying'
UNION
SELECT block_timestamp, withdrawn_tokens AS amount_withdrawn
FROM missing_withdrawals
)
Run a query to Download Data