adriaparcerisasOsmosis swap fees
Updated 2022-06-28
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
›
⌄
WITH
froms as (
SELECT
from_currency,
tx_id
from osmosis.core.fact_swaps
) ,
tos as (
SELECT
to_currency,
tx_id
from osmosis.core.fact_swaps
),
froms_fees as (
SELECT
case when REGEXP_SUBSTR(fee,'i.*') is not null then REGEXP_SUBSTR(fee,'i.*')
else REGEXP_SUBSTR(fee,'u.*') end as fee_name,
REPLACE(fee, fee_name, '')::decimal/pow(10,6) as fee_paid,
tx_id
from osmosis.core.fact_transactions
where tx_id in (select tx_id from froms)
),
tos_fees as (
SELECT
case when REGEXP_SUBSTR(fee,'i.*') is not null then REGEXP_SUBSTR(fee,'i.*')
else REGEXP_SUBSTR(fee,'u.*') end as fee_name,
REPLACE(fee, fee_name, '')::decimal/pow(10,6) as fee_paid,
tx_id
from osmosis.core.fact_transactions
where tx_id in (select tx_id from tos)
),
final_froms as (
SELECT
project_name,
avg(fee_paid) as avg_tx_fee
from froms_fees x
Run a query to Download Data