CryptoIcicleArbitrum Free Square Question - Swap Metrics Top 10 Tokens
Updated 2023-02-09
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
›
⌄
-- Payout 125 USDC
-- Grand Prize 2000 USDC
-- Level Advanced
-- Show us what you can do with this new Arbitrum data!
-- SQL Credit: https://app.flipsidecrypto.com/velocity/queries/863e3649-6497-4616-b12e-c6c5094365e0
SELECT
ADDRESS_NAME,
sum(event_inputs:value) as raw_token_amount,
CASE contract_address
WHEN '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' THEN 1e6
WHEN '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9' THEN 1e6
WHEN '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f' THEN 1e8
ELSE 1e18
END as decimals,
raw_token_amount/decimals as token_amount,
count(DISTINCT tx_hash) as swaps,
count(DISTINCT ORIGIN_FROM_ADDRESS) as swappers
FROM arbitrum.core.fact_event_logs
LEFT outer JOIN flipside_prod_db.crosschain.address_labels
ON contract_address = address
WHERE tx_hash IN (
SELECT DISTINCT tx_hash
FROM arbitrum.core.fact_event_logs
WHERE event_name LIKE 'Swap'
)
AND event_name LIKE 'Transfer'
AND not address_name is NULL
AND event_inputs:value is not NULL
GROUP by address_name, contract_address
ORDER BY swaps DESC
LIMIT 10
Run a query to Download Data