Skip to content

feat: Add whitelisting capability for approved addresses#30

Merged
Divineifed1 merged 2 commits into
Exquisitech:mainfrom
yusuftomilola:feat/whitelist-capability
Jul 19, 2026
Merged

feat: Add whitelisting capability for approved addresses#30
Divineifed1 merged 2 commits into
Exquisitech:mainfrom
yusuftomilola:feat/whitelist-capability

Conversation

@yusuftomilola

Copy link
Copy Markdown
Contributor

Summary

Implements whitelisting capability in the Soroban session contract, fulfilling all acceptance criteria in the issue.

What's Changed

src/lib.rs

  • DataKey::Admin and DataKey::Whitelist(Address) storage keys added
  • initialize(admin) — one-time admin setup during deployment
  • �dd_to_whitelist(address) — admin-only; emits AddedToWhitelist event

emove_from_whitelist(address) — admin-only; emits RemovedFromWhitelist event

  • is_whitelisted(address) -> bool — public read
  • create_session — enforces onlyWhitelisted guard; non-whitelisted callers panic with "caller is not whitelisted"

src/test.rs

  • est_add_to_whitelist — verifies address is tracked after add
  • est_remove_from_whitelist — verifies address is removed
  • est_non_admin_cannot_add — non-admin call reverts
  • est_whitelisted_user_can_create_session — whitelisted user can create a session
  • est_non_whitelisted_user_cannot_create_session — non-whitelisted user is blocked
  • est_revoke_session — session revocation still works
  • est_whitelist_events_emitted — events published without panic

closes #27

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 whitelisting capability for approved addresses or tokens

2 participants