binhachonPact.fi LP Pool Actions
    Updated 2022-04-28
    with pact_app_ids as (
    select distinct
    tx_message :txn :apid :: NUMBER as app_id
    from algorand.transactions
    where inner_tx = 'FALSE'
    and tx_message :dt :itx [0] :txn :type :: STRING = 'acfg'
    and tx_message :dt :itx [0] :txn :apar :an :: STRING LIKE '%PACT LP Token'
    and tx_message :dt :itx [0] :txn :apar :au :: STRING = 'https://pact.fi/'
    ),
    tx_group_id as (
    select
    distinct tx_group_id,
    case
    when tx_message :txn :apaa [0] :: string = 'QURETElR' then 'ADDLIQ'
    when tx_message :txn :apaa [0] :: string = 'UkVNTElR' then 'REMLIQ'
    else 'Others' end as type
    from algorand.application_call_transaction
    where app_id IN ( SELECT app_id FROM pact_app_ids )
    and type != 'Others'
    -- tx_message :txn :apaa [0] :: string = 'QURETElR' --ADDLIQ

    -- tx_message :txn :apaa [0] :: string = 'UkVNTElR' --REMLIQ
    ),
    pool_addresses as (
    select
    creator_address
    from algorand.asset
    where asset_id in (
    select distinct asset_id from algorand.account_asset
    where asset_name LIKE '%PACT LP Token'
    )
    ),
    liq_transactions as (
    select
    block_timestamp,
    'Add liquidity' as lp_action,
    Run a query to Download Data