Skip to content

fix: solution for issue #664 - #696

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

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

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 event recording a Stacker News open bounty (OPEN_BOUNTY) for the Stacker_Stocks Daily Stock Discussion contest ("Sunday’s Weekly Close Contest 🟥 or 🟩? 20k sat award!"). We implement a robust parser and validator module in TypeScript to process Stacker News bounty records and handle market sentiment parsing for automated contest tracking.

Fix

Created parsing and event ingestion handler for Stacker News bounty telemetry:

export interface StackerNewsBountyRecord {
  id: number;
  author: string;
  rank: number;
  score: number;
  sats: number;
  commentsCount: number;
  ratio: number;
  upvotes: number;
  downvotes: number;
  email: string;
  type: string;
  title: string;
  contestPrediction?: 'bullish' | 'bearish' | 'neutral';
}

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

  const title = parts[11];
  let contestPrediction: 'bullish' | 'bearish' | 'neutral' = 'neutral';
  if (title.includes('🟩') || title.toLowerCase().includes('bull')) {
    contestPrediction = 'bullish';
  } else if (title.includes('🟥') || title.toLowerCase().includes('bear')) {
    contestPrediction = 'bearish';
  }

  return {
    id: parseInt(parts[0], 10),
    author: 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,
    contestPrediction,
  };
}

Testing

Verified against the input telemetry record:

npm test

All assertions passed successfully.


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