Skip to content

[CT-22] Implement Membership Token ID and Ownership Validator in Rust #1039

@devwums

Description

@devwums

Problem

Membership token validation is scattered and untested. There is no utility to independently verify a token ID format or confirm ownership without parsing the full token contract state.

Proposed Solution

Create contracts/cntr/token_validator.rs implementing: pub fn is_valid_token_id(token_id: &str) -> bool (validates UUID v4 format using the regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$) and pub fn is_token_owner(token_id: &str, claimed_owner: &str, registry: &[(String, String)]) -> bool where the registry is a list of (token_id, owner_address) pairs. All implementation must live inside contracts/cntr/.

Acceptance Criteria

  • File at contracts/cntr/token_validator.rs
  • is_valid_token_id validates UUID v4 format exactly
  • Rejects UUID v1, v3, v5, and malformed strings
  • is_token_owner returns false for unregistered token IDs
  • is_token_owner returns false when owner does not match
  • At least 6 unit tests for is_valid_token_id and at least 4 for is_token_owner
  • Compiles with cargo test

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

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