ZSaed1.0.4 deposit & withdraw total
Updated 2023-06-05
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
›
⌄
-- forked from 1.0.3 deposit & withdraw @ https://flipsidecrypto.xyz/edit/queries/8660a1d0-a90d-412e-ba79-28fcd5b89035
-- forked from 1.0.1 deposit & withdraw @ https://flipsidecrypto.xyz/edit/queries/799666c4-2d08-4219-b33d-a11d4f328e70
with eth_tabel_tx as (
select * ,
case
when CONTRACT_ADDRESS = '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2' then 'Aave: Pool V3'
when CONTRACT_ADDRESS = '0x7937d4799803fbbe595ed57278bc4ca21f3bffcb' then 'Aave: Lending Pool'
when CONTRACT_ADDRESS = '0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9' then 'Aave: Lending Pool V2'
when CONTRACT_ADDRESS = '0x398ec7346dcd622edc5ae82352f02be94c62d119' then 'Aave: Lending Pool V1'
end as version,
case
when CONTRACT_ADDRESS = '0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2' then DECODED_LOG:amount
when CONTRACT_ADDRESS = '0x7937d4799803fbbe595ed57278bc4ca21f3bffcb' then DECODED_LOG:amount
when CONTRACT_ADDRESS = '0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9' then DECODED_LOG:amount
when CONTRACT_ADDRESS = '0x398ec7346dcd622edc5ae82352f02be94c62d119' then DECODED_LOG:_amount
end as amount
from ethereum.core.ez_decoded_event_logs
where TX_STATUS = 'SUCCESS'
)
, depoist_eth_tabel as (
select
date_trunc('{{Time_Trunc}}', BLOCK_TIMESTAMP) as date,
version,
count(DISTINCT tx_hash ) as num_tx,
count(DISTINCT ORIGIN_FROM_ADDRESS) as num_users,
sum(amount)/1e18 as total_token ,
sum(total_token) over(partition by version order by date) as cum_depoist
from eth_tabel_tx
where
CONTRACT_ADDRESS in ('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2','0x7937d4799803fbbe595ed57278bc4ca21f3bffcb', '0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9','0x398ec7346dcd622edc5ae82352f02be94c62d119' )
and EVENT_NAME in ('Deposit', 'Supply')
and decoded_log:reserve = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'
group by date , version
)
Run a query to Download Data