Skip to content

[CT-02] Implement on-chain Member Tier Calculator in Rust #1019

@devwums

Description

@devwums

Problem

Member tier classification exists only in the NestJS backend. The smart contract layer has no knowledge of tiers, making on-chain tier-based rewards unverifiable and gameable.

Proposed Solution

Create contracts/cntr/member_tier.rs defining #[derive(Debug, PartialEq, Clone)] pub enum MemberTier { Bronze, Silver, Gold, Platinum } and implementing pub fn calculate_tier(total_bookings: u32, total_spend_stroops: i128) -> MemberTier. Tier thresholds (either condition triggers upgrade): Bronze = default, Silver = 10+ bookings OR 5,000,000 stroops, Gold = 30+ OR 20,000,000 stroops, Platinum = 100+ OR 100,000,000 stroops. All implementation must live inside contracts/cntr/.

Acceptance Criteria

  • File at contracts/cntr/member_tier.rs
  • MemberTier enum derives Debug, PartialEq, Clone
  • All 4 tiers are reachable via the function
  • Boundary conditions correct (e.g., exactly 10 bookings returns Silver)
  • At least 8 unit tests in a #[cfg(test)] block
  • 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