Query editor
withbounties as (SELECTu.value as username, c.fid--doing a comma replace in case they write "$15,000" or something, regexp_extract_all(replace(c.text,',',''), '\$\d+(?:\.\d+)?k?') as dollars, regexp_extract_all(replace(c.text,',',''), '(?i)(?<!\d)\.?\d+(?:\.\d+)?.{0,3}ETH') as eth, regexp_extract_all(replace(c.text,',',''), '(?i)(?<!\d)\.?\d+(?:\.\d+)?.{0,3}USD') as usdc, regexp_extract_all(replace(c.text,',',''), '(?i)(?<!\d)\.?\d+(?:\.\d+)?.{0,3}DEGEN') as degen, regexp_extract_all(replace(c.text,',',''), '(?i)(?<!\d)\.?\d+(?:\.\d+)?.{0,3}WARP') as warp, c.text, c.hash as bounty_hash, c.parent_hash, c.root_parent_hash, c.timestamp as create_timestamp, complete.timestamp as complete_timestamp, progress.timestamp as progress_timestamp, cancel.timestamp as cancel_timestamp, get_href(concat('https://warpcast.com/',u.value,'/',cast(bytearray_substring(c.hash,1,4) as varchar)), substring(c.text,1,50) || '...') as bounty_linkFROM dune.neynar.dataset_farcaster_casts cLEFT JOIN dune.neynar.dataset_farcaster_user_data u ON u.type = 6 AND u.fid = c.fidLEFT JOIN dune.neynar.dataset_farcaster_casts confirm ON confirm.fid = 20596and (confirm.text like 'Thanks for posting a bounty%'OR confirm.text like '%Confirmed!%')and confirm.parent_hash = c.hash --the bounty hash is the one being replied to by the botLEFT JOIN dune.neynar.dataset_farcaster_casts cancel ON cancel.fid = c.fidand lower(cancel.text) like '%cancel%'and cancel.root_parent_hash = c.root_parent_hash --check the whole threadand contains(cancel.mentions,20596)--and contains(-- split(replace(replace(replace(cancel.mentions,'[',''),']',''),' ',''),',')-- ,'20596')LEFT JOIN dune.neynar.dataset_farcaster_casts complete ON complete.fid = 20596AND complete.root_parent_hash = c.root_parent_hash --check the whole threadAND lower(complete.text) like 'your bounty%marked as complete%'LEFT JOIN dune.neynar.dataset_farcaster_casts progress ON progress.fid = 20596AND progress.root_parent_hash = c.root_parent_hash --check the whole threadAND lower(progress.text) like 'your bounty%marked as in progress%'WHERE 1=1and (--require bountybot confirmation with instructions to remove spam. or directly posted from siteconfirm.hash is not nullOR (lower(c.text) like '%this bounty was posted from our website%' and c.fid = 20596))and c.fid not in (20609,20590,20840,20514,20589) --check casts are not from test accountsand c.deleted_at is null --cast not deletedand c.hash not in (0xfe281cce381d6a3c44cdf45969b35f2f46bda639,0xd2ec77b6033a1ae47b11a8c81087640c07f2daba,0xdc76bc9dfe2e3bac018e5c6d0687546e34be57d7)-- and bytearray_substring(c.hash,1,4) = 0x506248e5-- and cancel.text is null --bounty is not cancelled-- and c.hash = 0x5727a985687c10b6a37e9439b2b7a3ce141c6237 --crowdfund bounty https://warpcast.com/dwr.eth/0x5727a985-- and c.hash = 0x6e371f2248c39db36f2de4b3351ab73166cd75df --test bounty https://warpcast.com/linda/0xb1b143cf), cleaned_base as (SELECTb.username, b.fid, try(case when dollars[1] like '%k%' then 1000 else 1 end* cast(trim(replace(replace(lower(dollars[1]),'$',''),'k','')) as double)) as dollars