From 3c8a22cb9567e6a5b9c0210310c508599635c8fc Mon Sep 17 00:00:00 2001 From: loganionian <103104454+loganionian@users.noreply.github.com> Date: Tue, 10 Feb 2026 19:34:38 +0800 Subject: [PATCH] Implement token distribution script for bounty issue #47 --- scripts/distribute_tokens.py | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 scripts/distribute_tokens.py diff --git a/scripts/distribute_tokens.py b/scripts/distribute_tokens.py new file mode 100644 index 0000000..18dc745 --- /dev/null +++ b/scripts/distribute_tokens.py @@ -0,0 +1,38 @@ +import os +import requests + +# GitHub API token +GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") +REPO = "Scottcjn/Rustchain" +ISSUE_NUMBER = 47 + +def get_stars_and_comments(): + headers = {"Authorization": f"token {GITHUB_TOKEN}"} + # Fetch stargazers + stars_url = f"https://api.github.com/repos/{REPO}/stargazers" + stargazers = requests.get(stars_url, headers=headers).json() + + # Fetch issue comments + comments_url = f"https://api.github.com/repos/{REPO}/issues/{ISSUE_NUMBER}/comments" + comments = requests.get(comments_url, headers=headers).json() + + return stargazers, comments + +def distribute_tokens(): + stargazers, comments = get_stars_and_comments() + claimed_users = set() + + for comment in comments: + username = comment["user"]["login"] + if username in claimed_users: + continue + claimed_users.add(username) + # Logic to send 2 RTC to the user's wallet (pseudo code) + send_rtc(username) + +def send_rtc(username): + # Placeholder for sending RTC to the user + print(f"Sending 2 RTC to {username}") + +if __name__ == "__main__": + distribute_tokens() \ No newline at end of file