fanta3fee
    Updated 2022-05-15
    with temp as
    (select tx_id ,min(block_timestamp) as min_date, max(amount_usd) as max_amount from ethereum.udm_events
    where contract_address = '0x6b175474e89094c44da98b954eedeac495271d0f' and from_address = '0x0000000000000000000000000000000000000000' and event_name = 'transfer'
    group by tx_id )
    select * from
    (
    select
    date(min_date) as date
    , sum(max_amount) as net_amount
    ,2.42/100*net_amount*1/100 as stability_fee_usdc
    ,0.2664*net_amount*2.75/100
    + 0.84/100*net_amount*6.5/100
    + 5.81/100*net_amount*0.5/100
    + 0.59/100*net_amount*4/100
    + 0.1165*net_amount*4/100
    + 0.02/100*net_amount*7/100
    + 2.42/100*net_amount*1/100 as total_fee
    from temp
    where year(min_date)=2022
    group by min_date
    )
    Run a query to Download Data