KaskoazulSTBL stake
    Updated 2022-03-11
    WITH STAKE AS (
    SELECT
    act.block_timestamp::date as fecha,
    act.tx_group_id,
    act.sender,
    att.asset_amount/pow(10,6) as amount,
    --att.asset_id,
    'STAKE' AS Operation
    FROM
    algorand.application_call_transaction act
    INNER JOIN algorand.asset_transfer_transaction att
    ON act.tx_group_id = att.tx_group_id
    WHERE
    try_base64_decode_string(act.tx_message:txn:note::string) = 'Market: mt'
    AND act.app_id = 482608867
    ),

    UNSTAKE AS (
    SELECT
    block_timestamp::date as fecha,
    tx_group_id,
    sender,
    tx_message:dt:itx[0]:txn:aamt/pow(10,6) as amount,
    'UNSTAKE' AS Operation
    FROM
    algorand.application_call_transaction
    WHERE
    try_base64_decode_string(tx_message:txn:note::string) = 'Market: rcu'
    AND tx_message:txn:apid = 482608867
    AND amount > 0
    ),

    TODO AS (
    SELECT * FROM STAKE
    UNION SELECT * FROM UNSTAKE
    )
    Run a query to Download Data