Skip to content

[Contract] — Invite Code Expiry and Usage Caps #1332

Description

@Olowodarey

Labels: contract, enhancement, invite

Problem

Invite codes never expire and can be reused an unlimited number of times, undermining any referral or access-control scheme built on top of them.

Requirements

  1. Store an optional expiry ledger timestamp per invite code.
  2. Store a maximum-uses counter and increment on each redemption.
  3. Reject redemption of expired or exhausted codes.
  4. Expose a read function returning remaining uses and expiry.

Acceptance Criteria

  • Redemption reverts once the code is expired or use cap is reached.
  • Remaining uses decrement correctly and never go negative.
  • Read function returns accurate remaining uses and expiry.
  • Tests cover expiry, exhaustion, and valid redemption.

Files

contracts/open-market/src/invite.rs, contracts/open-market/src/storage_types.rs, contracts/open-market/src/errors.rs

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions