0xtableauAAVE-Polygon Daily Deposit Withdrawal Breakdown over the Past Month
Updated 2021-11-01
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
›
⌄
--- How to query
-- This query tries to accomplish 2 things.
-- How much DAI Liquidity is being added / redemmed each day on polygon.
with deposits as (
SELECT
DISTINCT block_id,
block_timestamp,
tx_id,
event_index,
event_inputs:reserve::string as reserve_contract,
case
when lower(event_inputs:reserve::string) = lower('0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619') then '0x28424507fefb6f7f8E9D3860F56504E4e5f5f390'
when lower(event_inputs:reserve::string) = lower('0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270') then '0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4'
when lower(event_inputs:reserve::string) = lower('0x8f3cf7ad23cd3cadbd9735aff958023239c6a063') then '0x27F8D03b3a2196956ED754baDc28D73be8830A6e'
when lower(event_inputs:reserve::string) = lower('0xc2132d05d31c914a87c6611c10748aeb04b58e8f') then '0x60D55F02A771d515e077c9C2403a1ef324885CeC'
when lower(event_inputs:reserve::string) = lower('0x2791bca1f2de4661ed88a30c99a7a9449aa84174') then '0x1a13F4Ca1d028320A707D99520AbFefca3998b7F'
when lower(event_inputs:reserve::string) = lower('0xd6df932a45c0f255f85145f286ea0b292b21c90b') then '0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360'
when lower(event_inputs:reserve::string) = lower('0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6') then '0x5c2ed810328349100A66B82b78a1791B101C9D61'
end as atoken_address,
case
when lower(event_inputs:reserve::string) = lower('0x8f3cf7ad23cd3cadbd9735aff958023239c6a063') then 'DAI'
end as reserve_name,
event_inputs:amount::float/1e18 as deposit_amount_clean,
tx_from_address AS depositor_address
from polygon.events_emitted
where lower(contract_address) = lower('0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf')
and block_timestamp > current_date - 10
and event_name = 'Deposit'
and tx_succeeded = 'TRUE'
)
, token_prices as (
select
date_trunc('day',hour) as dly_d,
symbol,
avg(price) as token_price,
Run a query to Download Data