KuramaUntitled Query
Updated 2022-03-20Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
WITH anchor_bluna_deposits AS (SELECT sum(amount) AS amount_dep FROM anchor.collateral
WHERE currency = 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp' and event_type = 'provide'),
anchor_bluna_withdraw AS (SELECT sum(amount) AS amount_with FROM anchor.collateral
WHERE currency = 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp' AND event_type = 'withdraw'),
anchor_bluna_liquidations AS (SELECT sum(liquidated_amount) AS amount_liquidated FROM anchor.liquidations
WHERE liquidated_currency = 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp')
SELECT (a.amount_dep -b.amount_with - c.amount_liquidated), --as 'Total bLuna bonded as collateral',
(a.amount_dep + c.amount_liquidated + b.amount_with) --as 'Total bLuna supply'
FROM anchor_bluna_deposits a
JOIN anchor_bluna_withdraw b
JOIN anchor_bluna_liquidations c
;
select sum(bonded_amount) from anchor.bonds where bonded_currency = 'uluna'
Run a query to Download Data