Skip to content

feat: add on-chain streak counter for daily puzzle check-ins - #377

Open
jamz-dev wants to merge 1 commit into
MindFlowInteractive:mainfrom
jamz-dev:feat/issue-365-on-chain-streak-counter
Open

jamz-dev wants to merge 1 commit into
MindFlowInteractive:mainfrom
jamz-dev:feat/issue-365-on-chain-streak-counter

Conversation

@jamz-dev

Copy link
Copy Markdown

Overview

This PR adds a Soroban contract in contracts/streak_counter that tracks per-player consecutive-day puzzle completion streaks. A check-in records a completed day using ledger time for day boundaries, increments the streak on consecutive days, resets it when a day is missed, and ignores repeat check-ins within the same day.

Related Issue

Changes

🔥 Streak Counter Contract

  • [MODIFY] contracts/streak_counter/src/lib.rs
    • Defines per-player streak state (current streak, last completed day).
    • Adds a check-in function that records a completed day for the calling player.
    • Derives the current day index from ledger timestamp so day boundaries follow chain time.
    • Increments the streak when the check-in lands on the day after the last completed day.
    • Resets the streak to 1 when one or more days were missed.
    • Treats a same-day repeat check-in as a no-op so it does not double count.
    • Includes unit tests covering consecutive increments, missed-day resets, and same-day repeats.

Verification Results

cargo test -p streak_counter
Acceptance Criteria Status
Streak increments on consecutive days ✅ Covered by unit tests
Missed day resets streak ✅ Covered by unit tests
Same-day repeat check-ins do not double count ✅ Covered by unit tests
All tests pass ✅ Contract unit tests

Closes #365

@jamz-dev
jamz-dev force-pushed the feat/issue-365-on-chain-streak-counter branch from 5b29571 to 4af00af Compare November 10, 2026 14:09
@drips-wave

drips-wave Bot commented Nov 10, 2026

Copy link
Copy Markdown

Warning

Possible malicious code: please review before merging.

An automated security scan flagged files in this pull request that appear to contain malicious code. Code like this can run automatically when a project is opened in an editor or its dependencies are installed, so it could compromise the machine of anyone who checks out this branch.

Automated scans can be wrong, so this may be a false positive. Maintainers: please review the flagged files carefully before merging, on GitHub in your browser rather than by checking out the branch. The malicious part is often hidden far off to the right of an ordinary-looking line, so scroll sideways through each file.

@jamz-dev: this pull request adds or changes these files, possibly without your knowledge. Malware like this spreads by adding itself to repositories on machines it has infected, so your machine might be compromised. Please undo these changes in this pull request, and don't open or run other projects on that machine until you've checked it.

Flagged files at commit 4af00af:

Only merge once you're confident these files are safe.

ℹ️ Posted automatically by Drips Wave. Questions? Contact support@drips.network.

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.

On-Chain Streak Counter

1 participant