with add_liq as (
select BLOCK_TIMESTAMP::date as add_date ,
LIQUIDITY_PROVIDER_ADDRESS,
tx_id ,
CURRENCY ,
amount/pow(10,decimal) as total
from osmosis.core.fact_liquidity_provider_actions
where BLOCK_ID BETWEEN 4707300 and 4713064
and ACTION = 'pool_joined'
and TX_STATUS = 'SUCCEEDED'
)
, add_address as (
select add_date ,
count(DISTINCT tx_id) as total_add,
LIQUIDITY_PROVIDER_ADDRESS as add_address ,
LABEL as lb,
sum(total) as total_add_amount
from osmosis.core.dim_labels b join add_liq a on b.address = a.currency
where total is not null
group by 1,3,4
order by 2 desc
)
, remove as (
select BLOCK_TIMESTAMP::date as remove_date ,
LIQUIDITY_PROVIDER_ADDRESS ,
tx_id ,
CURRENCY ,
amount/pow(10,decimal) as total
from osmosis.core.fact_liquidity_provider_actions
where BLOCK_ID BETWEEN 4707300 and 4713064
and ACTION = 'pool_exited'
and TX_STATUS = 'SUCCEEDED'
)
, remove_address as (
select remove_date ,
count(DISTINCT tx_id) as total_remove,