kidaMultichain TVL (BSC)
Updated 2023-01-05
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
›
⌄
with
vaults as (
select distinct
tx_json:to as vault_address
from bsc.core.fact_transactions
where
from_address = lower('0xfa9da51631268a30ec3ddd1ccbf46c65fad99251')
and left(tx_json:input, 10) = '0x2ebe3fbb' -- init vault
),
weth_prices as (
select
date(block_timestamp) as date,
replace(feed_name, ' / USD') as symbol,
median(coalesce(latest_answer_adj, latest_answer_unadj / pow(10,8))) as price --using median cause there will be some nulls / zeroes
from ethereum.chainlink.ez_oracle_feeds
where feed_category = 'Cryptocurrency (USD pairs)'
and feed_name in ('ETH / USD')
group by 1,2
order by 1
),
decimals as (
select
token_in as contract_address,
median(case when event_inputs:amount1In::decimal < event_inputs:amount0In::decimal then event_inputs:amount0In else event_inputs:amount1In end / amount_in) as decimals
from bsc.sushi.ez_swaps s
join bsc.core.fact_event_logs t
on t.event_index = s.event_index and s.tx_hash = t.tx_hash
group by 1
),
prices as (
select
date(block_timestamp) as date,
token_in as token_address,
Run a query to Download Data