DaniLabsTAM
Updated 2024-09-12
999
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 tvl AS (
-- Fetch TVL for both chains
SELECT
LOWER(chain) AS chain,
chain_tvl
FROM external.defillama.fact_protocol_tvl
WHERE protocol LIKE 'Uniswap V2'
AND chain IN ('Ethereum', 'Arbitrum')
AND date = current_date
),
volume AS (
-- Calculate total trading volume for WBTC-WETH pool on Ethereum and Arbitrum
SELECT
'ethereum' AS chain,
SUM(amount_in_usd + amount_out_usd)/2 AS total_trading_volume
FROM ethereum.defi.ez_dex_swaps
WHERE platform = 'uniswap-v2'
AND pool_name = 'WBTC-WETH'
UNION ALL
SELECT
'arbitrum' AS chain,
SUM(amount_in_usd + amount_out_usd)/2 AS total_trading_volume
FROM arbitrum.defi.ez_dex_swaps
WHERE platform = 'uniswap-v2'
AND pool_name = 'WBTC-WETH'
),
users AS (
-- Calculate distinct users interacting with the WBTC-WETH pool on Ethereum and Arbitrum
SELECT
'ethereum' AS chain,
COUNT(DISTINCT sender) AS users
FROM ethereum.defi.ez_dex_swaps
QueryRunArchived: QueryRun has been archived