LTirrell03_tinyman
    Updated 2022-01-13
    with tinyman_txs as(
    select
    tx_group_id,
    sender,
    tx_type
    from
    algorand.transactions
    where
    tx_group_id is not null
    and tx_type = 'appl'
    and inner_tx = 'FALSE'
    and block_id < '18363444' -- Jan 1st, day of exploit
    and block_id > '16550000' -- Oct 1st, around launch of tinyman
    and tx_message :txn :apid :: number = 350338509
    and tx_message :txn :apaa :: string like '%c3dhcA==%' --base64 encoded for swap
    ),
    payment_info as (
    select
    tx_group_id,
    asset_id,
    sender,
    case
    when tx_type = 'pay' then tx_message :txn :amt :: number
    when tx_type = 'axfer' then tx_message :txn :aamt :: number
    end as amount,
    -- tx_message :txn :note :: string as note,
    tx_type
    from
    algorand.transactions
    -- where
    -- asset_id in (
    -- 0,
    -- 226701642,
    -- 31566704,
    -- 300208676,
    -- 297995609,