KaskoazulCOSG stake
    Updated 2022-04-30
    with stake as (
    SELECT t.block_timestamp::date as fecha,
    count (distinct t.tx_group_id) as stake_actions,
    sum(stake_actions) over (order by fecha) as cum_actions,
    sum (t.tx_message:txn:aamt/pow(10,6)) as stake_amounts,
    sum(stake_amounts) over (order by fecha) as cum_amounts
    FROM algorand.transactions t
    INNER JOIN algorand.application_call_transaction act
    ON t.tx_group_id = act.tx_group_id
    WHERE act.app_id = 710543830
    AND t.tx_type_name = 'asset transfer'
    AND t.asset_id = '571576867'
    AND TRY_BASE64_DECODE_STRING(act.tx_message:txn:apaa[0]::STRING) = 'S'
    group by 1
    ),

    unstake as (
    SELECT t.block_timestamp::date as fecha,
    count (distinct t.tx_group_id) as unstake_actions,
    sum(unstake_actions) over (order by fecha) as cum_actions,
    sum (t.tx_message:txn:aamt/pow(10,6)) as unstake_amounts,
    sum(unstake_amounts) over (order by fecha) as cum_amounts
    FROM algorand.transactions t
    INNER JOIN algorand.application_call_transaction act
    ON t.tx_group_id = act.tx_group_id
    WHERE act.app_id = 710543830
    AND t.tx_type_name = 'asset transfer'
    AND t.asset_id = '571576867'
    AND TRY_BASE64_DECODE_STRING(act.tx_message:txn:apaa[0]::STRING) = 'W'
    group by 1
    )


    select s.fecha,
    s.stake_actions,
    s.cum_actions as total_stake_actions,
    Run a query to Download Data