zanglangMy IBC Fees (Evmos)
Updated 2023-09-24
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
›
⌄
-- forked from My IBC Fees (ATOM) @ https://flipsidecrypto.xyz/edit/queries/b5c3c44b-da40-4120-a8dc-986cab2aa9db
-- forked from My IBC Acks by Day @ https://flipsidecrypto.xyz/edit/queries/6bafaf52-8974-4cba-a9b4-1687616a1867
with my_txs as (
select
tx_id,
tx_from,
block_timestamp,
replace(fee, 'aevmos', '') / pow(10, 18) as fee_amount
from evmos.core.fact_transactions
where tx_succeeded = 1
and tx_from IN ('evmos1lldjhjnn32e8vek7cxe9g05nf8j74y0xa6dt3p')
and block_timestamp >= CURRENT_DATE - interval '90 day'
and fee LIKE '%aevmos'
),
spent as (
select date_trunc('dd', block_timestamp) as date,
tx_from as address,
sum(fee_amount) as tokens_spent
from my_txs
group by 1, 2
),
price as (
select recorded_at::date as date,
currency,
avg(price) as usd
from osmosis.core.dim_prices
where currency = 'ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A'
group by 1,2
)
select a.date,
a.address,
tokens_spent,
tokens_spent * usd as total_spent
from spent a, price b
Run a query to Download Data