cypheraddresses that provide liquidity on aUST-UST pool on LOOP
    Updated 2022-01-26
    with aust_ust_addresses as (with provided_liq as (
    select
    event_attributes:sender as provider,
    sum(event_attributes:share) as added_lp,
    CASE
    WHEN event_attributes:"0_contract_address" = 'terra123neekasfmvcs4wa70cgw3j3uvwzqacdz2we03' THEN 'aust-ust'
    ELSE NULL
    END as pool
    from terra.msg_events
    where event_type = 'wasm'
    and event_attributes:share is not null
    and event_attributes:"0_contract_address" in
    ('terra123neekasfmvcs4wa70cgw3j3uvwzqacdz2we03')
    group by provider, pool
    ),
    withdrawn_liq as (
    select
    event_attributes:sender as remover,
    sum(event_attributes:withdrawn_share) as removed_lp,
    CASE
    WHEN event_attributes:"1_contract_address" = 'terra123neekasfmvcs4wa70cgw3j3uvwzqacdz2we03' THEN 'aust-ust'
    ELSE NULL
    END as pool
    from terra.msg_events
    where event_type = 'wasm'
    and event_attributes:withdrawn_share is not null
    and event_attributes:"1_contract_address" in
    ('terra123neekasfmvcs4wa70cgw3j3uvwzqacdz2we03')
    group by remover, pool
    ),

    net_lp_table_2 as (select provided_liq.provider as address, provided_liq.added_lp-withdrawn_liq.removed_lp as net_lp, provided_liq.pool
    from provided_liq, withdrawn_liq
    where provided_liq.provider = withdrawn_liq.remover and provided_liq.pool = withdrawn_liq.pool)
    select address
    Run a query to Download Data