adriaparcerisasSushi Activity on Ethereum
Updated 2022-06-29
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
›
⌄
-- Q96. How did the recent spike in market volatility affect the overall activity of sushi on Ethereum? Analyze both swaps and lendings?
WITH
swaps as (
SELECT
trunc(block_timestamp,'day') as date,
count(distinct sender) as swappers,
count(distinct tx_hash) as swaps,
sum(amount_in_usd) as volume_in,
sum(amount_out_usd) as volume_out
from ethereum.sushi.ez_swaps where block_timestamp>='2022-05-01'
group by 1
),
lendings as (
select
trunc(block_timestamp,'day') as date,
count(distinct depositor) as depositors,
count(case when action='Deposit' then 1 end) as lends,
count(case when action='Withdraw' then 1 end) as unlends,
sum(case when action='Deposit' then amount_usd end) as volume_in,
sum(case when action='Withdraw' then amount_usd end) as volume_out
from ethereum.sushi.ez_lending where block_timestamp>='2022-05-01'
group by 1
)
SELECT
x.date,
swappers,
swaps,
x.volume_in as volume_swapped_in,
x.volume_out*(-1) as volume_swapped_out,
x.volume_in-x.volume_out as net_swapped_volume,
depositors,
case when lends is null then 0
else lends end as lendss,
case when unlends is null then 0
else unlends*(-1) end as unlendss,
lendss+unlendss as net_lends,
Run a query to Download Data