saeedmznFlash Bounty: GMX Traders - Top wallets swap to volume
Updated 2022-09-19Copy Reference Fork
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 gmx_tokens as (SELECT
CASE
WHEN event_inputs:inputToken = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' THEN 'WETH'
WHEN event_inputs:inputToken = '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' THEN 'USDC'
WHEN event_inputs:inputToken = '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1' THEN 'DAI'
WHEN event_inputs:inputToken = '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f' THEN 'WBTC'
WHEN event_inputs:inputToken = '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9' THEN 'USDT'
WHEN event_inputs:inputToken = '0xf97f4df75117a78c1a5a0dbb814af92458539fb4' THEN 'LINK'
WHEN event_inputs:inputToken = '0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0' THEN 'UNI'
WHEN event_inputs:inputToken = '0x17fc002b466eec40dae837fc4be5c67993ddbd6f' THEN 'FRAX'
WHEN event_inputs:inputToken = '0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a' THEN 'MIM'
END AS token
FROM arbitrum.core.fact_event_logs
WHERE contract_address = '0xabbc5f99639c9b6bcb58544ddf04efa6802f4064'
and event_name = 'Swap'
GROUP by 1),
prices as (SELECT
hour::date as price_date,
symbol,
decimals,
avg(price) as price_usd
from ethereum.core.fact_hourly_token_prices
where symbol in (select token from gmx_tokens)
group by 1,2,3),
top_20 as (SELECT
origin_from_address,
count(distinct tx_hash) as swaps
FROM arbitrum.core.fact_event_logs
WHERE contract_address = '0xabbc5f99639c9b6bcb58544ddf04efa6802f4064'
and event_name = 'Swap'
and tx_status= 'SUCCESS'
group by 1
order by 2 desc
limit 20),
Run a query to Download Data