Skip to content

feat: batch swap features — reputation, insurance, arbitration, escrow#567

Open
Sundriveauto wants to merge 4 commits into
AtomicIP:mainfrom
Sundriveauto:feature/batch-swap-features
Open

feat: batch swap features — reputation, insurance, arbitration, escrow#567
Sundriveauto wants to merge 4 commits into
AtomicIP:mainfrom
Sundriveauto:feature/batch-swap-features

Conversation

@Sundriveauto
Copy link
Copy Markdown

@Sundriveauto Sundriveauto commented May 28, 2026

Closes #505

Close #506

Close #507

Closes #508

Summary

Implements four batch swap features, each as a separate commit:

1. Reputation for batch swaps

  • batch_reveal_keys now calls update_reputation(+5) for both seller and buyer on each completed swap, mirroring the single-swap reveal_key path.

2. Insurance for batch swaps

  • batch_accept_swaps now collects insurance premiums from the buyer and deposits them into the InsurancePool, mirroring accept_swap.
  • New batch_initiate_swap_with_insurance: batch initiation with insurance_enabled flag; sets premium to 2% of each swap price.

3. Arbitration for batch swaps

  • New batch_arbitrate_swaps: resolves multiple Disputed swaps in one call. Arbitrator decides refund (→ Cancelled) or complete (→ Completed) uniformly for the batch, handling collateral and protocol fees.

4. Escrow payments for batch swaps

  • New batch_escrow_deposit: buyer deposits into multiple escrow-mode swaps in one call, moving each from Pending to Accepted.
  • Fixed batch_initiate_escrow and initiate_swap_with_signers: added missing paid_amount/is_installment fields to SwapRecord construction.

Tests

New batch_swap_features_tests module with 9 tests covering all four features.

batch_reveal_keys now calls update_reputation(+5) for both seller and
buyer on each successfully completed swap, mirroring the single-swap
reveal_key behaviour.
- batch_accept_swaps now collects insurance premiums from the buyer
  and deposits them into the InsurancePool, mirroring accept_swap
- Add batch_initiate_swap_with_insurance: batch initiation with
  insurance_enabled flag; sets premium to 2% of each swap price
Add batch_arbitrate_swaps: resolves multiple Disputed swaps in one
call. Arbitrator decides refund (Cancelled) or complete (Completed)
uniformly for the batch, handling collateral and protocol fees.
- Add batch_escrow_deposit: buyer deposits into multiple escrow-mode
  swaps in one call, moving each from Pending to Accepted
- Fix batch_initiate_escrow and initiate_swap_with_signers: add
  missing paid_amount/is_installment fields to SwapRecord construction
- Add batch_swap_features_tests module with 9 tests covering:
  reputation updates, insurance premium collection, batch arbitration
  (refund and complete), and batch escrow deposit
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 28, 2026

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

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 Swap Batch Reputation Add Swap Batch Insurance Implement Swap Batch Arbitration Add Swap Batch Escrow

1 participant