Skip to content

Fix zero-fee tipping and add edge case test#182

Merged
Mosas2000 merged 2 commits intomainfrom
test/zero-fee-tipping
Feb 26, 2026
Merged

Fix zero-fee tipping and add edge case test#182
Mosas2000 merged 2 commits intomainfrom
test/zero-fee-tipping

Conversation

@Mosas2000
Copy link
Copy Markdown
Owner

Summary

Fix a bug where tips would fail when platform fees are set to 0, and add a test covering this edge case.

Problem

stx-transfer? in Clarity rejects 0-amount transfers. When fee-basis-points was set to 0, the fee transfer call would fail, making tipping impossible.

Fix

Guard the fee transfer with a (> fee u0) check, skipping it entirely when no fee is charged.

Test

Verify that a 1,000,000 uSTX tip with 0% fee produces exactly one transfer event with the full amount going to the recipient.

All 35 tests pass.

Closes #72

Guard the fee stx-transfer? call with a check for fee > 0.
Previously, setting fee-basis-points to 0 would cause tips to
fail because stx-transfer? rejects zero-amount transfers.
Confirm that when fee-basis-points is set to 0, sending a tip
produces only one STX transfer event with the full amount going
to the recipient and no fee transfer to the contract owner.
@Mosas2000 Mosas2000 merged commit 8dff933 into main Feb 26, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No test coverage for sending tips with zero-fee edge case

1 participant