Skip to content

Feature/sc 005 - #112

Merged
thlpkee20-wq merged 3 commits into
Chronopay-Org:mainfrom
Drock0:feature/sc-005
Apr 1, 2026
Merged

Feature/sc 005#112
thlpkee20-wq merged 3 commits into
Chronopay-Org:mainfrom
Drock0:feature/sc-005

Conversation

@Drock0

@Drock0 Drock0 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

[SC-005] Persist Slot Ownership Mapping

Description

This PR resolves issue #5 by implementing and verifying the persistence of the slot ownership mapping in the ChronoPayContract.

Closes #5

Changes Introduced

  • Added SlotOwner(u32) to the DataKey enum for persistent state mapping.
  • Added a new Error enum to cleanly handle fallback logic for missing lookups (SlotNotFound = 1).
  • Modified create_time_slot to save the mapped relationship between the newly created slot_id and the professional's proxy String reference into env.storage().persistent().
  • Implemented get_slot_owner, exposing a look-up pattern that accurately fetches the mapped string, raising a clear Host error (SlotNotFound) if uninitialized.

Security Notes & Acceptance Criteria

  • Storage space usage is properly sequestered within standard contract state mapping.
  • No unexpected mutation logic spans outward to external modules.
  • The default failure mode of reading an invalid slot defaults closed via returning a robust result encapsulation wrapped in an Error enum.
  • Fully compatible with current auth stub implementations using proxies.

Testing Output

running 5 tests
test test::test_hello ... ok
test test::test_get_slot_owner_not_found - should panic ... ok
test test::test_get_slot_owner ... ok
test test::test_mint_and_redeem ... ok
test test::test_create_time_slot_auto_increments ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

@drips-wave

drips-wave Bot commented Mar 29, 2026

Copy link
Copy Markdown

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

@Drock0

Drock0 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor Author

@thlpkee20-wq please merge

@Drock0

Drock0 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor Author

@thlpkee20-wq

@thlpkee20-wq
thlpkee20-wq merged commit 8c5866a 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-005] Persist Slot Ownership Mapping

2 participants