blue2Number of Wallets Staked goBTC and goETH in Tinyman
    Updated 2022-05-21
    with algofi_address as (select count(distinct ADDRESS) from algorand.ACCOUNT_ASSET
    where asset_name in ('AF-POOL-goETH-STBL-75.0BP','AF-POOL-goETH-STBL-25.0BP','AF-POOL-goBTC-STBL-25.0BP'))
    ,tinyman_address as (select count(distinct ADDRESS) from algorand.ACCOUNT_ASSET
    where asset_name in ('Tinyman Pool goBTC-ALGO','TinymanPool1.1 goBTC-ALGO','TinymanPool1.1 goBTC-ALGO','Tinyman Pool goETH-ALGO',
    'Tinyman Pool goETH-ALGO','TinymanPool1.1 goETH-ALGO','Tinyman Pool ALGO-goBTC','Tinyman Pool ALGO-goBTC'))
    ,pacifi_address as (select count(distinct ADDRESS) from algorand.ACCOUNT_ASSET
    where asset_name in('ALGO/goBTC PACT LP Token','ALGO/goBTC PACT LP Token','ALGO/goETH PACT LP Token'))
    , wallet_algofi_action as ( select count(sender), try_base64_decode_string(tx_message:txn:apaa[0]::string) as actions from algorand.APPLICATION_CALL_TRANSACTION
    where sender in(select distinct address from algorand.ACCOUNT_ASSET
    where asset_name in ('AF-POOL-goETH-STBL-75.0BP','AF-POOL-goETH-STBL-25.0BP','AF-POOL-goBTC-STBL-25.0BP') and amount>0)
    and actions in('SWAP' , 'ADDLIQ' , 'stake' , 'REMLIQ' , 'mint' , 'burn' )
    group by 2)
    , unique_wallet_algofi_action as ( select count(distinct sender), try_base64_decode_string(tx_message:txn:apaa[0]::string) as actions from algorand.APPLICATION_CALL_TRANSACTION
    where sender in(select distinct address from algorand.ACCOUNT_ASSET
    where asset_name in ('AF-POOL-goETH-STBL-75.0BP','AF-POOL-goETH-STBL-25.0BP','AF-POOL-goBTC-STBL-25.0BP') and amount>0)
    and actions in('SWAP' , 'ADDLIQ' , 'stake' , 'REMLIQ' , 'mint' , 'burn' )
    group by 2)
    , wallet_tinyman_action as (select count(sender), try_base64_decode_string(tx_message:txn:apaa[0]::string) as actions from algorand.APPLICATION_CALL_TRANSACTION
    where sender in (select distinct address from algorand.ACCOUNT_ASSET
    where asset_name in ('Tinyman Pool goBTC-ALGO','TinymanPool1.1 goBTC-ALGO','TinymanPool1.1 goBTC-ALGO','Tinyman Pool goETH-ALGO',
    'Tinyman Pool goETH-ALGO','TinymanPool1.1 goETH-ALGO','Tinyman Pool ALGO-goBTC') and amount>0)
    and actions in('SWAP' , 'ADDLIQ' , 'stake' , 'withdraw' , 'REMLIQ' , 'mint' , 'burn')
    group by 2 )
    , unique_wallet_tinyman_action as ( select count( distinct sender), try_base64_decode_string(tx_message:txn:apaa[0]::string) as actions from algorand.APPLICATION_CALL_TRANSACTION
    where sender in (select distinct address from algorand.ACCOUNT_ASSET
    where asset_name in ('Tinyman Pool goBTC-ALGO','TinymanPool1.1 goBTC-ALGO','TinymanPool1.1 goBTC-ALGO','Tinyman Pool goETH-ALGO',
    'Tinyman Pool goETH-ALGO','TinymanPool1.1 goETH-ALGO','Tinyman Pool ALGO-goBTC') and amount>0)
    and actions in('SWAP' , 'ADDLIQ' , 'stake' , 'REMLIQ' , 'mint' , 'burn')
    group by 2 )
    , wallet_pacifi_action as (
    select count(sender), try_base64_decode_string(tx_message:txn:apaa[0]::string) as actions from algorand.APPLICATION_CALL_TRANSACTION
    where sender in(select distinct address from algorand.ACCOUNT_ASSET
    where asset_name in('ALGO/goBTC PACT LP Token','ALGO/goBTC PACT LP Token','ALGO/goETH PACT LP Token') and amount>0)
    and actions in('SWAP' , 'ADDLIQ' , 'stake' , 'REMLIQ' , 'mint' , 'burn' )
    group by 2)
    , unique_wallet_pacifi_action as (select count(distinct sender), try_base64_decode_string(tx_message:txn:apaa[0]::string) as actions from algorand.APPLICATION_CALL_TRANSACTION
    Run a query to Download Data