binhachonFolks Finance Deposits and Redeems - #5
    Updated 2022-05-18
    with collateral_list as (
    select
    asset_id,
    creator_address,
    decimals
    from flipside_prod_db.algorand.asset
    where asset_id in ( 686505742, --fALGO
    686508050, --fUSDC
    686509463, --fUSDt
    686510134, --fgoBTC
    694408528, --fgoETH
    694474015 --fgALGO3
    )
    ),
    borrow_list as (
    select
    asset_id,
    asset_name,
    decimals
    from flipside_prod_db.algorand.asset
    where asset_id in ( 0, --ALGO
    31566704, --USDC
    312769, --USDt
    386192725, --goBTC
    386195940, --goETH
    694432641 --gALGO3
    )
    ),
    deposit_and_redeem_transactions as (
    select
    distinct
    case when try_base64_decode_string(tx_message :txn :apaa [0] :: string) = 'd' then 'Deposit' else 'Redeem' end as type,
    app_id,
    tx_group_id
    from flipside_prod_db.algorand.application_call_transaction
    where app_id in ( 686498781, --ALGO
    Run a query to Download Data