Query editor
WITH profile AS (SELECTprofile.fid,profile.fname,profile.display_name,profile.avatar_url,ROW_NUMBER() OVER (PARTITION BY profile.fid ORDER BY LENGTH(profile.verified_addresses) DESC NULLS LAST) AS rnFROM dune.neynar.dataset_farcaster_profile_with_addresses profile),tips AS (SELECT-- Tip allowances are loaded at 7:35 UTC. Casts after midnight until then-- are made against the previous day's tip allowance.DATE_TRUNC('day', casts.timestamp - INTERVAL '7' HOUR - INTERVAL '35' MINUTE) AS event_day,casts.timestamp,casts.parent_fid AS recipient_fid,casts.fid AS donor_fid,CAST(REGEXP_EXTRACT(REGEXP_EXTRACT(UPPER(casts.text), '([0-9]+) \$DEGEN'), '[0-9]+') AS DOUBLE) AS tip_amount,CASEWHEN root_parent_url IN ('chain://eip155:8453/erc721:0x1e5115dc60cdab3c1263a945201cb509ea7a8340', -- FarcastHER'chain://eip155:1/erc721:0x2A9EA02E4c2dcd56Ba20628Fe1bd46bAe2C62746', -- FarCon'https://warpcast.com/~/channel/frames', --Fframes'https://onchainsummer.xyz', -- Base'chain://eip155:1/erc721:0x7dd4e31f1530ac682c8ea4d8016e95773e08d8b0', -- Dev'chain://eip155:7777777/erc721:0x22be981fb87effbe6780b34a6fe1dfc14a00ec8e', -- Design'chain://eip155:7777777/erc721:0x3d037b11c5359fac54c3928dfad0b9512695d392', -- Frontend'https://farcaster.group/founders', -- Founders'https://warpcast.com/~/channel/perl', -- Perl'https://farcaster.group/product', -- Product'chain://eip155:1/erc721:0xca21d4228cdcc68d4e23807e5e370c07577dd152' -- Zora) THEN 1.5ELSE 1.0END AS channel_boostFROMdune.neynar.dataset_farcaster_casts castsWHEREcasts.fid NOT IN (217745, 234434, 244128) -- Exclude @degenbot, @degentip, @degentokenbaseAND REGEXP_LIKE(UPPER(casts.text), '[0-9]+ \$DEGEN')AND casts.parent_hash IS NOT NULLAND casts.deleted_at IS NULLAND casts.timestamp > TO_DATE('20240227', 'yyyymmdd')AND casts.parent_fid <> casts.fid),daily_donated_tips AS (SELECTtips.event_day,tips.recipient_fid,tips.donor_fid,tips.tip_amount,tips.channel_boost,SUM(tips.tip_amount) OVER (PARTITION BY tips.event_day, tips.donor_fidORDER BY tips.tip_amount DESC, tips.timestamp) AS donated_amount,allowance.tip_allowance AS donor_tip_allowanceFROMtipsINNER JOINdune.degentokenbase.result_airdrop_2_tip_allocations allowance