Skip to content

Implement Investor Participant Counter and Maximum Investor Cap #105

@Jayy4rl

Description

@Jayy4rl

Description

Many regulatory frameworks limit the number of investors in a private securities offering (e.g., Regulation D in the US limits to 35 non-accredited investors, MiFID II in Europe has similar thresholds). The vault has no concept of investor count — anyone who passes KYC can deposit regardless of how many other investors already hold shares.

Requirements

  • Add a DataKey::InvestorCount → u32 in instance storage
  • Add a max_investors: u32 field to InitParams (0 = unlimited)
  • Track unique investors: increment counter on first deposit (user_deposited == 0 before this deposit), decrement when a user fully redeems (all shares burned, balance == 0)
  • In deposit and mint: if investor_count >= max_investors and this is a new investor, panic with Error::MaxInvestorsReached
  • Add view functions: investor_count() -> u32, max_investors() -> u32
  • Add set_max_investors(caller, max) -> () — admin-only
  • Consider edge case: user A deposits, transfers all shares to user B (new investor), then A has 0 balance — should A be decremented? Yes, on next interaction or via a cleanup_investor_count function

Key Files

  • lib.rsdeposit, mint, withdraw, redeem, redeem_at_maturity, transfer
  • storage.rs — new keys
  • types.rsInitParams new field
  • errors.rs — new MaxInvestorsReached variant

Definition of Done

  • Investor count tracks unique share holders
  • Max investor cap enforced on new deposits
  • Count decrements when users fully exit
  • Admin can update the cap
  • Tests cover: cap enforcement, re-entry after exit, transfer impact on count

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions