vendettaSwap Volume over Time (in BTC.b) copy
Updated 2023-02-17
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
›
⌄
-- forked from 375f2e59-f941-465b-8a08-fd05ce18ccc0
--darvishi
with swap_table as(
select
block_timestamp, tx_hash,
event_inputs:amount0In/power(10,8)::number as btcb_in, event_inputs:amount0Out/power(10,8) as btcb_out,
event_inputs:amount1In/power(10,18)::number as avax_in, event_inputs:amount1Out/power(10,18) as avax_out
from
avalanche.core.fact_event_logs
where contract_address='0x2fd81391e30805cc7f2ec827013ce86dc591b806' and event_name='Swap'
)
select
sum(btcb_in + btcb_out) as swap_amount, date(block_timestamp) as day,
case when btcb_in=0 then 'AVAX to BTC.b'
when
avax_in=0 then 'BTC.b to AVAX'
else 'NA' end as Swap_Direction
from
swap_table
group by day, Swap_Direction
Run a query to Download Data