kidaCeler Daily TVL (Optimism)
Updated 2023-01-05Copy Reference Fork
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
›
⌄
with
addresses as (
select '0x9d39fc627a6d9d9f8c831c16995b209548cc3401' as address
),
optimism_net_ins as (
select
block_timestamp::date as date,
contract_address, -- wrapper
sum(case when event_name = 'Deposit' then event_inputs:value
else -event_inputs:wad end) as net_in
from optimism.core.fact_event_logs
where contract_address = '0x4200000000000000000000000000000000000006'
and event_name in ('Deposit', 'Withdrawal')
and contains(topics[1], '9d39fc627a6d9d9f8c831c16995b209548cc3401')
group by 1,2
),
net_ins as (
select
date(block_timestamp) as date,
b.contract_address,
sum(
(
case
when exists (select 1 from addresses where address = from_address) then -raw_amount
else raw_amount end
)
) as net_in
from optimism.core.fact_token_transfers b
where exists (select 1 from addresses where address = from_address)
or exists (select 1 from addresses where address = to_address)
group by 1,2
),
agg_net_ins as (
Run a query to Download Data