John_GaltPrism -> UST
    Updated 2022-04-08
    with prism_ust as (select
    date(block_timestamp) as date,
    event_attributes:offer_amount / pow(10, 6) as blank_offer,
    event_attributes:"0_offer_amount" / pow(10, 6) zero_offer,
    event_attributes:"1_offer_amount" / pow(10, 6) one_offer,
    tx_id as tx,
    event_attributes:receiver as blank_receiver,
    event_attributes:"1_receiver" as one_receiver,
    case
    when event_attributes:offer_asset = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' then 'prism_blank'
    when event_attributes:"0_offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' then 'prism_zero'
    when event_attributes:"1_offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' then 'prism_one'
    end as which_offer_asset_prism
    from terra.msg_events
    where date(block_timestamp) = '2022-04-07'
    and event_index = 3
    and (event_attributes:"0_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
    event_attributes:"1_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
    event_attributes:"2_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
    event_attributes:"3_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
    event_attributes:"4_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
    event_attributes:"5_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
    event_attributes:"6_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u' or
    event_attributes:"8_contract_address" = 'terra19d2alknajcngdezrdhq40h6362k92kz23sz62u')
    and (event_attributes:offer_asset = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' or
    event_attributes:"0_offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' or
    event_attributes:"1_offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw')
    ),

    union_add as (select date, blank_receiver as Address, blank_offer as Prism_Offered, tx
    from prism_ust
    where which_offer_asset_prism = 'prism_blank'
    union all
    select date, one_receiver as Address, zero_offer as Prism_Offered, tx
    from prism_ust
    where which_offer_asset_prism = 'prism_zero'
    Run a query to Download Data