Repository navigation
feat(streak): add freeze tokens to protect a streak for one missed day - #389
Merged
Mkalbani merged 1 commit intoNov 19, 2026
Conversation
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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
contracts/streak_counter/src/lib.rs: freeze token balance per player (grant_freezeis admin-only,get_freezesreads the balance);check_inspends one freeze when the gap is exactly one missed day and emits afrz_usedevent with the remaining balance; at most 2 freezes can be spent in any rolling 30-day window; a longer gap still resets.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.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