KaskoazulAnchor Collateral Event type
Updated 2022-02-08
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
›
⌄
--140. Anchor Collateralization
--How much of the collateral provided on Anchor is bLUNA vs. bETH? How has this changed over the past 90 days?
WITH
COLLATERAL_PROVIDE as (
select 'provide' as event_type, 'bETH mmCustody' as contract_label, sum(amount_usd) as USD, count(tx_id) as Transactions, USD/Transactions as USD_per_transaction
from anchor.collateral
where event_type = 'provide' AND contract_label = 'bETH mmCustody'
union select 'provide' as event_type, 'bLuna Custody' as contract_label, sum(amount_usd) as USD, count(tx_id) as Transactions, USD/Transactions as USD_per_transaction
from anchor.collateral
where event_type = 'provide' AND contract_label = 'bLuna Custody'
),
COLLATERAL_WITHDRAW as(
select 'withdraw' as event_type, 'bETH mmCustody' as contract_label, sum(amount_usd) as USD, count(tx_id) as Transactions, USD/Transactions as USD_per_transaction
from anchor.collateral
where event_type = 'withdraw' AND contract_label = 'bETH mmCustody'
union select 'withdraw' as event_type, 'bLuna Custody' as contract_label, sum(amount_usd) as USD, count(tx_id) as Transactions, USD/Transactions as USD_per_transaction
from anchor.collateral
where event_type = 'withdraw' AND contract_label = 'bLuna Custody'
),
TOTAL as (
select event_type, contract_label, USD, Transactions, USD_per_transaction from COLLATERAL_PROVIDE
union
select event_type, contract_label, USD, Transactions, USD_per_transaction from COLLATERAL_WITHDRAW
)
select * from TOTAL ORDER BY 1, 2 desc
Run a query to Download Data