alirs4 protocols_fee
    Updated 2022-07-14
    WITH App_Calls AS
    (
    SELECT
    case
    when app_id in (776179559,776176449,752770929,751285119,747239433,747237154,743685742,743679535,696044550,694464549,694405065,686876641,
    686875498,686862190,686860954,686501760,686500844,686500029,686498781) then 'Folks finance'
    when app_id in (705663269,705657303,674527132,661247364,661207804,661204747,661199805,661193019,661192413,659678644,659677335,658337046,658336870,
    647785804,647785158,641500474,641499935,639747739,639747119,611869320,553866305,482625868,465814222,465814065,674526408,637795072,637793356,
    635866213,635864509,635863793,635860537,635813909,635812850,611867642,611804624,611801333,605753404,553869413,482608867,465818260,465814318,
    465814278,465814149,465814103) then 'algoFi'
    when app_id in (649588853 ,350338509,552635992) then 'Tinyman'
    when app_id in (354073718 ,354073834 ) then 'AlgoDEX'
    end as App_Type,fee
    ,tx_group_id ,tx_id,app_id
    FROM
    flipside_prod_db.algorand.application_call_transaction
    WHERE
    block_timestamp::date >= '2022-04-01' ),
    Tx_Total as (
    select
    TX.block_timestamp::date as DAY
    , apc.app_type,tx.fee
    , tx.tx_group_id
    , tx.tx_id
    from flipside_prod_db.algorand.transactions TX join App_Calls apc
    on tx.tx_group_id=apc.tx_group_id
    where apc.tx_group_id is not NULL
    and block_timestamp::date >= '2022-04-01'
    union
    select
    tx.block_timestamp::date as DAY
    , apc.app_type,tx.fee
    , tx.tx_group_id
    Run a query to Download Data