connorhToken Balances Test
Updated 2020-12-28
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
›
⌄
WITH total AS (
SELECT balance_date, SUM(balance) AS supply
FROM public.daily_ethereum_token_balances
WHERE contract_address = '0xbb2b8038a1640196fbe3e38816f3e67cba72d940' -- WBTC-ETH pool address and token
AND balance_date = '2020-12-22'
AND balance >=0
AND address <> '0x0000000000000000000000000000000000000000' -- don't want to include minting/burning as a "balance holder"
GROUP BY 1
), lp AS (
SELECT balance_date, deb.address, l.project_name, l.address_name, balance
FROM public.daily_ethereum_token_balances deb
LEFT OUTER JOIN public.ethereum_address_labels_updates l
ON deb.address = l.address
WHERE contract_address = '0xbb2b8038a1640196fbe3e38816f3e67cba72d940'
AND balance_date = '2020-12-22'
AND balance >= 0
AND deb.address <> '0x0000000000000000000000000000000000000000'
)
SELECT lp.balance_date, lp.address,
lp.project_name, lp.address_name,
lp.balance, total.supply,
CASE WHEN supply > 0 THEN lp.balance/total.supply ELSE 0 END AS percent_control
FROM total LEFT JOIN lp ON total.balance_date = lp.balance_date
ORDER BY 1 DESC,5 DESC;
Run a query to Download Data