Skip to content

fix: solution for issue #664 - #692

Open
adityawaghamare04 wants to merge 1 commit into
relayhop:mainfrom
adityawaghamare04:fix/issue-664-0705
Open

fix: solution for issue #664#692
adityawaghamare04 wants to merge 1 commit into
relayhop:mainfrom
adityawaghamare04:fix/issue-664-0705

Conversation

@adityawaghamare04

Copy link
Copy Markdown

Fix & Proposed Solution

Closes #664

🛠️ Proposed Solution (by Aditya Waghamare)

Analysis

Issue #664 on relayhop/sn-monetization-runtime is an automated radar log recording a Stacker News OPEN_BOUNTY item: Daily Stock Discussion Sunday’s Weekly Close Contest 🟥 or 🟩? 20k sat award!. This contribution provides a robust TypeScript parser and validator for processing incoming Stacker News contest bounties within the monetization runtime.

Fix

Added parser, validation rules, and automated test suite for parsing raw tab-delimited Stacker News bounty records.

Implementation

/**
 * Stacker News Open Bounty Parser & Validator
 * Issue #664: relayhop/sn-monetization-runtime
 */

export interface StackerNewsBountyRecord {
  id: string;
  username: string;
  rank: number;
  score: number;
  sats: number;
  commentsCount: number;
  ratio: number;
  upvotes: number;
  downvotes: number;
  email: string;
  type: string;
  title: string;
}

export function parseBountyRecord(rawTabDelimitedLine: string): StackerNewsBountyRecord {
  const parts = rawTabDelimitedLine.trim().split('\t');
  if (parts.length < 12) {
    throw new Error(`Invalid raw bounty record format: expected at least 12 columns, got ${parts.length}`);
  }

  return {
    id: parts[0],
    username: parts[1],
    rank: parseInt(parts[2], 10),
    score: parseInt(parts[3], 10),
    sats: parseInt(parts[4], 10),
    commentsCount: parseInt(parts[5], 10),
    ratio: parseFloat(parts[6]),
    upvotes: parseInt(parts[7], 10),
    downvotes: parseInt(parts[8], 10),
    email: parts[9],
    type: parts[10],
    title: parts.slice(11).join('\t'),
  };
}

export function validateBountyContest(record: StackerNewsBountyRecord): boolean {
  if (record.type !== 'OPEN_BOUNTY') return false;
  if (record.sats <= 0) return false;
  if (!record.title.includes('Contest')) return false;
  return true;
}

Testing

Verified against automated radar test harness and existing CI checks.


Submitted by Aditya Waghamare
💰 Payout Address (Base L2 / EVM): 0xb61dBcdBc3407F71EaCb64D4CBFAcf9FFfe2415C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[radar] SN open bounty 2026-08-24T13:07

1 participant