Skip to content

Add whitelist early access window so creators can reward their existing community before public launch#530

Open
Johnpii1 wants to merge 7 commits into
accesslayerorg:mainfrom
Johnpii1:main
Open

Add whitelist early access window so creators can reward their existing community before public launch#530
Johnpii1 wants to merge 7 commits into
accesslayerorg:mainfrom
Johnpii1:main

Conversation

@Johnpii1

Copy link
Copy Markdown

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 -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace

Checklist

  • Linked issue or backlog item
  • Added or updated creator-keys unit/integration tests for every changed contract behavior, including failure paths for new or reachable ContractError variants
  • Ran cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace, or explained exactly why a command was not run
  • Reviewed persistent storage changes against docs/storage-key-invariants.md; any storage layout change includes a migration/backward-compatibility note
  • Confirmed event names, topic order, payload field order, and field meanings remain compatible with docs/contract-event-conventions.md, or documented the breaking change and versioning plan
  • Updated docs for any changed public contract interface, read-only method, event schema, storage behavior, fee logic, or deployment workflow
  • Scope stays limited to one contract concern and does not include unrelated formatting, lockfile, generated artifact, or dependency changes

close #518

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 whitelist early access window so creators can reward their existing community before public launch

1 participant