Skip to content

feat: add installment payment support to atomic swaps#484

Merged
fejilaup-cloud merged 1 commit into
AtomicIP:mainfrom
levi0005:feature/installment-payments-v2
May 28, 2026
Merged

feat: add installment payment support to atomic swaps#484
fejilaup-cloud merged 1 commit into
AtomicIP:mainfrom
levi0005:feature/installment-payments-v2

Conversation

@levi0005
Copy link
Copy Markdown
Contributor

closes #407

  • Add paid_amount: i128 and is_installment: bool fields to SwapRecord
  • Implement submit_installment_payment(swap_id, payment_amount) buyer-only: transfers tokens to escrow, accumulates paid_amount, transitions swap to Accepted and emits swap_acpt event when paid_amount >= price
  • Implement get_installment_status(swap_id) -> (paid, total, remaining)
  • initiate_swap_with_schedule sets is_installment=true on the swap record
  • Reject overpayment, zero payment, non-installment swaps, non-Pending swaps
  • Add 7 tests: initial status, partial paid, fields stored, non-installment defaults, fully paid remaining=0, non-installment panics, overpayment panics

- Add paid_amount: i128 and is_installment: bool fields to SwapRecord
- Implement submit_installment_payment(swap_id, payment_amount) buyer-only:
  transfers tokens to escrow, accumulates paid_amount, transitions swap to
  Accepted and emits swap_acpt event when paid_amount >= price
- Implement get_installment_status(swap_id) -> (paid, total, remaining)
- initiate_swap_with_schedule sets is_installment=true on the swap record
- Reject overpayment, zero payment, non-installment swaps, non-Pending swaps
- Add 7 tests: initial status, partial paid, fields stored, non-installment
  defaults, fully paid remaining=0, non-installment panics, overpayment panics
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@levi0005 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

@fejilaup-cloud fejilaup-cloud merged commit 38771f6 into AtomicIP:main May 28, 2026
0 of 2 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.

Implement Escrow-Based Atomic Swap with Partial Payments

2 participants