binhachonUntitled Query
Updated 2022-05-19
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 aUST_transaction as (
select
sender,
sum(deposit_amount) as deposit_amount
from flipside_prod_db.anchor.deposits
where block_id < 7544910
group by 1
union all
select
sender,
-sum(amount) as deposit_amount
from flipside_prod_db.anchor.redeem
where block_id < 7544910
group by 1
),
aUST_stats as (
select
sender,
sum(deposit_amount) as deposit_amount
from aUST_transaction
group by 1
),
eligible_users as (
select
sender,
case when deposit_amount > 500000 then 500000 else deposit_amount end as corrected_deposit_amount
from aUST_stats
where deposit_amount > 0
)
select
sum(corrected_deposit_amount) as total_amount,
count(*) as number_of_users
from eligible_users
Run a query to Download Data