bachisushi treasury
Updated 2022-06-30Copy Reference Fork
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
›
⌄
with inflows as (
select date(block_timestamp) as day,
case when to_address = '0xe94b5eec1fa96ceecbd33ef5baa8d00e4493f4f3' then 'Sushi Treasury'
when to_address = '0x19b3eb3af5d93b77a5619b047de0eed7115a19e7' then 'Operations multisig'
when to_address = lower('0x7b18913D945242A9c313573E6c99064cd940c6aF') then 'Sushi house'
end as address_type,
symbol, count(distinct from_address) as users, round(sum(amount_usd),2) as amount_usd, round(sum(amount),2) as amount
from ethereum.core.ez_token_transfers where
block_timestamp >= dateadd(month, -12, getdate())
and amount_usd > 0 and amount_usd is not null
and amount > 0 and amount is not null
and to_address in ('0xe94b5eec1fa96ceecbd33ef5baa8d00e4493f4f3','0x19b3eb3af5d93b77a5619b047de0eed7115a19e7',lower('0x7b18913D945242A9c313573E6c99064cd940c6aF'))
--and to_address = '0xe94b5eec1fa96ceecbd33ef5baa8d00e4493f4f3'
group by day, address_type,
symbol order by day desc
),
outflows as (
select date(block_timestamp) as day,
case when from_address = '0xe94b5eec1fa96ceecbd33ef5baa8d00e4493f4f3' then 'Sushi Treasury'
when from_address = '0x19b3eb3af5d93b77a5619b047de0eed7115a19e7' then 'Operations multisig'
when from_address = lower('0x7b18913D945242A9c313573E6c99064cd940c6aF') then 'Sushi house'
end as address_type,
symbol, count(distinct to_address) as users, round(sum(amount_usd),2) as amount_usd, round(sum(amount),2) as amount
from ethereum.core.ez_token_transfers where block_timestamp >= dateadd(month, -12, getdate())
and amount_usd > 0 and amount_usd is not null
and amount > 0 and amount is not null
and from_address in ('0xe94b5eec1fa96ceecbd33ef5baa8d00e4493f4f3','0x19b3eb3af5d93b77a5619b047de0eed7115a19e7',lower('0x7b18913D945242A9c313573E6c99064cd940c6aF'))
--and from_address = '0xe94b5eec1fa96ceecbd33ef5baa8d00e4493f4f3'
group by day, address_type,
symbol order by day desc
)
select *, 'Inflow' as tran_type from inflows
union select *, 'Outflow' as tran_type from outflows
Run a query to Download Data