Sandeshpolygon_fee
    Updated 2022-11-15
    with matic_price as
    (
    select date_trunc('hour',hour) as time, price
    from ethereum.core.fact_hourly_token_prices
    where symbol='MATIC'
    ),
    matic_fee_table as
    (
    select
    'polygon' as chain,
    ft.block_number as block_number,
    ft.block_timestamp,
    ft.tx_hash as tx_hash,
    ft.from_address as from_address,
    ft.to_address as to_address,
    ft.tx_fee as tx_fee,
    p.price,
    (tx_fee*p.price) as tx_fee_usd,
    ft.STATUS as status
    from polygon.core.fact_transactions ft
    inner join matic_price p
    on date_trunc('hour',ft.block_timestamp)=p.time
    where 1=1
    and ft.block_timestamp > CURRENT_DATE - interval ' 30 days'
    -- and tx_hash='0x224bd8c63fe0d9dee11d3ef6ee2e9ee801bdc998bf922d5c4c3a4a26ec62317e'
    -- limit 5
    )
    select * from matic_fee_table
    -- where tx_hash='0x1e422e286d0fdcc7712f2177c103f11e1ec7c0a9bcd0bae1536bdc20b2d67e2b'
    limit 100
    Run a query to Download Data