feat(contract): add creator registration status, treasury address view, key balance helper, and duplicate registration rejection#33
Merged
Chucks1093 merged 1 commit intoMar 26, 2026
Conversation
…w, key balance helper, and duplicate registration rejection - Add is_creator_registered read-only view method (accesslayerorg#28) - Add get_treasury_address and set_treasury_address methods (accesslayerorg#29) - Add read_key_balance shared helper for safe key balance reads (accesslayerorg#30) - Add duplicate creator registration rejection with tests (accesslayerorg#31) - Refactor get_total_key_supply to use read_key_balance helper
|
@Akanimoh12 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.
Summary
This PR adds four contract improvements covering read-only view methods, a shared helper for safe key balance reads, and duplicate creator registration rejection with focused tests.
Closes #28, Closes #29, Closes #30, Closes #31
Issue #28 — Read-only creator registration status method
is_creator_registered(env, creator) -> boolcontract method that returns whether aCreatorProfileexists for the given address.false, registered returnstrue, read-only idempotency, and independent creator lookups.Issue #29 — Read-only protocol treasury address method
DataKey::TreasuryAddressstorage variant.set_treasury_address(env, admin, treasury)admin-only setter.get_treasury_address(env) -> Option<Address>read-only view method returning the current treasury routing target, orNoneif unconfigured.None, configured returns correct address, read-only idempotency, and updates after reconfiguration.Issue #30 — Safe key balance read helper
read_key_balance(env, creator) -> u32public shared helper that reads a creator's key supply, returning0for unregistered creators.get_total_key_supplyto delegate toread_key_balance, eliminating duplicated read logic.Issue #31 — Duplicate registration rejection tests
register_creatorthat panics with"creator already registered"when the creator address already has a stored profile.Verification
All three CI checks pass locally:
Files changed
creator-keys/src/lib.rs— contract logic and helper additionscreator-keys/tests/creator_registration.rs— new test file for Add read-only creator registration status method #28 and Add duplicate registration rejection tests #31creator-keys/tests/treasury_address.rs— new test file for Add read-only protocol treasury address method #29creator-keys/test_snapshots/— auto-generated Soroban test snapshots