Skip to content

feat: implement cancellation accounting events and update refund logic - #270

Merged
Cybermaxi7 merged 1 commit into
MarketXpress:mainfrom
PeterOche:feat/cancellation-accounting-event-change
Aug 20, 2026
Merged

feat: implement cancellation accounting events and update refund logic#270
Cybermaxi7 merged 1 commit into
MarketXpress:mainfrom
PeterOche:feat/cancellation-accounting-event-change

Conversation

@PeterOche

@PeterOche PeterOche commented Aug 20, 2026

Copy link
Copy Markdown

Implemented and validated the cancellation accounting/event changes.

Changes made

  • Added EscrowCancelledEvent with escrow ID, buyer, seller, amount, and funding state.
  • Added TotalCancelledAmount storage accounting and initialized it during contract setup.
  • Added get_total_cancelled_amount public query.
  • Distinguished funded cancellation refunds (EscrowStatus::Cancelled) from dispute refunds (EscrowStatus::Refunded) through shared settlement logic.
  • Updated funded cancellation paths to increment cancellation metrics and emit EscrowCancelledEvent.
  • Updated cancel_unfunded to emit the cancellation event and increment cancellation count without adding an amount, since no funds were deposited.
  • Updated unit tests for cancellation status and cancellation metrics.
  • Removed a brittle event assertion from the unfunded-cancellation test that conflicted with the repository’s generated snapshot workflow.
  • Restored the Soroban Events trait import required by existing event tests.

Validation

  • cargo test --manifest-path contracts/marketx/Cargo.toml
  • Unit tests: 123 passed
  • Integration tests: 2 passed
  • Failures: 0

closes #269

@Cybermaxi7
Cybermaxi7 merged commit a4cbb09 into MarketXpress:main Aug 20, 2026
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.

[high] Cancellation is never recorded: Cancelled status unused, cancelled counter permanently zero, cancellations booked as refunds

2 participants