binhachonStaking STBL on AlgoFi
    Updated 2022-05-18
    with stake_tx_group_id as (
    select
    distinct tx_group_id
    from algorand.application_call_transaction
    where app_id = 482608867
    and try_base64_decode_string(tx_message:txn:note::string) = 'Market: mt'
    ),
    stake_transaction as (
    select
    block_timestamp,
    sender,
    asset_amount/1e6 as amount
    from algorand.asset_transfer_transaction
    where tx_group_id in (select tx_group_id from stake_tx_group_id)
    and asset_transferred = 465865291
    ),
    stake_table as (
    select
    block_timestamp::date as stake_time,
    count(*) as number_of_stake_actions,
    sum(amount) as number_of_stake_STBL
    from stake_transaction
    group by stake_time
    ),
    unstake_transaction as (
    select
    block_timestamp,
    sender as asset_receiver,
    tx_message:dt:itx[0]:txn:aamt::float/1e6 as amount
    from algorand.application_call_transaction
    where app_id = 482608867
    and try_base64_decode_string(tx_message:txn:note::string) = 'Market: rcu'
    and inner_tx = 'FALSE'
    ),
    unstake_table as (
    select
    Run a query to Download Data