Skip to content

feat(contract): [SC-009] Prevent Double Minting Per Slot#117

Merged
thlpkee20-wq merged 2 commits into
Chronopay-Org:mainfrom
KayProject:feature/sc-009
Apr 1, 2026
Merged

feat(contract): [SC-009] Prevent Double Minting Per Slot#117
thlpkee20-wq merged 2 commits into
Chronopay-Org:mainfrom
KayProject:feature/sc-009

Conversation

@KayProject

Copy link
Copy Markdown
Contributor

Summary

Implements SC-009 — prevents any slot from being minted more than once in the ChronoPay contract.

Changes

  • Added Minted(u32) variant to DataKey enum to track minted slots

  • Updated mint_time_token to check storage before minting and panic with "slot already minted" if the slot has already been minted

  • Added test_prevent_double_mint_same_slot test using #[should_panic] to verify the guard works

Security Notes

  • Guard uses instance storage — same ledger scope as all other contract state

  • Panic is deterministic and immediate — no partial state is written on double-mint attempt

  • Slot ID is scoped per u32 key — no cross-slot interference

Test Coverage

  • Existing tests (test_hello, test_create_time_slot_auto_increments, test_mint_and_redeem) unchanged and unaffected

  • New test confirms second mint on same slot reverts as expected

Closes #9

@drips-wave

drips-wave Bot commented Mar 30, 2026

Copy link
Copy Markdown

@KayProject 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

@thlpkee20-wq thlpkee20-wq merged commit fa701be into Chronopay-Org:main Apr 1, 2026
0 of 3 checks passed
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.

[SC-009] Prevent Double Minting Per Slot

2 participants