elenahooUSDC-WETH Pool
Updated 2021-09-15
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 unique_fee_pool as(
select distinct fee_percent
, pool_address
, pool_name
, token0_symbol
, token1_symbol
from uniswapv3.pools
where pool_name like '%USDC-WETH%'
),
bal as(
select
balance_date,
address_name,
user_address,
sum(amount_usd) amount_usd
from ethereum.erc20_balances
where user_address in (select distinct pool_address from unique_fee_pool)
group by 1,2,3
),
tvl_pool as(
select bal.balance_date
, bal.address_name
, bal.amount_usd as tvl
, p.*
from bal
left join unique_fee_pool p on p.pool_address = bal.user_address
),
-- calculate fees
collected_fees as (
select date_trunc('day',block_timestamp) as date
, pool_address
, pool_name
, token0_symbol
, token1_symbol
, case when amount0_usd is null then 0 else amount0_usd end as amount0_usd
Run a query to Download Data