Skip to content

Add helper for asserting total supply matches sum of all holder balances in test fixtures #492

Description

@Chucks1093

Summary

A key invariant of the contract is that total supply always equals the sum of all individual holder balances. Tests that modify supply or balances should verify this invariant after every state change. A shared assertion helper makes this check easy to add to any test.

Scope

  • Add assert_supply_equals_holder_sum(env, creator_id, holders: Vec<Address>) test helper
  • Reads total supply and each holder's balance, sums balances, asserts equality
  • Panics with a descriptive message showing total supply and computed sum if they differ
  • Use the helper in existing buy, sell, and transfer tests

Acceptance Criteria

  • Helper correctly identifies a supply/balance mismatch
  • Panic message shows both expected and actual values
  • Helper passes when supply and holder sum match exactly
  • Used in at least three existing test cases

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

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