adriaparcerisasCAP Finance: USDC 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_USDC_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=lower('0x958cc92297e6F087f41A86125BA8E121F0FbEcF2')
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_USDC_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('0x958cc92297e6F087f41A86125BA8E121F0FbEcF2')
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_USDC_deposited,0) as daily_USDC_depositeds,
ifnull(daily_USDC_withdrawn,0) as daily_USDC_withdrawns,
daily_USDC_depositeds-daily_USDC_withdrawns as daily_net_USDC_deposited
from total_deposits x
left join total_withdrawals y on x.date=y.date
Run a query to Download Data