0xaimanExamining Loop Liquidity
    Updated 2022-01-26

    with lp as (select this:by as pool, this:from as sender, this:share/1000000 as LP_position
    from terra.msg_events, table(flatten(input=>event_attributes))ea
    where --tx_id='139E0D797702E37BE9C8F4EFBFBFA67DB97BF95732A92D0B7625F6AB467654A2' and
    event_type='from_contract' and value='mint'),

    add as (
    select address,address_name
    from terra.labels
    where label='loop' and LABEL_SUBTYPE='pool' --or LABEL_SUBTYPE='token_conract'
    --and address='terra1nef5jf6c7js9x6gkntlehgywvjlpytm7pcgkn4'

    )

    select pool,ADDRESS_NAME, count(sender) as n_lp, avg(lp_position) as ave_liquidity
    from lp
    inner join add on lp.pool=add.address
    group by 1,2 order by 4 desc
    Run a query to Download Data