LTirrell2022-01-28_luna_anchor-collateral
Updated 2022-02-01
999
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
›
⌄
--How much of the collateral provided on Anchor is bLUNA vs. bETH? How has this changed over the past 90 days?
with luna_price as (
select
date_trunc('day', block_timestamp) as timestamp,
avg(price_usd) as avg_price
from
terra.oracle_prices
where
symbol = 'LUNA'
group by
timestamp
),
eth_price as (
select
date_trunc('day', hour) as timestamp,
avg(price) as avg_price
from
ethereum.token_prices_hourly
where
symbol = 'ETH'
group by
timestamp
),
provide as (
select
date_trunc('day', block_timestamp) as datetime,
sum(
msg_value :execute_msg :lock_collateral :collaterals [0] [1] / pow(10, 6)
) as token_amount,
case
when msg_value :execute_msg :lock_collateral :collaterals [0] [0] = 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp' then 'bLUNA'
when msg_value :execute_msg :lock_collateral :collaterals [0] [0] = 'terra1dzhzukyezv0etz22ud940z7adyv7xgcjkahuun' then 'bETH'
end as denom
from
terra.msgs
where
Run a query to Download Data