Skip to content

Add FX rate snapshot, swap refund routing, dispute splits, receipt hash - #558

Merged
Pvsaint merged 2 commits into
MetroLogic:mainfrom
yosemite01:feat/fx-rate-snapshot-swap-refund-splits-receipt-hash
Jul 26, 2026
Merged

Add FX rate snapshot, swap refund routing, dispute splits, receipt hash#558
Pvsaint merged 2 commits into
MetroLogic:mainfrom
yosemite01:feat/fx-rate-snapshot-swap-refund-splits-receipt-hash

Conversation

@yosemite01

Copy link
Copy Markdown
Contributor

Summary

  • PaymentCharge.fx_rate/fx_rate_at now populated by verify_payment when an FX oracle is configured via new set_fx_oracle; emits PAYMENT/FX_RATE_UNAVAILABLE otherwise.
  • swap_and_pay now records original_token/swap_path; process_refund routes the refund back through a configured DEX router (set_dex_router_address), falling back to a plain USDC transfer + REFUND/SWAP_FALLBACK if the swap fails.
  • Dispute.payout_splits (+ new set_dispute_payout_splits) lets resolve_dispute_with_refund distribute funds to multiple recipients instead of a single refund, validated against Error::InvalidSplitSum.
  • Refund.receipt_hash accepted by create_refund, optionally enforced by process_refund via set_refund_policy (Error::MissingReceiptHash), emitting REFUND/HASH_VERIFIED.

Test plan

  • cargo test -p fluxapay

Closes #446
Closes #448
Closes #445
Closes #443

🤖 Generated with Claude Code

https://claude.ai/code/session_01GV7kHHjcVZur14umd34W28

Ndifreke000 and others added 2 commits July 26, 2026 18:55
- Capture fx_rate/fx_rate_at on PaymentCharge during verify_payment when
  an FX oracle is configured (set_fx_oracle); emits
  PAYMENT/FX_RATE_UNAVAILABLE when no rate can be captured
- Record original_token/swap_path on swap_and_pay payments and route
  process_refund back through the configured DEX router
  (set_dex_router_address), falling back to a plain USDC refund with
  REFUND/SWAP_FALLBACK on failure
- Add Dispute.payout_splits + set_dispute_payout_splits, distributing
  funds to multiple recipients in resolve_dispute_with_refund when
  configured, validated against Error::InvalidSplitSum
- Add Refund.receipt_hash, accepted by create_refund and optionally
  enforced by process_refund via set_refund_policy
  (Error::MissingReceiptHash), emitting REFUND/HASH_VERIFIED
- Remove an accidental duplicate DexRouter contract/impl block in
  dex_router.rs that prevented the crate from compiling

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GV7kHHjcVZur14umd34W28
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

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

@Pvsaint
Pvsaint merged commit 5401b77 into MetroLogic:main Jul 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment