Skip to content

[Testing] collect_fee fee-rounds-to-zero branch untested - positive fee rate but amount too small to charge #794

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

collect_fee guards with if fee > 0 at lib.rs:669. When fee_rate_bps > 0 but amount*bps/10_000 truncates to 0 (e.g. amount=1, 200 bps), no transfer and no FeeCollectedEvent occur and the full amount is credited. The only zero-fee test sets fee_rate_bps=0, a different branch.

Acceptance criteria

  • initialize with a nonzero fee rate, create_stream with a tiny amount where fee rounds to 0
  • Assert treasury balance is 0, deposited_amount == full amount, and no fee_collected event fired

Files to touch

  • contracts/stream_contract/src/test.rs
  • contracts/stream_contract/src/lib.rs

Out of scope

  • fee_rate_bps == 0 case (already covered)

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcontractsSmart contract related tasksrustPull requests that update rust codetestingTesting related tasks

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