Sandeshflow_FEES 1
Updated 2022-11-16
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 flow_price as
(
select date_trunc('hour',timestamp) as time, avg(price_usd) as price
from flow.core.fact_prices
where symbol = 'FLOW'
and source='coinmarketcap'
group by time
),
flow_fee as
(
select tx_id,event_data:"amount" as tx_fee from flow.core.fact_events
where 1=1
-- and tx_id='45157287d12a4901806e9154e6a0f63c07b27de724df406519474413a0ff779b'
and event_type='FeesDeducted'
and block_timestamp > CURRENT_DATE - interval ' 1 month'
),
-- rec as
-- (
-- select tx_id,event_data:"amount" as amount, event_data:"to" as to_address from flow.core.fact_events
-- where 1=1
-- -- and tx_id='45157287d12a4901806e9154e6a0f63c07b27de724df406519474413a0ff779b'
-- and event_type='TokensDeposited'
-- and block_timestamp > CURRENT_DATE - interval ' 1 month'
-- ),
flow_combined as
(
select t.*,flow_fee.tx_fee,'0x' as to_address from flow.core.fact_transactions t inner join flow_fee on t.tx_id=flow_fee.tx_id
-- inner join rec r on t.tx_id=r.tx_id
),
flow_fee_table as
(
select
'flow' as chain,
ft.BLOCK_HEIGHT as block_number,
Run a query to Download Data