adriaparcerisasSushi and Uni stablecoins analysis 2
Updated 2022-06-08
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
global_data as (
SELECT
case when symbol_in in ('AMUSDC','BUSD','DAI','PUSD','TUSD','USDC','USDT','UST','alUSD','cDAI','sUSD','sUSD') then symbol_in
else symbol_out end as symbol_in,
count(distinct tx_hash) as swaps,
--sum(amount_in_usd) as amount_in_usd,
--sum(amount_out_usd) as amount_out_usd,
--amount_in_usd-amount_out_usd as netflow,
count(distinct pool_name) as n_pools,
datediff('months',min(block_timestamp),max(block_timestamp)) as coin_age_months,
count(distinct sender) as n_users
from ethereum.core.ez_dex_swaps
where platform like '%uniswap%' and (symbol_in in ('AMUSDC','BUSD','DAI','PUSD','TUSD','USDC','USDT','UST','alUSD','cDAI','sUSD','sUSD') or symbol_out in ('AMUSDC','BUSD','DAI','PUSD','TUSD','USDC','USDT','UST','alUSD','cDAI','sUSD','sUSD'))
group by 1
),
inflow as (
SELECT
symbol_in,
count(distinct tx_hash) as swaps_in,
sum(amount_in_usd) as volume_inflow,
count(distinct sender) as users_inflow
from ethereum.core.ez_dex_swaps
where platform like '%uniswap%' and symbol_in in ('AMUSDC','BUSD','DAI','PUSD','TUSD','USDC','USDT','UST','alUSD','cDAI','sUSD','sUSD')
and amount_in_usd<100000000 and amount_in_usd is not null
group by 1
),
outflow as (
SELECT
symbol_out,
count(distinct tx_hash) as swaps_out,
sum(amount_out_usd) as volume_outflow,
count(distinct sender) as users_outflow
from ethereum.core.ez_dex_swaps
where platform like '%uniswap%' and symbol_out in ('AMUSDC','BUSD','DAI','PUSD','TUSD','USDC','USDT','UST','alUSD','cDAI','sUSD','sUSD')
and amount_out_usd<100000000 and amount_out_usd is not null