lagandispenserFolks Finance average Deposits and Redeems
    Updated 2022-07-02
    with deposits_ as (
    select
    case when APP_ID = 686498781 then 'ALGO'
    when APP_ID = 686500029 then 'USDC'
    when APP_ID = 686500844 then 'USDt'
    when APP_ID = 686501760 then 'goBTC'
    when APP_ID = 694405065 then 'goETH'
    when APP_ID = 694464549 then 'gALGO3'
    when APP_ID = 743679535 then 'ALGO/gALGO3 TMP1.1'
    when APP_ID = 743685742 then 'ALGO/gALGO3 PLP'
    when APP_ID = 747239433 then 'ALGO/USDC PLP'
    when APP_ID = 747237154 then 'ALGO/USDC TMP1.1'
    end as asset_name,
    sender ,
    tx_group_id
    from flipside_prod_db.algorand.application_call_transaction
    where APP_ID in (686498781,686500029,686500844,686501760,694405065,694464549,743679535,743685742)
    and TRY_BASE64_DECODE_STRING(tx_message :txn :apaa [0] :: STRING) = 'd'
    group by 1,2,3 having asset_name is not NULL
    ),
    deposit_amounts as (
    select
    d.SENDER,
    asset_name,
    (ASSET_AMOUNT/1e6) as deposit_amount ,
    min(BLOCK_TIMESTAMP) as deposit_date
    from algorand.asset_transfer_transaction t join deposits_ d
    on d.tx_group_id = t.tx_group_id
    group by 1,2,3
    ),
    redeems_ as (
    select
    case when APP_ID = 686498781 then 'ALGO'
    when APP_ID = 686500029 then 'USDC'
    when APP_ID = 686500844 then 'USDt'
    when APP_ID = 686501760 then 'goBTC'
    Run a query to Download Data