cloudr3nAVAX TraderJOE Swap Volume BTC.b
Updated 2023-04-26Copy Reference Fork
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
›
⌄
⌄
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
/*
token0: btc.b
token1: wavax
select sum(btcb_in + wbtc_in) as swap_amount, date(block_timestamp) as day,
case when btcb_in=0 then 'Avax_in'
when wbtc_in=0 then 'BTC.b_in'
else 'NA' end as Swap_Direction
from swap_table
group by day, Swap_Direction
*/
Run a query to Download Data