adriaparcerisasCAP Finance: ETH Pool 2
Updated 2023-02-24
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
total_deposits as (
select
trunc(block_timestamp,'day') as date,
count(distinct origin_from_address) as daily_total_stakers,
sum(event_inputs:value/pow(10,18)) as daily_ETH_deposited
from arbitrum.core.fact_event_logs x
join arbitrum.core.dim_labels y on x.contract_address=y.address
where
event_name='Deposit' and contract_address='0xe0ccd451bb57851c1b2172c07d8b4a7c6952a54e'
and tx_status='SUCCESS'
group by 1
),
total_withdrawals as (
select
trunc(block_timestamp,'day') as date,
count(distinct origin_from_address) as daily_total_unstakers,
sum(event_inputs:inputAmount/pow(10,18)) as daily_ETH_withdrawn
from arbitrum.core.fact_event_logs x
join arbitrum.core.dim_labels y on x.contract_address=y.address
where
event_name='Withdraw' and contract_address=lower('0xe0ccd451bb57851c1b2172c07d8b4a7c6952a54e')
and tx_status='SUCCESS'
group by 1
),
final as (
SELECT
ifnull(x.date, y.date) as date,
ifnull(daily_total_stakers,0) as daily_total_stakerss,
ifnull(daily_total_unstakers,0) as daily_total_unstakerss,
daily_total_stakerss-daily_total_unstakerss as daily_net_stakers,
ifnull(daily_ETH_deposited,0) as daily_ETH_depositeds,
ifnull(daily_ETH_withdrawn,0) as daily_ETH_withdrawns,
daily_ETH_depositeds-daily_ETH_withdrawns as daily_net_ETH_deposited
from total_deposits x
left join total_withdrawals y on x.date=y.date
Run a query to Download Data