BlockTrackeradd gas_used to existing query
Updated 2023-08-25
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
›
⌄
SELECT
platform,
avg(gas_used) as "Avg.Gas_Used",
avg(tx_fee) as "Avg.tx_fee",
avg(amount_in/amount_out) as "Avg.Exch Rate",
median(amount_in/amount_out) as "Median.Exch Rate",
count(DISTINCT a.tx_hash) as "number_of_swaps",
count (DISTINCT a.origin_from_address) as "Number of Swappers"
FROM {{chain}}.core.ez_dex_swaps a
LEFT JOIN {{chain}}.core.fact_transactions b using(tx_hash)
WHERE token_in LIKE lower('{{token_in}}') AND token_out LIKE lower('{{token_out}}')
AND a.block_timestamp > dateadd('month', -1*{{last_n_months}}, current_date)
AND a.block_timestamp < current_date
AND amount_out >0
AND platform != 'curve' --excluded as it has a problem in WETH/USDC convertion rate
GROUP BY platform
HAVING "number_of_swaps" > 10
ORDER BY "Avg.Gas_Used"
Run a query to Download Data