rajsXen Trading
Updated 2022-10-27
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 pools as
(
SELECT
event_inputs:pool as pool,
event_inputs:token0 as token0,
event_inputs:token1 as token1
from ethereum.core.fact_event_logs
where event_name = 'PoolCreated'
and (event_inputs:token0 = '0x06450dee7fd2fb8e39061434babcfc05599a6fb8'
or event_inputs:token1 = '0x06450dee7fd2fb8e39061434babcfc05599a6fb8')
)
SELECT
-- *
date_trunc('hour', block_timestamp) as date,
contract_address,
case when contract_address = '0x353bb62ed786cdf7624bd4049859182f3c1e9e5d' then 'XEN-USDC'
when contract_address = '0x2a9d2ba41aba912316d16742f259412b681898db' then 'XEN-WETH 2'
when contract_address = '0x5f15e75fa52c7ec605cf65ff315e47179730927e' then 'XEN-HEX'
when contract_address = '0x7995430a85156b2d40d5bb701608788cf84019e3' then 'XEN-WETH'
when contract_address = '0xae12d36479b811a79bb7f0c7646d82946ec810d0' then 'XEN-MORE'
when contract_address = '0x24bd2352cb6f1df8993b5d78033486777403fc08' then 'XEN-WBTC'
end as pool_name,
sum(coalesce(amount_in_usd, amount_out_usd)) as volume,
sum(sum(coalesce(amount_in_usd, amount_out_usd))) over () as total_volume,
count(distinct origin_from_address) as no_of_swappers,
sum(count(distinct origin_from_address)) over () as total_no_of_swappers,
count(distinct tx_hash) as no_of_swaps,
sum(count(distinct tx_hash)) over () as total_no_of_swaps
from ethereum.core.ez_dex_swaps
where contract_address IN
(
SELECT
pool
from pools
)
Run a query to Download Data