theericstoneabitrum arb net flow
Updated 2024-10-05
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
›
⌄
-- forked from polygon matic net flow @ https://flipsidecrypto.xyz/edit/queries/85b8d278-f9d7-40c4-aeb0-eec18aa6f327
with amount_in as (
SELECT
to_address as address,
sum(amount) as total_in,
sum(amount_usd) as total_in_usd
from arbitrum.core.ez_token_transfers
where block_timestamp > '{{start_date}}'
and block_timestamp < '{{end_date}}'
and contract_address = lower('0x912CE59144191C1204E64559FE8253a0e49E6548')
group by 1
),
amount_out as (
SELECT
from_address as address,
sum(amount) as total_out,
sum(amount_usd) as total_out_usd
from arbitrum.core.ez_token_transfers
where block_timestamp > '{{start_date}}'
and block_timestamp < '{{end_date}}'
and contract_address = lower('0x912CE59144191C1204E64559FE8253a0e49E6548')
group by 1
),
final as (
select
coalesce(ain.address,aout.address) as address,
coalesce(aout.total_out,0) as total_out,
coalesce(aout.total_out_usd,0) as total_out_usd,
coalesce(ain.total_in,0) as total_in,
coalesce(ain.total_in_usd,0) as total_in_usd,
total_in - total_out as net_in,
total_in_usd - total_out_usd as net_in_usd
FROM
amount_in ain JOIN
amount_out aout ON ain.address = aout.address
QueryRunArchived: QueryRun has been archived