Skip to content

fix: correct cancel logic for edge cases and expand test coverage#116

Merged
ritik4ever merged 1 commit intoritik4ever:mainfrom
cyber-excel10:fix/cancel-logic-edge-cases
Mar 30, 2026
Merged

fix: correct cancel logic for edge cases and expand test coverage#116
ritik4ever merged 1 commit intoritik4ever:mainfrom
cyber-excel10:fix/cancel-logic-edge-cases

Conversation

@cyber-excel10
Copy link
Copy Markdown
Contributor

Closes #79

Description

Fixed cancel logic edge cases in stellar-stream contract to handle timing scenarios correctly.

Changes

  • Fixed cancel before start: end_time now correctly set to start_time
  • Adjusted total_amount when truncating end_time to preserve vested calculations
  • Fixed vested_amount edge case when total_duration is 0

Testing

  • All 35 tests pass
  • Covers cancel before start, mid-stream, and after full vesting scenarios
  • Verified claimed and refundable amounts behave correctly

Acceptance Criteria

  • ✅ Tests cover cancel before stream start
  • ✅ Tests cover partial vesting refund math
  • ✅ Tests cover cancel after full vesting
  • ✅ Claimed and refundable amounts behave as expected

- Fix cancel before start to set end_time to start_time (not start_time + 1)
- Adjust total_amount when truncating end_time to preserve vested calculations
- Fix vested_amount to return 0 when total_duration is 0
- All 35 tests now pass covering cancel timing edge cases
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@cyber-excel10 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

Someone is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@ritik4ever ritik4ever merged commit 5a3057c into ritik4ever:main Mar 30, 2026
1 of 3 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.

Add Contract Tests For Cancel Refund Edge Cases

2 participants