binhachon106. [Easy] New Money - MIR-UST pair
    Updated 2021-12-07
    with Apollo_factory_contract as(
    select
    'terra1leadedadm2fguezmd4e445h6fe337yzq8n2dxf' as contract_address,
    'HALO Community Farming' as contract_name
    union
    select
    'terra1g7jjjkt5uvkjeyhp8ecdz4e4hvtn83sud3tmh2' as contract_address,
    'Apollo main factory contract' as contract_name
    ),
    UST_zap_in_temp as(
    SELECT
    block_timestamp,
    tx_id,
    EVENT_ATTRIBUTES : "lp_token" :: string as lp_address,
    EVENT_ATTRIBUTES : "0_contract_address" :: string as factory_contract,
    EVENT_ATTRIBUTES : "4_amount" :: float / 1e6 as lp_amount,
    EVENT_ATTRIBUTES : "0_amount" :: float / 1e6 as ust_zap_in
    FROM
    terra.msg_events
    WHERE
    EVENT_TYPE = 'from_contract'
    AND EVENT_ATTRIBUTES : "0_action" = 'zap_into_strategy'
    AND EVENT_ATTRIBUTES : "0_contract_address" in (
    select
    contract_address
    from
    Apollo_factory_contract
    )
    and tx_status = 'SUCCEEDED'
    ),
    Apollo_transactions as(
    -------------------------------------------------LP Deposit------------------------------------------------------------------------
    select
    block_timestamp,
    tx_id,
    event_attributes : "0_from" :: string as address,
    Run a query to Download Data