John_GaltLP Percent Finder - Spare
    Updated 2022-06-20
    with poolfilter as (select
    distinct tx_id as tx
    from osmosis.core.fact_msg_attributes
    where date(block_timestamp) between '2021-10-01' and '2022-01-01'
    and (msg_type = 'pool_joined' or msg_type = 'pool_exited')
    and attribute_key = 'pool_id'
    and attribute_value = '497' --osmo - JUNO
    ),

    addrfilter as (select
    distinct tx_id as tx,
    SPLIT_PART(attribute_value, '/', 1) as address
    from osmosis.core.fact_msg_attributes as o
    inner join poolfilter on o.tx_id = poolfilter.tx
    where msg_type = 'tx'
    and attribute_key = 'acc_seq'
    ),

    mintfilter1 as (select
    address,
    msg_index as index,
    tx_id as tx
    from osmosis.core.fact_msg_attributes as o
    inner join addrfilter on o.tx_id = addrfilter.tx
    where msg_type = 'transfer'
    and attribute_key = 'sender'
    and attribute_value = 'osmo1c9y7crgg6y9pfkq0y8mqzknqz84c3etr0kpcvj' --minter
    ),

    mintfilter2 as (select
    address,
    SPLIT_PART(attribute_value, 'gamm', 1) / pow(10, 18) as mint_amount,
    tx_id as tx
    from osmosis.core.fact_msg_attributes as o
    inner join mintfilter1 on o.tx_id = mintfilter1.tx and o.msg_index = mintfilter1.index
    where msg_type = 'transfer'
    Run a query to Download Data