Query editor
WITH period_filter AS (SELECT periodIdFROM (VALUES(42), (41), (40), (39), (38), (37), (36), (30), (29)) t(periodId)),/* Period allocations */allocations AS (SELECTdate_trunc('month', evt_block_time) AS month,periodId,totalAllocated / 1e18 AS allocated_tokensFROM facy_claimvault_base.claimvault_evt_claimperiodcreatedWHERE periodId IN (SELECT periodId FROM period_filter)),monthly_allocation AS (SELECTmonth,SUM(allocated_tokens) AS monthly_allocationFROM allocationsGROUP BY 1),/* Claims */claims AS (SELECTdate_trunc('month', evt_block_time) AS month,periodId,"user" AS wallet,amount / 1e18 AS claimed_tokensFROM facy_claimvault_base.claimvault_evt_tokensclaimedWHERE periodId IN (SELECT periodId FROM period_filter)),/* Monthly claimed */monthly_claimed AS (SELECTmonth,SUM(claimed_tokens) AS monthly_rewards_distributedFROM claimsGROUP BY 1),/* Cumulative claimed */monthly_claimed_cum AS (SELECTmonth,monthly_rewards_distributed,SUM(monthly_rewards_distributed) OVER (ORDER BY month)AS rewards_distributed_upto_monthFROM monthly_claimed),/* Median reward per qualified (claimer) */monthly_user_totals AS (SELECTmonth,wallet,