Summary
Unredeemed rewards accumulate indefinitely. For campaigns with promotional points (e.g. 'earn double points this month'), points should optionally expire after a configurable period. This is standard in loyalty programs and prevents indefinite liability for campaign operators.
Problem
- No expiry mechanism exists; balances are permanent
- Operators have no way to create time-limited promotional rewards
- Dormant balances inflate total_credited stats
Acceptance Criteria
References
contracts/rewards/src/lib.rs:180 — credit()
contracts/rewards/src/lib.rs:264 — claim()
Summary
Unredeemed rewards accumulate indefinitely. For campaigns with promotional points (e.g. 'earn double points this month'), points should optionally expire after a configurable period. This is standard in loyalty programs and prevents indefinite liability for campaign operators.
Problem
Acceptance Criteria
credit_with_expiry(env, from, user, amount, expires_at_ledger: u64)function(EXPIRY, user) -> Vec<(amount, expires_at)>balance(user)must filter expired credits before returning the sumclaim()must consume non-expired credits first (FIFO)prune_expired(user)callable by anyone to clean up expired storage and free TTL (incentivize cleanup via no-op success)credit_no_expiry()alias for the currentcredit()behavior (backward compatible)contracts/rewards/README.mdReferences
contracts/rewards/src/lib.rs:180—credit()contracts/rewards/src/lib.rs:264—claim()