KaskoazulGovernance Period 4 - extended
    Updated 2023-01-03
    -- FOLKS FINANCE
    with committed_tx as(
    select distinct block_timestamp,
    tx_group_id,
    sender
    from algorand.application_call_transaction
    where try_base64_decode_binary(tx_message:txn:apaa[1]::string) is NULL
    ),
    committed_amounts as (
    select commits.block_timestamp::date as fecha, commits.tx_group_id as tx_group_id, payment.sender as wallet, payment.amount as commit_amount
    from committed_tx commits
    left join algorand.payment_transaction payment
    on payment.tx_group_id = commits.tx_group_id and payment.sender = commits.sender
    where receiver = 'EPYLSPIP3OOKRBFFWKZJWDSPGCYEKUPYBB677GWC2TFYTMU6QP3JZ7OMOQ'
    ),
    removed_tx as(
    select distinct block_timestamp,
    tx_group_id,
    sender
    from algorand.application_call_transaction
    where try_base64_decode_binary(tx_message:txn:apaa[1]::string)::string = '01'
    ),
    removed_amounts as (
    select removed.block_timestamp::date as fecha, removed.tx_group_id as tx_group_id, payment.receiver as wallet, payment.amount * -1 as removed_amount
    from removed_tx removed
    left join algorand.payment_transaction payment on payment.tx_group_id = removed.tx_group_id and payment.receiver = removed.sender
    where payment.sender = 'EPYLSPIP3OOKRBFFWKZJWDSPGCYEKUPYBB677GWC2TFYTMU6QP3JZ7OMOQ'
    ),
    -- union add and remove groups
    all_amounts as(
    select *, 'add' as type from committed_amounts
    UNION
    select *, 'remove' as type from removed_amounts
    ),
    Run a query to Download Data