0xaimanlp loop liquidity
    Updated 2022-01-23

    -----this good
    /*
    select *
    from terra.msg_events, table(flatten(input=>EVENT_ATTRIBUTES))ea
    where tx_id='C1001D96EE7E1C7CA5C898DA72ED2686ACFE6B29A3786765D36B7A2B2E461026' and event_type='wasm'

    limit 100
    */

    -- mega da6ta 1

    --lca and wlp



    with lwp as
    (with lw as (
    with wnv as -- wnv=withdraw and value
    ( with burn as
    (select tx_id , ea.value/1000000 as wlp
    from terra.msg_events, table(flatten(input=>EVENT_ATTRIBUTES))ea
    where --tx_id='C1001D96EE7E1C7CA5C898DA72ED2686ACFE6B29A3786765D36B7A2B2E461026' and
    event_type='wasm'
    and key='0_amount'
    ),



    --this is withdrawal data
    wdata as
    (select tx_id
    from terra.msg_events, table(flatten(input=>EVENT_ATTRIBUTES))ea
    where --tx_id='C1001D96EE7E1C7CA5C898DA72ED2686ACFE6B29A3786765D36B7A2B2E461026' and
    event_type='wasm' and key='1_action' and value='withdraw_liquidity'