Skip to content

refactor: add creator existence helper for shared checks#25

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
JamesVictor-O:feat/issue-14-creator-existence-helper
Mar 26, 2026
Merged

refactor: add creator existence helper for shared checks#25
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
JamesVictor-O:feat/issue-14-creator-existence-helper

Conversation

@JamesVictor-O

@JamesVictor-O JamesVictor-O commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #14

  • Extracted a private require_creator(env: &Env, creator: &Address) -> CreatorProfile helper into a dedicated impl CreatorKeysContract block
  • buy_key now calls Self::require_creator instead of repeating the inline storage lookup + panic pattern
  • Error message "creator not registered" is unchanged, keeping existing tests and caller behaviour intact

Test plan

  • test_buy_key_unregistered_creator_panics — still panics with expected message via helper
  • test_buy_key_insufficient_payment_panics — unaffected by refactor
  • test_buy_key_sufficient_payment_succeeds — continues to pass

All existing tests pass without modification.

- Extract require_creator(env, creator) -> CreatorProfile helper to a
  private impl block, replacing the duplicated inline storage lookup
- buy_key now uses Self::require_creator to validate creator registration,
  keeping error message consistent ("creator not registered")
- All existing tests pass without modification

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Chucks1093 Chucks1093 merged commit ba321b4 into accesslayerorg:main Mar 26, 2026
1 check 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.

Add creator existence helper for shared checks

2 participants