adriaparcerisassquid directions arbitrum
Updated 2023-04-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 usdc_transactions as (
SELECT
x.tx_hash,
date_trunc('day', x.block_timestamp) as day,
from_address
FROM arbitrum.core.fact_event_logs x
join arbitrum.core.fact_transactions y on x.tx_hash=y.tx_hash
WHERE event_name LIKE 'ContractCallWithToken'
), daily_volume as (
SELECT
tx_hash as tx_id,
project_name AS dex_name
FROM arbitrum.core.fact_event_logs
LEFT outer JOIN crosschain.core.address_labels
on address = contract_address
WHERE event_name LIKE 'Swap'
and blockchain = 'arbitrum'
AND tx_hash in (SELECT tx_hash from usdc_transactions)
), dex_volume as (
SELECT
usdc_transactions.tx_hash as pn_hash,
count(DISTINCT dex_name) num_swap
FROM usdc_transactions
LEFT outer JOIN daily_volume
on usdc_transactions.tx_hash = tx_id
GROUP BY 1
having num_swap > 1
)
SELECT
day as date,
CASE when dex_name is NULL then 'Others' else dex_name end as dex,
count(DISTINCT tx_hash) as bridges,
count(DISTINCT from_address) as bridgors
FROM usdc_transactions
Run a query to Download Data