Skip to content

[CT-24] Implement transfer restriction whitelist management in assetsup in opsce crate #823

@yusuftomilola

Description

@yusuftomilola

Problem

contracts/assetsup/src/transfer_restrictions.rs references a whitelist concept but has no functions to add, remove, or query addresses on the whitelist. Transfer restriction checks cannot function without the underlying whitelist management API.

Proposed Solution

Create contracts/opsce/src/whitelist.rs. Implement add_to_whitelist(), remove_from_whitelist(), is_whitelisted(), and a toggle to enable/disable whitelist enforcement per asset.

Acceptance Criteria

  • add_to_whitelist(env, asset_id, address) adds an address (admin only)
  • remove_from_whitelist(env, asset_id, address) removes an address (admin only)
  • is_whitelisted(env, asset_id, address) returns a bool
  • set_whitelist_enabled(env, asset_id, enabled) toggles enforcement (admin only)
  • When enforcement is enabled, transfer_tokens() must call is_whitelisted() on both sender and recipient
  • get_whitelist(env, asset_id) returns the full list of whitelisted addresses as a Vec
  • Unit tests cover: add, remove, transfer allowed, transfer blocked, enforcement toggle

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions