Query editor
-- First observed Meteora LP day per (scope, wallet), before the cutoff.-- Same actions and scopes as query 8705597. 'All Meteora' excludes pool-- creators, as there. cutoff = first day of the month in which this was-- refreshed; Meteora Daily sql/02_lps_sweeps.sql scans only from cutoff - 1.WITH actions AS (SELECT "from" wallet,'DLMM' scope,evt_block_date block_date FROM meteora_solana.lb_clmm_evt_addliquidityUNION ALL SELECT account_owner,'DAMM v2',call_block_date FROM meteora_solana.cp_amm_call_add_liquidityUNION ALL SELECT account_user,'DAMM v1',call_block_date FROM meteora_pools_solana.amm_call_addbalanceliquidityUNION ALL SELECT account_user,'DAMM v1',call_block_date FROM meteora_pools_solana.amm_call_addimbalanceliquidityUNION ALL SELECT account_creator,'Pool creators (DAMM v1+v2)',call_block_date FROM meteora_solana.cp_amm_call_initialize_poolUNION ALL SELECT account_creator,'Pool creators (DAMM v1+v2)',call_block_date FROM meteora_solana.cp_amm_call_initialize_customizable_poolUNION ALL SELECT account_payer,'Pool creators (DAMM v1+v2)',call_block_date FROM meteora_pools_solana.amm_call_initializepermissionlesspoolUNION ALL SELECT account_payer,'Pool creators (DAMM v1+v2)',call_block_date FROM meteora_pools_solana.amm_call_initializepermissionlesspoolwithfeetierUNION ALL SELECT account_payer,'Pool creators (DAMM v1+v2)',call_block_date FROM meteora_pools_solana.amm_call_initializepermissionlessconstantproductpoolwithconfigUNION ALL SELECT account_payer,'Pool creators (DAMM v1+v2)',call_block_date FROM meteora_pools_solana.amm_call_initializepermissionlessconstantproductpoolwithconfig2), scoped AS (SELECT wallet, scope, MIN(block_date) first_day FROM actionsWHERE block_date < CAST(date_trunc('month', current_date) AS date) AND wallet IS NOT NULLGROUP BY 1, 2)SELECT scope, wallet, first_day, CAST(date_trunc('month', current_date) AS date) AS cutoff FROM scopedUNION ALLSELECT 'All Meteora', wallet, MIN(first_day), CAST(date_trunc('month', current_date) AS date)FROM scoped WHERE scope <> 'Pool creators (DAMM v1+v2)' GROUP BY 2