Skip to content

feat(streak): add freeze tokens to protect a streak for one missed day - #389

Merged
Mkalbani merged 1 commit into
MindFlowInteractive:mainfrom
devflora-princess:fix/issue-366-streak-freeze-tokens
Nov 19, 2026
Merged

Mkalbani merged 1 commit into
MindFlowInteractive:mainfrom
devflora-princess:fix/issue-366-streak-freeze-tokens

Conversation

@devflora-princess

Copy link
Copy Markdown
Contributor

Overview

Players can now spend a freeze token to protect a streak from one missed day. A freeze is spent automatically on checking in after exactly one missed day, so the streak continues instead of resetting.

Closes #366

Changes

  • [MODIFY] contracts/streak_counter/src/lib.rs: freeze token balance per player (grant_freeze is admin-only, get_freezes reads the balance); check_in spends one freeze when the gap is exactly one missed day and emits a frz_used event with the remaining balance; at most 2 freezes can be spent in any rolling 30-day window; a longer gap still resets.
  • [MODIFY] contracts/streak_counter/src/test.rs: 7 new tests covering freeze protection, no spend on consecutive days, two missed days not covered, the rolling limit, the limit rolling over after 30 days, admin-only grants, and per-player balances.
  • [MODIFY] contracts/streak_counter/README.md: freeze token rules documented.

Verification Results

  • cargo test --locked (isolated crate, as in CI): 18 passed, 0 failed.
  • cargo fmt -- --check: clean.
  • cargo clippy --locked --all-targets -- -D warnings: clean.
  • cargo build --locked --release --target wasm32v1-none: clean.

Acceptance Criteria

Criteria Status
Freeze prevents reset for one missed day ✅
Freeze limits enforced ✅
Events emitted on use ✅

Players with a freeze balance spend one automatically on checking in
after exactly one missed day, so the streak continues instead of
resetting. At most 2 freezes can be spent in any rolling 30-day window.
Only the admin can grant freezes; spending a freeze emits an event.

Closes MindFlowInteractive#366
@drips-wave

drips-wave Bot commented Nov 19, 2026

Copy link
Copy Markdown

@devflora-princess Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Mkalbani
Mkalbani merged commit 72b13e4 into MindFlowInteractive:main Nov 19, 2026
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.

Streak Freeze Tokens

2 participants