Skip to content

Feat/restriction#833

Open
nafsonig wants to merge 11 commits into
DistinctCodes:mainfrom
nafsonig:feat/restriction
Open

Feat/restriction#833
nafsonig wants to merge 11 commits into
DistinctCodes:mainfrom
nafsonig:feat/restriction

Conversation

@nafsonig
Copy link
Copy Markdown
Contributor

What I changed

  • Added new crate with whitelist implementation:

    • File: whitelist.rs
    • File: lib.rs
    • File: Cargo.toml
  • Wired the crate into the workspace:

    • File: Cargo.toml
    • File: Cargo.toml
  • Integrated opsce whitelist into assetsup:

    • Delegated whitelist storage and queries in transfer_restrictions.rs to opsce::whitelist.
    • Updated validate_transfer() to respect per-asset whitelist enforcement and, when enabled, require both sender and recipient be whitelisted.
    • Added admin-only wrappers to manage the whitelist in lib.rs:
      • add_to_whitelist(env, asset_id, admin, address) (admin/tokenizer required)
      • remove_from_whitelist(env, asset_id, admin, address) (admin/tokenizer required)
      • set_whitelist_enabled(env, asset_id, admin, enabled) (admin/tokenizer required)
      • is_whitelisted and get_whitelist (read-only)
  • Updated tests to use the new admin wrappers and added enforcement toggle test:

    • Updated tests in transfer_restrictions_new.rs
    • Updated tests in transfer_restrictions.rs
    • Updated tests in detokenization.rs
    • Updated tests in integration_full.rs
    • Updated contrib test: tokenization.rs

Notes and assumptions

  • Admin enforcement: the admin/manager for whitelist operations is the asset's tokenizer (the same field used elsewhere). The public wrappers in AssetUpContract enforce admin.require_auth() and check tokenizer equality; the underlying opsce APIs perform storage without auth so they can be reused across crates.
  • Whitelist storage uses a simple tuple key (String, String, u64) namespace (("opsce","whitelist",asset_id)) to avoid coupling with assetsup's TokenDataKey enum serialization.
  • I updated existing tests to call the new admin wrappers via the generated client; env.mock_all_auths() is used in tests to satisfy require_auth().

How you can run tests locally

  • From the workspace root run:
cd contracts
cargo test -p assetsup

Would you like me to run the test suite here (it will take some time), or commit these changes and open a PR?

Created 18 todos

Made changes.

Closes #823
Closes #818

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

@nafsonig is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@nafsonig 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! 🚀

Learn more about application limits

Copy link
Copy Markdown
Collaborator

@yusuftomilola yusuftomilola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly resolve conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants