Query editor
-- $PRINT Sale: per-bidder leaderboardWITH inflows AS (SELECT block_time, tx_id, token_balance_change AS usdc_inFROM solana.account_activityWHERE address = '6RnmnGcV6Sgbytnb2LhupJsbNvXXSieu7ozQ4ymosAL7'AND block_time >= TIMESTAMP '2026-04-28 12:15:00'AND token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'AND token_balance_change > 0AND tx_success = true),outflows AS (SELECT a.tx_id, a.token_balance_owner AS bidderFROM solana.account_activity aINNER JOIN inflows i ON a.tx_id = i.tx_idWHERE a.block_time >= TIMESTAMP '2026-04-28 12:15:00'AND a.token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'AND a.token_balance_change < 0AND a.token_balance_owner != 'orrgBzGDwjSTCFZpy7oa35SuWRq8SMyLjy5ay1FoFwt'),bids AS (SELECT i.block_time, i.tx_id, o.bidder, CAST(i.usdc_in AS double) AS usdc_amountFROM inflows iINNER JOIN outflows o ON i.tx_id = o.tx_idWHERE o.bidder IS NOT NULL),agg AS (SELECTbidder,SUM(usdc_amount) AS total_usdc,COUNT(*) AS bid_count,MAX(block_time) AS last_bid_time,MAX_BY(tx_id, block_time) AS last_tx_idFROM bidsGROUP BY 1)SELECTROW_NUMBER() OVER (ORDER BY total_usdc DESC) AS rank,bidder,total_usdc,bid_count,last_bid_time,'https://solscan.io/tx/' || last_tx_id AS txn_hash,last_tx_idFROM aggORDER BY total_usdc DESC