Add whitelist early access window so creators can reward their existing community before public launch#530
Open
Johnpii1 wants to merge 7 commits into
Open
Add whitelist early access window so creators can reward their existing community before public launch#530Johnpii1 wants to merge 7 commits into
Johnpii1 wants to merge 7 commits into
Conversation
…window Add optional creator whitelist early-access window
Fix formatting and cleanup in emergency_pause tests
…reator-keys Fix governance poll registration tests
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
Add WhitelistConfig and WhitelistStatus contract types, new DataKey::Whitelist storage key, and MAX_WHITELIST_SIZE = 500 constant for registration-time validation.
Append WhitelistOnly and WhitelistTooLarge ContractError variants and extend the register_creator ABI with an optional whitelist_window: Option parameter; store the whitelist immutably at registration and validate size ≤ 500.
Enforce whitelist-only buys during the configured window by adding assert_whitelist_buy_allowed into buy_key, plus helpers read_whitelist_config, whitelist_expires_at, and is_whitelist_window_active to compute active/expiry state.
Add get_whitelist_status(creator) view returning { active: bool, expires_at_ledger: u32, remaining_ledgers: u32 } and extend TTL handling to keep whitelist metadata alive alongside other creator state.
Update all test call-sites to the new register_creator ABI and add a new integration test file creator-keys/tests/whitelist_window.rs covering: non-whitelisted rejection during window, whitelisted buy success, public buy after expiry, status active/expired checks, over-500 rejection, and no-whitelist immediate public buy.
Testing
Ran formatting check with cargo fmt --all -- --check and linting with cargo clippy --workspace --all-targets -- -D warnings, both succeeded.
Ran the new suite cargo test --test whitelist_window and all whitelist tests passed (6 passed; 0 failed).
Ran the workspace test suite with the long-running regression test skipped via cargo test --workspace -- --skip test_flat_buy_price_lower_than_linear_at_supply_10000, and the run completed successfully (all executed tests passed).
Verified unit/integration test updates compile and the contract behaves as expected for the new whitelist flows (no regressions observed in the executed test subsets).
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceChecklist
creator-keysunit/integration tests for every changed contract behavior, including failure paths for new or reachableContractErrorvariantscargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings, andcargo test --workspace, or explained exactly why a command was not rundocs/storage-key-invariants.md; any storage layout change includes a migration/backward-compatibility notedocs/contract-event-conventions.md, or documented the breaking change and versioning planclose #518