Updated 2022-04-06
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
29
30
31
32
33
34
35
36
›
⌄
-- ust tx fees
with t1 as (
select
date_trunc('day', block_timestamp) as date,
count(tx_id) as num_nonswap_tx,
sum(fee[0]:amount[0]:amount)/POW(10,6) as nonswap_tx_gas_ust,
nonswap_tx_gas_ust/num_nonswap_tx as gas_per_nonswap_tx_ust
from terra.transactions
where block_timestamp >= current_date - 30
and fee[0]:amount[0]:denom = 'uusd'
and tx_status = 'SUCCEEDED'
group by date
),
-- ust native swap fees
t2 as (
select
date_trunc('day', block_timestamp) as date,
count(tx_id) as num_native_swaps,
sum(swap_fee_amount_usd) as native_swap_fees_usd,
native_swap_fees_usd/num_native_swaps as fees_per_native_swap_usd
from terra.swaps
where
date >= current_date - 30
and (ask_currency = 'LUNA' or offer_currency = 'LUNA')
and tx_status = 'SUCCEEDED'
group by date
),
t3 as (
select
date_trunc('day', block_timestamp) as date,
count(tx_id) as num_stablecoin_swaps,
sum(swap_fee_amount_usd) as stablecoin_swap_fees_usd,
stablecoin_swap_fees_usd/num_stablecoin_swaps as fees_per_stablecoin_swap_usd
Run a query to Download Data