boomer77$ETH Withdrew From Major Protocols
Updated 2022-09-14
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 uniswap as (select block_timestamp, tx_hash, action, liquidity_provider, amount0_adjusted as eth, amount0_usd as eth_usd
from ethereum.uniswapv3.ez_lp_actions
where action = 'DECREASE_LIQUIDITY' and token0_symbol = 'WETH' and amount0_adjusted > 0 and date(block_timestamp) >= '2022-07-01'
union all
select block_timestamp, tx_hash, action, liquidity_provider, amount1_adjusted as eth, amount1_usd as eth_usd
from ethereum.uniswapv3.ez_lp_actions
where action = 'DECREASE_LIQUIDITY' and token1_symbol = 'WETH' and amount1_adjusted > 0 and date(block_timestamp) >= '2022-07-01'),
compound as (select block_timestamp, tx_hash, event_inputs:redeemAmount::int/1e18 as vol, event_inputs:redeemer::string as withdrawer
from ethereum.core.fact_event_logs
where contract_address = '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5' and event_name = 'Redeem' and date(block_timestamp) >= '2022-07-01' and tx_status = 'SUCCESS'
order by block_timestamp desc),
aave as (select date_trunc('day', block_timestamp) as dt, sum(withdrawn_tokens) as ETH_withdrew, sum(withdrawn_usd) as ETH_withdrew_usd, avg(token_price) as ETH_price,
count(distinct depositor_address) as withdrawer_count, count(distinct tx_hash) as tx_count
from ethereum.aave.ez_withdraws
where symbol = 'WETH' and date(block_timestamp) >= '2022-07-01'
group by 1),
uni as (select date_trunc('day', block_timestamp) as dt, sum(eth) as eth_withdrew, sum(eth_usd) as eth_withdrew_usd, count(distinct liquidity_provider) as withdrawer_count,
count(distinct tx_hash) as tx_count
from uniswap
group by 1),
comp as (select date_trunc('day', block_timestamp) as dt, sum(vol) as eth_withdrew, count(distinct withdrawer) as withdrawer_count,
count(distinct tx_hash) as tx_count
from compound
group by 1)
select a.dt, a.eth_withdrew as AAVE, b.eth_withdrew as UNISWAPV3, c.eth_withdrew as COMPOUND,
a.withdrawer_count as AAVE_address_count, b.withdrawer_count as UNISWAP_address_count, c.withdrawer_count as COMPOUND_address_count,
a.tx_count as AAVE_tx, b.tx_count as UNISWAP_tx, c.tx_count as COMPOUND_tx,
a.ETH_price, (a.eth_withdrew*a.ETH_price) as AAVE_USD, (b.eth_withdrew*a.ETH_price) as UNISWAPV3_USD, (c.eth_withdrew*a.ETH_price) as COMPOUND_USD
from aave a
left join uni b on a.dt = b.dt
left join comp c on a.dt =c.dt